| 1 |
Directory tree: |
| 2 |
|
| 3 |
Makefile Builds and runs tests. |
| 4 |
include/ Public API. |
| 5 |
src/ Scripts, C implementation and internal headers. |
| 6 |
build/ Generated object files, executables etc. |
| 7 |
test/ Test files. |
| 8 |
generated/ Files generated by tests. |
| 9 |
|
| 10 |
Suggested setup for testing: |
| 11 |
Checkout ghostpdl and mupdf into the same directory. |
| 12 |
Inside ghostpdl: |
| 13 |
ln -s ../mupdf/thirdparty/extract extract |
| 14 |
|
| 15 |
Then either: |
| 16 |
Inside ghostpdl: |
| 17 |
./autogen.sh --with-extract-dir=extract |
| 18 |
make -j 8 debug DEBUGDIRPREFIX=debug-extract- |
| 19 |
Inside mupdf: |
| 20 |
make -j 8 debug |
| 21 |
or: |
| 22 |
make test-rebuild-dependent-binaries (for the first time) |
| 23 |
make test-build-dependent-binaries (for incremental builds) |
| 24 |
|
| 25 |
|
| 26 |
Then build and run tests from inside mupdf/thirdparty/extract |
| 27 |
as below. |
| 28 |
|
| 29 |
Build and run tests with: |
| 30 |
make |
| 31 |
|
| 32 |
Conventions: |
| 33 |
|
| 34 |
Errors: |
| 35 |
|
| 36 |
Functions return zero on success or -1 with errno set. |
| 37 |
|
| 38 |
Identifier/symbol names: |
| 39 |
|
| 40 |
All identifiers that can be seen by client code (generally things |
| 41 |
defined in include/) start with 'extract_'. |
| 42 |
|
| 43 |
Similarly global symbols in generated .o files all start with |
| 44 |
'extract_'; this is tested by target 'test-obj'. |
| 45 |
|
| 46 |
Other identifiers and symbols do not have an 'extract_' prefix - not |
| 47 |
necessary because client code cannot see these names. |
| 48 |
|
| 49 |
Header names in include/ start with 'extract_'. |
| 50 |
|
| 51 |
Allocation: |
| 52 |
|
| 53 |
Functions that free a data structure generally take a double pointer |
| 54 |
so that they can set the pointer to NULL before returning, which helps |
| 55 |
avoid stray invalid non-NULL pointers. E.g.: |
| 56 |
|
| 57 |
extract_span_free(extract_alloc_t* alloc, span_t** pspan); |
| 58 |
/* Frees a span_t, returning with *pspan set to NULL. */ |
| 59 |
|
| 60 |
This double-pointer approach is also used for raw allocation - see |
| 61 |
include/extract_alloc.h. |
| 62 |
|
| 63 |
Lists: |
| 64 |
Lists of data items are generally implemented using an array of |
| 65 |
pointers and an int 'foo_num' entry, e.g.: |
| 66 |
|
| 67 |
line_t** lines; |
| 68 |
int lines_num; |
| 69 |
|