BRL-CAD
|
#include <parse.h>
Data Fields | |
const char | sp_fmt [4] |
size_t | sp_count |
const char * | sp_name |
size_t | sp_offset |
void(* | sp_hook )(const struct bu_structparse *, const char *, void *, const char *, void *) |
const char * | sp_desc |
void * | sp_default |
The "bu_structparse" struct describes one element of a structure. Collections of these are combined to describe entire structures (or at least those portions for which parse/print/import/export support is desired.
Provides a convenient way of describing a C data structure, and reading and writing it in both human-readable ASCII and efficient binary forms.
For example:
To parse a string, call:
bu_struct_parse(vls_string, data_sp, (char *)my_values)
this will parse the vls string and assign values to the members of the structure my_values
A gross hack: To set global variables (or others for that matter) you can store the actual address of the variable in the sp_offset field and pass a null pointer as the last argument to bu_struct_parse. If you don't understand why this would work, you probably shouldn't use this technique.
void(* sp_hook) (const struct bu_structparse *, const char *, void *, const char *, void *) |