Collaboration diagram for Structure Parse/Print/read/write:
![]() |
Files | |
file | parse.c |
routines for parsing arbitrary structures | |
Data Structures | |
struct | bu_structparse |
struct | bu_external |
Defines | |
#define | bu_offsetofarray(_t, _m) (int)( (((_t *)0)->_m)) |
#define | bu_offsetof(_t, _m) (int)(&(((_t *)0)->_m)) |
#define | bu_byteoffset(_i) ((int)(((char *)&(_i))-((char *)0))) |
#define | BU_STRUCTPARSE_FUNC_NULL ((void (*)())0) |
#define | BU_EXTERNAL_MAGIC 0x768dbbd0 |
#define | BU_INIT_EXTERNAL(_p) |
#define | BU_CK_EXTERNAL(_p) BU_CKMAG(_p, BU_EXTERNAL_MAGIC, "bu_external") |
#define | CKMEM(_len) |
#define | BU_GETPUT_MAGIC_1 0x15cb |
#define | BU_GETPUT_MAGIC_2 0xbc51 |
#define | BU_INIT_GETPUT_1(_p) |
#define | BU_INIT_GETPUT_2(_p, _l) |
#define | BU_CK_GETPUT(_p) |
#define | STATE_UNKNOWN 0 |
#define | STATE_IN_KEYWORD 1 |
#define | STATE_IN_VALUE 2 |
#define | STATE_IN_QUOTED_VALUE 3 |
Functions | |
int | bu_struct_export (struct bu_external *ext, const genptr_t base, const struct bu_structparse *imp) |
int | bu_struct_import (genptr_t base, const struct bu_structparse *imp, const struct bu_external *ext) |
int | bu_struct_put (FILE *fp, const struct bu_external *ext) |
int | bu_struct_get (struct bu_external *ext, FILE *fp) |
void | bu_struct_wrap_buf (struct bu_external *ext, genptr_t buf) |
int | bu_struct_parse (const struct bu_vls *in_vls, const struct bu_structparse *desc, const char *base) |
void | bu_struct_print (const char *title, const struct bu_structparse *parsetab, const char *base) |
void | bu_vls_struct_print (struct bu_vls *vls, const struct bu_structparse *sdp, const char *base) |
void | bu_vls_struct_print2 (struct bu_vls *vls, const char *title, const struct bu_structparse *sdp, const char *base) |
void | bu_vls_struct_item (struct bu_vls *vp, const struct bu_structparse *sdp, const char *base, int sep_char) |
int | bu_vls_struct_item_named (struct bu_vls *vp, const struct bu_structparse *sdp, const char *name, const char *base, int sep_char) |
void | bu_parse_mm (const struct bu_structparse *sdp, const char *name, char *base, const char *value) |
int | bu_key_eq_to_key_val (char *in, char **next, struct bu_vls *vls) |
int | bu_shader_to_tcl_list (char *in, struct bu_vls *vls) |
int | bu_key_val_to_key_eq (char *in) |
int | bu_shader_to_key_eq (char *in, struct bu_vls *vls) |
int | bu_fwrite_external (FILE *fp, const struct bu_external *ep) |
void | bu_hexdump_external (FILE *fp, const struct bu_external *ep, const char *str) |
void | bu_free_external (struct bu_external *ep) |
void | bu_copy_external (struct bu_external *op, const struct bu_external *ip) |
char * | bu_next_token (char *str) |
HIDDEN int | bu_parse_double (const char *str, long int count, double *loc) |
HIDDEN int | bu_struct_lookup (register const struct bu_structparse *sdp, register const char *name, const char *base, const char *const value) |
HIDDEN void | bu_matprint (const char *name, register const double *mat) |
HIDDEN void | bu_vls_matprint (struct bu_vls *vls, const char *name, register const double *mat) |
HIDDEN void | bu_vls_print_double (struct bu_vls *vls, const char *name, register long int count, register const double *dp) |
void | bu_vls_struct_print (struct bu_vls *vls, register const struct bu_structparse *sdp, const char *base) |
void | bu_parse_mm (register const struct bu_structparse *sdp, register const char *name, char *base, const char *value) |
char * | bu_list_elem (const char *in, int index) |
int | bu_tcl_list_length (const char *in) |
int | bu_key_val_to_vls (struct bu_vls *vls, char *params) |
void | bu_free_external (register struct bu_external *ep) |
|
b u _ o f f s e t o f b u _ o f f s e t o f a r r a y The general problem of word-addressed hardware where (int *) and (char *) have different representations is handled in the parsing routines that use sp_offset, because of the limitations placed on compile-time initializers. Files using bu_offsetof or bu_offsetofarray will need to include stddef.h |
|
|
|
b u _ b y t e o f f s e t Convert address of global data object into byte "offset" from address 0. Strictly speaking, the C language only permits initializers of the form: address +- constant, where here the intent is to measure the byte address of the indicated variable. Matching compensation code for the CRAY is located in librt/parse.c |
|
|
|
Definition at line 1441 of file bu.h. Referenced by bu_identify_magic(), and db5_export_object3(). |
|
Value: {(_p)->ext_magic = BU_EXTERNAL_MAGIC; \ (_p)->ext_buf = (genptr_t)NULL; (_p)->ext_nbytes = 0;} Definition at line 1442 of file bu.h. Referenced by bu_copy_external(), bu_struct_export(), bu_struct_get(), bu_struct_wrap_buf(), db5_export_attributes(), db5_get_attributes(), db5_get_raw_internal_fp(), db5_get_raw_internal_ptr(), db5_replace_attributes(), db5_update_attributes(), db5_write_free(), db_dirbuild(), db_get_external(), db_wrap_v5_external(), nmg_stash_model_to_file(), rt_binunif_export5(), rt_comb_export4(), rt_comb_export5(), rt_db_cvt_to_external5(), rt_db_get_internal(), rt_db_get_internal5(), rt_db_put_internal(), rt_fwrite_internal(), rt_generic_xform(), rt_nurb_export5(), and wdb_put_internal(). |
|
|
Value: { \ register int offset; \ if( (offset = (ep - cp) - (_len)) < 0 ) { \ do { \ offset += ext->ext_nbytes; /* decr by new growth */ \ ext->ext_nbytes <<= 1; \ } while( offset < 0 ); \ offset = cp - (char *)ext->ext_buf; \ ext->ext_buf = (genptr_t)bu_realloc( (char *) ext->ext_buf, \ ext->ext_nbytes, "bu_struct_export" ); \ ep = (char *) ext->ext_buf + ext->ext_nbytes; \ cp = (char *) ext->ext_buf + offset; \ } } Definition at line 74 of file parse.c. Referenced by bu_struct_export(). |
|
Definition at line 88 of file parse.c. Referenced by bu_struct_get(), and bu_struct_wrap_buf(). |
|
Definition at line 89 of file parse.c. Referenced by bu_struct_get(), and bu_struct_wrap_buf(). |
|
Value: { \ BU_CK_EXTERNAL(_p); \ ((unsigned char *) _p->ext_buf)[1] = (BU_GETPUT_MAGIC_1 & 0xFF); \ ((unsigned char *) _p->ext_buf)[0] = (BU_GETPUT_MAGIC_1 >> 8) & 0xFF; \ } Definition at line 90 of file parse.c. Referenced by bu_struct_export(). |
|
Value: {\ BU_CK_EXTERNAL(_p); \ ((unsigned char *) _p->ext_buf)[_l-1] = (BU_GETPUT_MAGIC_2 & 0xFF); \ ((unsigned char *) _p->ext_buf)[_l-2] = (BU_GETPUT_MAGIC_2 >> 8) & 0xFF; \ } Definition at line 95 of file parse.c. Referenced by bu_struct_export(). |
|
Definition at line 101 of file parse.c. Referenced by bu_struct_import(), and bu_struct_put(). |
|
|
|
Definition at line 1566 of file parse.c. Referenced by bu_key_eq_to_key_val(). |
|
Definition at line 1567 of file parse.c. Referenced by bu_key_eq_to_key_val(). |
|
Definition at line 1568 of file parse.c. Referenced by bu_key_eq_to_key_val(). |
|
B U _ S T R U C T _ E X P O R T Definition at line 147 of file parse.c. References bcopy, bu_free(), BU_INIT_EXTERNAL, BU_INIT_GETPUT_1, BU_INIT_GETPUT_2, bu_malloc(), CKMEM, bu_external::ext_buf, bu_external::ext_nbytes, htond(), int, bu_structparse::sp_count, bu_structparse::sp_fmt, and bu_structparse::sp_offset. Here is the call graph for this function: ![]() |
|
B U _ S T R U C T _ I M P O R T Definition at line 299 of file parse.c. References bcopy, BU_CK_GETPUT, bu_external::ext_buf, int, ntohd(), NULL, bu_structparse::sp_count, bu_structparse::sp_fmt, bu_structparse::sp_hook, bu_structparse::sp_name, and bu_structparse::sp_offset. Here is the call graph for this function: ![]() |
|
B U _ S T R U C T _ P U T Put a structure in external form to a stdio file. All formatting must have been accomplished previously. Definition at line 435 of file parse.c. References BU_CK_GETPUT, bu_external::ext_buf, and bu_external::ext_nbytes. |
|
B U _ S T R U C T _ G E T Obtain the next structure in external form from a stdio file. Definition at line 448 of file parse.c. References bu_bomb(), BU_GETPUT_MAGIC_1, BU_GETPUT_MAGIC_2, bu_identify_magic(), BU_INIT_EXTERNAL, bu_log(), bu_malloc(), bu_realloc(), BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), bu_external::ext_buf, and bu_external::ext_nbytes. Here is the call graph for this function: ![]() |
|
B U _ S T R U C T _ B U F Given a buffer with an external representation of a structure (e.g. the ext_buf portion of the output from bu_struct_export), check it for damage in shipment, and if it's OK, wrap it up in an bu_external structure, suitable for passing to bu_struct_import(). Definition at line 509 of file parse.c. References bu_bomb(), BU_GETPUT_MAGIC_1, BU_GETPUT_MAGIC_2, bu_identify_magic(), BU_INIT_EXTERNAL, bu_log(), bu_external::ext_buf, and bu_external::ext_nbytes. Here is the call graph for this function: ![]() |
|
B U _ S T R U C T P A R S E Parse the structure element description in the vls string "vls" according to the structure description in "parsetab"
Definition at line 795 of file parse.c. References BU_CK_VLS, bu_log(), bu_struct_lookup(), bu_struct_print(), bu_vls_addr(), bu_vls_free(), bu_vls_init(), bu_vls_vlscat(), name, NULL, and value. Referenced by rt_dsp_import(), rt_ebm_import(), rt_ebm_import5(), rt_hf_import(), rt_submodel_import(), rt_submodel_import5(), rt_vol_import(), and rt_vol_import5(). Here is the call graph for this function: ![]() |
|
B U _ S T R U C T P R I N T Definition at line 1056 of file parse.c. References bu_log(), NULL, bu_structparse::sp_count, bu_structparse::sp_fmt, bu_structparse::sp_name, and bu_structparse::sp_offset. Referenced by bu_struct_parse(), rt_ebm_import(), rt_ebm_import5(), rt_vol_import(), and rt_vol_import5(). Here is the call graph for this function: ![]() |
|
|
B U _ V L S _ S T R U C T P R I N T 2 This differs from bu_struct_print in that it prints to a vls. Definition at line 1405 of file parse.c. References bu_vls_printf(), bu_structparse::sp_count, bu_structparse::sp_fmt, bu_structparse::sp_name, and bu_structparse::sp_offset. Here is the call graph for this function: ![]() |
|
Convert a structure element (indicated by sdp) to its ASCII representation in a VLS Definition at line 951 of file parse.c. References bu_log(), bu_vls_printf(), bu_vls_vlscat(), NULL, bu_structparse::sp_count, bu_structparse::sp_fmt, bu_structparse::sp_name, and bu_structparse::sp_offset. Referenced by bu_vls_struct_item_named(), rt_dsp_tclget(), and rt_parsetab_tclget(). Here is the call graph for this function: ![]() |
|
B U _ V L S _ S T R U C T _ I T E M _ N A M E D Convert a structure element called "name" to an ASCII representation in a VLS. Definition at line 1038 of file parse.c. References bu_vls_struct_item(), NULL, and bu_structparse::sp_name. Referenced by rt_dsp_tclget(), and rt_parsetab_tclget(). Here is the call graph for this function: ![]() |
|
|
|
Definition at line 1574 of file parse.c. References BU_CK_VLS, bu_vls_putc(), bu_vls_strcat(), bu_vls_strncat(), start, state, STATE_IN_KEYWORD, STATE_IN_QUOTED_VALUE, and STATE_IN_VALUE. Referenced by bu_shader_to_tcl_list(), and bu_tcl_key_eq_to_key_val(). Here is the call graph for this function: ![]() |
|
B U _ S H A D E R _ T O _ T C L _ L I S T Take an old v4 shader specification of the form shadername arg1=value1 arg2=value2 color=1/2/3 and convert it into the v5 Tcl-list form shadername {arg1 value1 arg2 value2 color 1/2/3} Note -- the input string is smashed with nulls. Note -- the v5 version is used everywhere internally, and in v5 databases.
Definition at line 1708 of file parse.c. References BU_CK_VLS, bu_key_eq_to_key_val(), bu_vls_putc(), bu_vls_strcat(), bu_vls_strlen(), bu_vls_strncat(), and bu_vls_trunc(). Referenced by bu_tcl_shader_to_key_val(). Here is the call graph for this function: ![]() |
|
|
|
B U _ S H A D E R _ T O _ K E Y _ E Q Definition at line 2037 of file parse.c. References BU_CK_VLS, bu_free(), bu_list_elem(), bu_log(), bu_tcl_list_length(), bu_vls_putc(), bu_vls_strcat(), bu_vls_strlen(), and params. Referenced by bu_tcl_shader_to_key_eq(), db_apply_state_from_comb(), and rt_comb_export4(). Here is the call graph for this function: ![]() |
|
B U _ F W R I T E _ E X T E R N A L Take a block of memory, and write it into a file. Caller is responsible for freeing memory of external representation, using bu_free_external().
Definition at line 2134 of file parse.c. References BU_CK_EXTERNAL, bu_log(), bu_external::ext_buf, bu_external::ext_nbytes, and perror(). Referenced by db5_fwrite_ident(), and db_fwrite_external(). Here is the call graph for this function: ![]() |
|
B U _ H E X D U M P _ E X T E R N A L Definition at line 2152 of file parse.c. References BU_CK_EXTERNAL, bu_external::ext_buf, and bu_external::ext_nbytes. |
|
|
B U _ C O P Y _ E X T E R N A L Definition at line 2208 of file parse.c. References bcopy, BU_CK_EXTERNAL, BU_INIT_EXTERNAL, bu_malloc(), bu_external::ext_buf, and bu_external::ext_nbytes. Here is the call graph for this function: ![]() |
|
B U _ N E X T _ T O K E N Advance pointer through string over current token, across white space, to beginning of next token. Definition at line 2227 of file parse.c. Referenced by rt_pipe_tcladjust(). |
|
B U _ P A R S E _ D O U B L E Parse an array of one or more doubles. Return value: 0 when successful <0 upon failure |
|
B U _ S T R U C T _ L O O K U P
Definition at line 621 of file parse.c. Referenced by bu_struct_lookup(), bu_struct_parse(), and bu_structparse(). |
|
B U _ M A T P R I N T XXX Should this be here, or could it be with the matrix support? pretty-print a matrix Definition at line 892 of file parse.c. References bu_log(), and bu_log_indent_delta(). Here is the call graph for this function: ![]() |
|
Definition at line 918 of file parse.c. References bu_log_indent_delta(), bu_log_indent_vls(), and bu_vls_printf(). Here is the call graph for this function: ![]() |
|
B U _ V L S _ P R I N T _ D O U B L E Definition at line 1200 of file parse.c. References bu_vls_extend(), bu_vls::vls_len, bu_vls::vls_offset, and bu_vls::vls_str. Here is the call graph for this function: ![]() |
|
B U _ V L S _ S T R U C T P R I N T This differs from bu_struct_print in that this output is less readable by humans, but easier to parse with the computer. Definition at line 1227 of file parse.c. References BU_CK_VLS, bu_log(), bu_vls_free(), bu_vls_init(), bu_vls_struct_print(), bu_vls_vlscat(), and NULL. Here is the call graph for this function: ![]() |
|
This allows us to specify the "size" parameter as values like ".5m" or "27in" rather than using mm all the time. Definition at line 1553 of file parse.c. References bu_mm_value(). Here is the call graph for this function: ![]() |
|
B U _ L I S T _ E L E M Given a Tcl list, return a copy of the 'index'th entry, which may itself be a list. Note -- the caller is responsible for freeing the returned string. Definition at line 1826 of file parse.c. References bu_log(), bu_malloc(), ptr, and start. Referenced by bu_key_val_to_vls(), and bu_shader_to_key_eq(). Here is the call graph for this function: ![]() |
|
B U _ T C L _ L I S T _ L E N G T H Return number of items in a string, interpreted as a Tcl list. Definition at line 1930 of file parse.c. References ptr. Referenced by bu_key_val_to_vls(), and bu_shader_to_key_eq(). |
|
Definition at line 1986 of file parse.c. References bu_free(), bu_list_elem(), bu_log(), bu_tcl_list_length(), bu_vls_putc(), bu_vls_strcat(), and value. Here is the call graph for this function: ![]() |
|
B U _ F R E E _ E X T E R N A L Definition at line 2195 of file parse.c. References BU_CK_EXTERNAL, bu_free(), and GENPTR_NULL. Here is the call graph for this function: ![]() |