Small, Fast S-Expression Library
Data Structures | Typedefs | Functions
I/O routines

Data Structures

struct  sexp_iowrap
 

Typedefs

typedef struct sexp_iowrap sexp_iowrap_t
 

Functions

sexp_iowrap_tinit_iowrap (int fd)
 
void destroy_iowrap (sexp_iowrap_t *iow)
 
sexp_tread_one_sexp (sexp_iowrap_t *iow)
 

Detailed Description

Typedef Documentation

◆ sexp_iowrap_t

typedef struct sexp_iowrap sexp_iowrap_t

This structure is a wrapper around a standard I/O file descriptor and the parsing infrastructure (continuation and a buffer) required to parse off of it. This is used so that routines can hide the loops and details required to accumulate up data read off of the file descriptor and parse expressions individually out of it.

Function Documentation

◆ destroy_iowrap()

void destroy_iowrap ( sexp_iowrap_t iow)

destroy an IO wrapper structure. The file descriptor wrapped in the wrapper will not be closed, so the caller is responsible for manually calling close on the file descriptor.

◆ init_iowrap()

sexp_iowrap_t* init_iowrap ( int  fd)

create an IO wrapper structure around a file descriptor. A NULL return value indicates some problem occurred allocating the wrapper, so the user should check the value of sexp_errno for further information.

◆ read_one_sexp()

sexp_t* read_one_sexp ( sexp_iowrap_t iow)

given and IO wrapper handle, read one s-expression off of it. this expression may be contained in a continuation, so there is no guarantee that under the covers an IO read actually is occuring. A return value of NULL can either indicate a parser error or no more data on the input IO handle. In the event that NULL is returned, the user should check to see if sexp_errno contains SEXP_ERR_IO_EMPTY (no more data) or a more problematic error.