Index: ossp-pkg/val/val.pod RCS File: /v/ossp/cvs/ossp-pkg/val/val.pod,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/val/val.pod,v' 2>/dev/null --- val.pod 2002/01/16 20:47:56 1.4 +++ val.pod 2002/01/17 09:22:18 1.5 @@ -83,19 +83,34 @@ It allows one to access C variables through name strings, although the C language does neither provide such a dedicated facility nor an evaluation construct (which could be used to implement such a facility -easily). In general, it is interesting whenevery you need access to C +easily). In general, it is interesting whenever you need access to C variable symbols without having to know the actual address/reference. The typical use cases are in combination with flexible configuration parsing and supporting loosly-coupled DSO-based module architectures. +=head1 STRUCTURED NAMES + +Whenever the APIs calls for a name it supports structured names where elements +are separated by a dot. It is assumed that the leading elements are references +to other C structures and only the very last element is a reference to +an actual variable. + =head1 API CONSTANTS =over 4 =item C +The maximum length of a variable name. For structured variables this includes +the concatenation of all elements within a path and their separating dots. + =item CI +Type of value when registering a variable using B() or querying for +the type using B(). Most are self-explanatory, C is +used to mount a C structure into an existing C structure to +support structured names. + C, C, C, @@ -107,6 +122,12 @@ =item C, CI +Return codes for every API function. Signals success, invalid argument passed +to function, bad usage of a function, memoryusage reached C +limit, error in internal hash function to be examined through C, +internal error in storage as result from structure corruption, or system +errors including out of memory. + C, C, C, @@ -122,10 +143,18 @@ =item C +Handle created by B() and passed to all other functions to reference +the the same group of variables. + =item C +Callback to be used B(). + =item C +Code returned by every function. See C C and +CI. + =back =head1 API FUNCTIONS @@ -134,22 +163,69 @@ =item val_rc_t B(val_t **I); +Creates an I and updates the given pointer to reference it. + =item val_rc_t B(val_t *I); +Destroys an I, freeing up memory. + =item val_rc_t B(val_t *I, const char *I, int I, const char *I, void *I); +Registers a variable I using I in I. An optional description +or NULL can be passed through I which can be queried through +B() and is also passed to the callback of B(). The value +that belongs to the given I is expected to be found at I. +Passing NULL as I will create an inline data store in I so it +can only be access through B(), B() or after the actual +storage address was queried using B(). + =item val_rc_t B(val_t *I, const char *I, int *I, char **I, void **I); +Queries a variable I in I and returns it's type, description and +storage address. All of I, I and I are optional and +NULL can be passed in if this information is not needed. Passing NULL to all +query result pointers just checks for existence of I. + =item val_rc_t B(val_t *I, const char *I, ...); +Sets the value of variable I in I to the data passed in as vararg. +Unless the actual storage address was queried using B() this is +mandatory for inline data. Usually not the value but a pointer to it is stored +to the value can be modified without notice to the library. + =item val_rc_t B(val_t *I, const char *I, ...); +Gets the value of variable I in I and stores it whereever the +passed vararg points to. + =item val_rc_t B(val_t *I, const char *I, va_list I); +Like B() but takes a C as input to allow recursive +execution. Acutally, B() ist just a wrapper around +B(). + =item val_rc_t B(val_t *I, const char *I, va_list I); +Like B() but takes a C as input to allow recursive +execution. Acutally, B() ist just a wrapper around +B(). + =item val_rc_t B(val_t *I, const char *I, int I, val_cb_t I, void *I); +Iterates through all elements of I, starting with I which can be +either a data store or I reference, down to a given recursion I. +When I is set to the empty string the search starts immediately at +I. For every element, the callback I() is executed and a context +I is passed to it along with other information described below. + +=item val_rc_t (*)(void *I, const char *I, int I, const char *I, void *I) + +Callback executed by B() for each element being processed. The +context I input to B() is passed to the callback verbatim. The +I is the structured name relative to the I passed to +B(), I signals the type of value I points to and +I is a text which was optionally passed to B(). + =back =head1 SEE ALSO