Declaring the actual error reported reference holder as:
struct x1f4_track_type *eport;
the error reporter definition as:
struct x1f4_track_type plain;
and its proxy as:
struct x1f4_track_type track;
the methods of the latter will defer to those of the actual error reporter,
whose address they will pick from eport.
The line method recorded by track could be written as:
static int
line(void *context)
{
int status;
struct x1f4_track_type *track_data;
track_data = *(struct x1f4_track_type **) context;
if (track_data->line) {
status = track_data->line(track_data->data);
} else {
status = 0;
}
return status;
}
The rest of the track recorded methods would be defined in a similar
fashion.
Alternatively, the x1f4_rule_eproxy function may be used to set the
method fields in track to the same effect.
See x1f4_rule_eproxy.
In the above example, the eport reference recorder is picked from the
context field of the track struct x1f4_track_type definition,
where it is set as:
track.data = &eport;
with eport set as:
eport = &plain;
The trap library object constructor will be introduced the actual error reported reference recorder like:
struct x1f4_lxtrap_type lxtrap;
...
lxtrap.reporter_set.track = &eport;