parser_event_handlers Struct Reference

#include <sexp.h>

Data Fields

void(* start_sexpr )()
void(* end_sexpr )()
void(* characters )(const char *data, size_t len, atom_t aty)
void(* binary )(const char *data, size_t len)

Detailed Description

Some users would prefer to, instead of parsing a full string and walking a potentially huge sexp_t structure, use an XML SAX-style parser where events are triggered as certain parts of the s-expression are encountered. This structure contains a set of function pointers that are called by the parser as it hits expression start and end, and completes reading atoms and binary data. NOTE: The parser_event_handler struct that is a field in the continuation data structure is NOT freed by destroy_continuation since structs for callbacks are ALWAYS malloc'd by the user, not the library.

Field Documentation

void(* binary)(const char *data, size_t len)

The binary function pointer is called when the parser is functioning in INLINE_BINARY mode and binary data is encountered. The function must take two arguments: a pointer to the beginning of the binary data and the number of bytes of data present.

void(* characters)(const char *data, size_t len, atom_t aty)

The characters function pointer is called when an atom is completely parsed. The function must take three arguments: a pointer to the atom data, the number of elements the atom contains, and the specific type of atom that the data represents.

void(* end_sexpr)()

The end_sexpr function pointer is called when an close parenthesis is encountered ending an expression.

void(* start_sexpr)()

The start_sexpr function pointer is called when an open parenthesis is encountered starting an expression.

Generated on Thu Oct 25 01:19:37 2007 for Small, Fast S-Expression Library by  doxygen 1.4.6