Hi Gerel,
Hey everyone,
I've just finished a draft of what should be the Error Module API:
http://www.gnupdf.org/Task7792
As always, suggestions and/or swearwords :-) are welcome.
Just two comments.
I wouldn't include __FILE__ and __LINE__ as arguments to the macro, they
can be directly included within it.
And I would use variadic macros for the PDF_DEBUG_* macros, so that
extra arguments can be passed to be printed, and not only a string.
Something like...
#define PDF_DEBUG_BASE(message, ...) do {\
fprintf(stderr, "%s:%s:%d: ", program_name, __FILE__, __LINE__); \
fprintf(stderr, message, __VA_ARGS__); \
fprintf(stderr, "\n"); \
} while(0)
So that you can call it, for example, as:
PDF_DEBUG_BASE("Testing macro '%s' '%d' '%lf'", "string", 7, 10.1);
What do you think?
-Aleksander