jacklicn / leptonica

Automatically exported from code.google.com/p/leptonica
0 stars 0 forks source link

RFC: allow for user supplied error handler #85

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently we have the choice between outputting errors and messages to stderr 
or not at all. This patch adds a l_setErrorHandler function which allows users 
of the library to register a custom error/message callback.

The new functionality can be disabled by defining L_NO_ERROR_CALLBACK. I don't 
know it that has any real use case besides a very slight reduction in library 
size.

PS. Is there any reason that the error reporting functions would still be built 
with NO_CONSOLE_IO defined?

PPS. Why can't I set the issue type anywhere? This should be an enhancement and 
not a defect.

Original issue reported on code.google.com by poiza...@gmail.com on 15 Oct 2013 at 12:45

Attachments:

GoogleCodeExporter commented 9 years ago
Thank you for the patch.  It looks useful.  I'll test it and get back to you.

By convention, no output ever goes to stdout.

NO_CONSOLE_IO guarantees that there is no output to stderr from info, warning 
and error messages.  For simplicity, a user-supplied error handler should 
respect this protocol.

If you erase the type label, it will give you a selection.  I changed it to 
enhancement.

Original comment by dan.bloo...@gmail.com on 15 Oct 2013 at 4:49

GoogleCodeExporter commented 9 years ago
Version without unused variables / unreachable code warnings when built with 
NO_CONSOLE_IO

Original comment by poiza...@gmail.com on 16 Oct 2013 at 11:28

Attachments:

GoogleCodeExporter commented 9 years ago
Version 1.70 is out.  You can get it at leptonica.org/download.html

We have adopted a different mechanism for messages.  Also removed all the 
error/warning/info functions in utils.c and using varargs macros.  Check it out 
and see if it has enough flexibility for your purposes.

Original comment by dan.bloo...@gmail.com on 24 Jan 2014 at 6:44