add wrappers for mupdf API that will handle exceptions

This will provide wrapper functions for mupdf functions that
might throw exceptions.

These wrapper functions will catch exceptions and instead return
a dedicated error value.

This error value could be NULL for functions that return pointers,
could be -1 for functions that return ints or could be anything else.

Note that in any case the functions will have a fz_context as their
first argument - indepedent of it is demanded by the mupdf API (in
most cases, it's the same for the mupdf API, but there are exceptions
to that rule).

As a convention, the wrapper functions start with "mupdf_" rather
than "fz_" or "pdf_" as per the original mupdf API.
use mupdf wrapper in mupdfbmp

Probably, we can do everything in mupdf.lua that is still being
done in mupdfbmp. For now, just switch to the wrapper API.
fix a bug in old mupdf Lua/C API

wrong return values for functions: The Lua/C interface expects
the functions to return the number of return values, which should
have been put onto the stack. That wasn't done here, so we return
0 in all cases.
pthread API declarations

TODO: check if this applies the same way to Android. Otherwise, split
this up conditionally on the system it runs on.
FFI-based interface for mupdf

This replaces the old Lua/C API for mupdf. It is a drop-in replacement
for the old API, i.e. the calls are the same for now.

add mupdfbmp API to mupdf FFI interface
test suite for the mupdf API

this ought to work for both the new FFI based interface and the old
Lua/C API based one.
use mupdf FFI API instead of mupdfbmp API
remove old Lua/C based mupdf API
remove old mupdfimg wrapper

functionality is now included in the mupdf FFI API

Note that this will need slight modifications where the old interface
was used.
koptcontext: return 8bpp/24bpp blitbuffers

Will not downgrade bmp buffers to 4bpp blitbuffers, but rather return
8bit/24bit blitbuffers, depending on input data.
fix clang compiling error
This patch fixes Travis error:
```
clang -Imupdf/include -Lbuild/x86_64-unknown-linux-gnu/libs -O2
-ffast-math -pipe -fomit-frame-pointer -D__extern_always_inline=inline
-Qunused-arguments -march=native -fPIC -Iluajit-2.0/src -shared -Wl,-E
-Wl,-rpath,'$ORIGIN' \
                -o build/x86_64-unknown-linux-gnu/libs/libwrap-mupdf.so
                wrap-mupdf.c wrap-mupdf.h
                build/x86_64-unknown-linux-gnu/libs/libmupdf.so
                build/x86_64-unknown-linux-gnu/libs/libk2pdfopt.so.2
clang: error: cannot specify -o when generating multiple output files
make: *** [build/x86_64-unknown-linux-gnu/libs/libwrap-mupdf.so] Error 1
```
Merge pull request #3 from chrox/hwhw-master

fix clang compiling error
Merge pull request #238 from hwhw/master

FFI-based MuPDF API