Next: Memory Allocator Construct, Up: Generic Constructs [Index]
The error reporter construct defines some (text) error reports generation mean. It describes some error reporting context, some error report introducing method, some error report constructor method and some error report completion method.
the error reporting context is some pointer passed as first argument to the error reporting methods
It is declared as:
void *data;
the method introduces the generation of a new error report. It is thus called exactly once per error report generation and it is the first one to be called per error report generation. It is not expected to perform any particular action by the error reporter construct users.
It is declared as:
int (*line)(void *, int);
It is passed the error reporting context and the error class as arguments, in this order.
The method is expected to return 0
for success, non zero for failure.
If the method reports non successful execution the error report generation is terminated.
the method adds some piece of text of some specified size to the error report for which the generation is in progress.
It is declared as:
int (*push)(void *, const char *, unsigned);
It is passed the error reporting context, the piece of text to add the error report (not a null terminated string) and the length of same piece of text to add the error report as arguments, in this order.
The method is expected to return 0
for success, non zero for failure.
If the method reports non successful execution the error report generation is terminated.
the method completes the generation of a new error report. It is thus called exactly once per error report generation and it is the last one to be called per error report generation. It is not expected to perform any particular action by the error reporter construct users.
It is declared as:
int (*post)(void *);
It is passed the error reporting context as sole argument.
The method is expected to return 0
for success, non zero for failure.
Next: Memory Allocator Construct, Up: Generic Constructs [Index]