fix(framebuffer): typo in einkfb_update
Merge pull request #239 from koreader/dxg

fix(framebuffer): typo in einkfb_update
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.
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.
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.
simplification: factor out common matrix operations
add mupdfbmp API to mupdf FFI interface
use mupdf FFI API instead of mupdfbmp API