Collaboration diagram for Variable Length Strings:
![]() |
Files | |
file | vls.c |
The variable length string package. | |
Data Structures | |
struct | bu_vls |
Defines | |
#define | BU_VLS_MAGIC 0x89333bbb |
#define | BU_CK_VLS(_vp) BU_CKMAG(_vp, BU_VLS_MAGIC, "bu_vls") |
#define | BU_VLS_IS_INITIALIZED(_vp) ((_vp) && ((_vp)->vls_magic == BU_VLS_MAGIC)) |
#define | BU_SEM_SYSCALL 0 |
#define | BU_SEM_LISTS 1 |
#define | BU_SEM_BN_NOISE 2 |
#define | BU_SEM_MAPPEDFILE 3 |
#define | BU_SEM_LAST (BU_SEM_MAPPEDFILE+1) |
#define | BU_SETJUMP setjmp((bu_setjmp_valid=1,bu_jmpbuf)) |
#define | BU_UNSETJUMP (bu_setjmp_valid=0) |
Functions | |
void | bu_vls_init (struct bu_vls *vp) |
void | bu_vls_init_if_uninit (struct bu_vls *vp) |
bu_vls * | bu_vls_vlsinit () |
char * | bu_vls_addr (const struct bu_vls *vp) |
char * | bu_vls_strdup (const struct bu_vls *vp) |
char * | bu_vls_strgrab (struct bu_vls *vp) |
void | bu_vls_extend (struct bu_vls *vp, unsigned int extra) |
void | bu_vls_setlen (struct bu_vls *vp, int newlen) |
int | bu_vls_strlen (const struct bu_vls *vp) |
void | bu_vls_trunc (struct bu_vls *vp, int len) |
void | bu_vls_trunc2 (struct bu_vls *vp, int len) |
void | bu_vls_nibble (struct bu_vls *vp, int len) |
void | bu_vls_free (struct bu_vls *vp) |
void | bu_vls_vlsfree (struct bu_vls *vp) |
void | bu_vls_strcpy (struct bu_vls *vp, const char *s) |
void | bu_vls_strncpy (struct bu_vls *vp, const char *s, long n) |
void | bu_vls_strcat (struct bu_vls *vp, const char *s) |
void | bu_vls_strncat (struct bu_vls *vp, const char *s, long n) |
void | bu_vls_vlscat (struct bu_vls *dest, const struct bu_vls *src) |
void | bu_vls_vlscatzap (struct bu_vls *dest, struct bu_vls *src) |
void | bu_vls_from_argv (struct bu_vls *vp, int argc, const char *argv[]) |
int | bu_argv_from_string (char **argv, int lim, char *lp) |
void | bu_vls_fwrite (FILE *fp, const struct bu_vls *vp) |
void | bu_vls_write (int fd, const struct bu_vls *vp) |
int | bu_vls_read (struct bu_vls *vp, int fd) |
int | bu_vls_gets (struct bu_vls *vp, FILE *fp) |
void | bu_vls_putc (struct bu_vls *vp, int c) |
void | bu_vls_trimspace (struct bu_vls *vp) |
void | bu_vls_printf (struct bu_vls *vls, char *fmt,...) |
void | bu_vls_sprintf (struct bu_vls *vls, char *fmt,...) |
void | bu_vls_spaces (struct bu_vls *vp, int cnt) |
int | bu_vls_print_positions_used (const struct bu_vls *vp) |
void | bu_vls_detab (struct bu_vls *vp) |
void | bu_vls_prepend (struct bu_vls *vp, char *str) |
void | bu_vls_init (register struct bu_vls *vp) |
void | bu_vls_init_if_uninit (register struct bu_vls *vp) |
char * | bu_vls_addr (register const struct bu_vls *vp) |
void | bu_vls_extend (register struct bu_vls *vp, unsigned int extra) |
int | bu_vls_strlen (register const struct bu_vls *vp) |
void | bu_vls_trunc (register struct bu_vls *vp, int len) |
void | bu_vls_trunc2 (register struct bu_vls *vp, int len) |
void | bu_vls_nibble (register struct bu_vls *vp, int len) |
void | bu_vls_free (register struct bu_vls *vp) |
void | bu_vls_vlsfree (register struct bu_vls *vp) |
char * | bu_vls_strdup (register const struct bu_vls *vp) |
char * | bu_vls_strgrab (register struct bu_vls *vp) |
void | bu_vls_strcpy (register struct bu_vls *vp, const char *s) |
void | bu_vls_strncpy (register struct bu_vls *vp, const char *s, long int n) |
void | bu_vls_strcat (register struct bu_vls *vp, const char *s) |
void | bu_vls_strncat (register struct bu_vls *vp, const char *s, long int n) |
void | bu_vls_vlscat (register struct bu_vls *dest, register const struct bu_vls *src) |
void | bu_vls_vlscatzap (register struct bu_vls *dest, register struct bu_vls *src) |
void | bu_vls_from_argv (register struct bu_vls *vp, int argc, const char *argv[]) |
int | bu_argv_from_string (char **argv, int lim, register char *lp) |
int | bu_vls_gets (register struct bu_vls *vp, register FILE *fp) |
void | bu_vls_putc (register struct bu_vls *vp, int c) |
void | bu_vls_printf (struct bu_vls *vls, char *fmt, a, b, c, d, e, f, g, h, i, j) |
void | bu_vls_sprintf (struct bu_vls *vls, char *fmt, a, b, c, d, e, f, g, h, i, j) |
void | bu_vls_spaces (register struct bu_vls *vp, int cnt) |
Variables | |
int | bu_setjmp_valid |
!0 = bu_jmpbuf is valid | |
jmp_buf | bu_jmpbuf |
for BU_SETJMP() | |
const char | bu_vls_message [] = "bu_vls_str" |
const char | bu_strdup_message [] |
|
Definition at line 1179 of file bu.h. Referenced by bu_identify_magic(), bu_vls_init(), bu_vls_init_if_uninit(), and bu_vls_vlsfree(). |
|
|
Definition at line 1181 of file bu.h. Referenced by rt_dsp_describe(), rt_dsp_export(), rt_dsp_ifree(), rt_dsp_import(), and rt_dsp_print(). |
|
|
Definition at line 1188 of file bu.h. Referenced by bu_list_parallel_append(), bu_list_parallel_dequeue(), and db_close(). |
|
Definition at line 1189 of file bu.h. Referenced by bn_noise_init(). |
|
Definition at line 1190 of file bu.h. Referenced by bu_close_mapped_file(), bu_free_mapped_files(), and bu_open_mapped_file(). |
|
|
|
Definition at line 1199 of file bu.h. Referenced by wdb_facetize_cmd(). |
|
Definition at line 1200 of file bu.h. Referenced by wdb_facetize_cmd(). |
|
|
Referenced by bu_structparse_argv(). |
|
B U _ V L S _ V L S I N I T Allocate storage for a struct bu_vls, call bu_vls_init on it, and return the result. Allows for creation of dynamically allocated vls strings. Definition at line 129 of file vls.c. References bu_malloc(), and bu_vls_init(). Here is the call graph for this function: ![]() |
|
|
Referenced by bu_vls_strgrab(), db_apply_state_from_comb(), db_do_anim(), and rt_submodel_prep(). |
|
Referenced by db_do_anim(). |
|
|
B U _ V L S _ S E T L E N Ensure that the vls has a length of at least 'newlen', and make that the current length. Useful for subroutines that are planning on mucking with the data array themselves. Not advisable, but occasionally useful. Does not change the offset from the front of the buffer, if any. Does not initialize the value of any of the new bytes. Definition at line 207 of file vls.c. References BU_CK_VLS, bu_vls_extend(), and bu_vls::vls_len. Referenced by rt_vlist_export(). Here is the call graph for this function: ![]() |
|
|
|
Referenced by rt_ebm_describe(), and rt_vol_describe(). |
|
Referenced by bu_vls_trimspace(). |
|
|
|
|
|
Referenced by db_diradd(), rt_dsp_import5(), rt_submodel_import5(), rt_vlist_import(), rt_vol_import5(), wdb_dir_check(), and wdb_dir_check5(). |
|
|
Referenced by bu_key_eq_to_key_val(), and bu_shader_to_tcl_list(). |
|
|
Referenced by bu_vls_detab(). |
|
Referenced by db_parse_1anim(), and wdb_title_cmd(). |
|
|
|
B U _ V L S _ F W R I T E Definition at line 567 of file vls.c. References bu_bomb(), BU_CK_VLS, BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), perror(), status, bu_vls::vls_len, bu_vls::vls_offset, and bu_vls::vls_str. Referenced by bu_cmdhist_history(). Here is the call graph for this function: ![]() |
|
B U _ V L S _ W R I T E Definition at line 588 of file vls.c. References bu_bomb(), BU_CK_VLS, BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), perror(), status, 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 _ R E A D Read the remainder of a UNIX file onto the end of a vls. Returns - nread number of characters read 0 if EOF encountered immediately -1 read error Definition at line 622 of file vls.c. References bu_bomb(), BU_CK_VLS, BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), bu_vls_extend(), bu_vls::vls_len, bu_vls::vls_max, bu_vls::vls_offset, and bu_vls::vls_str. Here is the call graph for this function: ![]() |
|
Referenced by bn_table_read(), bu_association(), and rt_hf_import(). |
|
|
B U _ V L S _ T R I M S P A C E Remove leading and trailing white space from a vls string. Definition at line 719 of file vls.c. References BU_CK_VLS, bu_vls_addr(), bu_vls_nibble(), bu_vls_strlen(), and bu_vls_trunc(). Here is the call graph for this function: ![]() |
|
|
|
|
Referenced by bu_log_indent_vls(), bu_vls_detab(), db_tree_describe(), and db_tree_flatten_describe(). |
|
B U _ V L S _ P R I N T _ P O S I T I O N S _ U S E D Returns number of printed spaces used on final output line of a potentially multi-line vls. Useful for making decisions on when to line-wrap. Accounts for normal UNIX tab-expansion: 1 2 3 4 1234567890123456789012345678901234567890 x x x x 0-7 --> 8, 8-15 --> 16, 16-23 --> 24, etc. Definition at line 1118 of file vls.c. References BU_CK_VLS, bu_vls_addr(), NULL, and start. Here is the call graph for this function: ![]() |
|
B U _ V L S _ D E T A B Given a vls, return a version of that string which has had all "tab" characters converted to the appropriate number of spaces according to the UNIX tab convention. Definition at line 1147 of file vls.c. References BU_CK_VLS, bu_vls_addr(), bu_vls_extend(), bu_vls_free(), bu_vls_init(), bu_vls_putc(), bu_vls_spaces(), bu_vls_strlen(), and bu_vls_vlscatzap(). Here is the call graph for this function: ![]() |
|
B U _ V L S _ P R E P E N D Add a string to the begining of the vls. Definition at line 1184 of file vls.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 _ I N I T No storage should be allocated at this point, and bu_vls_addr() must be able to live with that. Definition at line 84 of file vls.c. References bu_bomb(), bu_log(), BU_VLS_MAGIC, and NULL. Here is the call graph for this function: ![]() |
|
B U _ V L S _ I N I T _ I F _ U N I N I T If a VLS is unitialized, initialize it. If it is already initialized, leave it alone, caller wants to append to it. Definition at line 112 of file vls.c. References bu_bomb(), bu_vls_init(), BU_VLS_MAGIC, and NULL. Here is the call graph for this function: ![]() |
|
B U _ V L S _ A D D R Return a pointer to the null-terminated string in the vls array. If no storage has been allocated yet, give back a valid string. Definition at line 146 of file vls.c. References bu_bomb(), BU_CK_VLS, bu_log(), and NULL. Here is the call graph for this function: ![]() |
|
B U _ V L S _ E X T E N D Definition at line 176 of file vls.c. References BU_CK_VLS, bu_malloc(), and bu_realloc(). Here is the call graph for this function: ![]() |
|
B U _ V L S _ S T R L E N Return length of the string, in bytes, not including the null terminator. Definition at line 221 of file vls.c. References BU_CK_VLS. |
|
B U _ V L S _ T R U N C Truncate string to at most 'len' characters. If 'len' is negative, trim off that many from the end. If 'len' is zero, don't release storage -- user is probably just going to refill it again, e.g. with bu_vls_gets(). Definition at line 237 of file vls.c. References BU_CK_VLS. |
|
B U _ V L S _ T R U N C 2 Son of bu_vls_trunc. Same as bu_vls_trunc except that it doesn't take negative len. Definition at line 254 of file vls.c. References BU_CK_VLS. |
|
B U _ V L S _ N I B B L E "Nibble" 'len' characters off the front of the string. Changes the length and offset; no data is copied. 'len' may be positive or negative. If negative, characters are un-nibbled. Definition at line 273 of file vls.c. References BU_CK_VLS, and bu_vls_trunc(). Here is the call graph for this function: ![]() |
|
B U _ V L S _ F R E E Releases the memory used for the string buffer. Definition at line 291 of file vls.c. References BU_CK_VLS, and bu_free(). Here is the call graph for this function: ![]() |
|
B U _ V L S _ V L S F R E E Releases the memory used for the string buffer and the memory for the vls structure Definition at line 309 of file vls.c. References bu_free(), bu_vls_free(), and BU_VLS_MAGIC. Here is the call graph for this function: ![]() |
|
B U _ V L S _ S T R D U P Make an "ordinary" string copy of a vls string. Storage for the regular string is acquired using malloc. The source string is not affected. Definition at line 325 of file vls.c. References bu_malloc(), bu_vls_addr(), and bu_vls_strlen(). Here is the call graph for this function: ![]() |
|
B U _ V L S _ S T R G R A B Like bu_vls_strdup(), but destructively grab the string from the source argument 'vp'. This is more efficient than bu_vls_strdup() for those instances where the source argument 'vp' is no longer needed by the caller, as it avoides a potentially long buffer copy. The source string is destroyed, as if bu_vls_free() had been called. Definition at line 348 of file vls.c. References BU_CK_VLS, bu_vls_addr(), bu_vls_free(), and bu_vls_strdup(). Here is the call graph for this function: ![]() |
|
B U _ V L S _ S T R C P Y Empty the vls string, and copy in a regular string. Definition at line 371 of file vls.c. References bcopy, BU_CK_VLS, bu_vls_extend(), and NULL. Here is the call graph for this function: ![]() |
|
B U _ V L S _ S T R N C P Y Empty the vls string, and copy in a regular string, up to N bytes long. Definition at line 396 of file vls.c. References bcopy, BU_CK_VLS, bu_vls_extend(), and NULL. Here is the call graph for this function: ![]() |
|
B U _ V L S _ S T R C A T Concatenate a new string onto the end of the existing vls string. Definition at line 421 of file vls.c. References bcopy, BU_CK_VLS, bu_vls_extend(), and NULL. Here is the call graph for this function: ![]() |
|
B U _ V L S _ S T R N C A T Concatenate a new string onto the end of the existing vls string. Definition at line 440 of file vls.c. References bcopy, BU_CK_VLS, bu_vls_extend(), and NULL. Here is the call graph for this function: ![]() |
|
B U _ V L S _ V L S C A T Concatenate a new vls string onto the end of an existing vls string. The storage of the source string is not affected. Definition at line 463 of file vls.c. References bcopy, BU_CK_VLS, and bu_vls_extend(). Here is the call graph for this function: ![]() |
|
V L S _ V L S C A T Z A P Concatenate a new vls string onto the end of an existing vls string. The storage of the source string is released (zapped). Definition at line 484 of file vls.c. References BU_CK_VLS, bu_vls_trunc(), and bu_vls_vlscat(). Here is the call graph for this function: ![]() |
|
B U _ V L S _ F R O M _ A R G V Given and argc & argv pair, convert them into a vls string of space- separated words. Definition at line 500 of file vls.c. References BU_CK_VLS, and bu_vls_strcat(). Here is the call graph for this function: ![]() |
|
B U _ A R G V _ F R O M _ S T R I N G Build argv[] array from input buffer, by splitting whitespace separated "words" into null terminated strings. The input buffer is altered by this process. The argv[] array points into the input buffer. The input buffer should not be freed until argv has been freed or passes out of scope. 'lim' indicates the number of elements in the argv[] array. Returns - 0 no words in input nwords number of words of input, now in argv[] Built from rt_split_cmd(), but without the shell escape support. |
|
B U _ V L S _ G E T S Append a newline-terminated string from the file pointed to by "fp" to the end of the vls pointed to by "vp". The newline from the file is read, but not stored into the vls. The most common error is to forget to bu_vls_trunc(vp,0) before reading the next line into the vls. Returns - >=0 the length of the resulting vls -1 on EOF where no characters were added to the vls. Definition at line 673 of file vls.c. References BU_CK_VLS, BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), bu_vls_extend(), bu_vls_putc(), and bu_vls_strlen(). Here is the call graph for this function: ![]() |
|
B U _ V L S _ P U T C Append the given character to the vls. Definition at line 704 of file vls.c. References BU_CK_VLS, and bu_vls_extend(). Here is the call graph for this function: ![]() |
|
Definition at line 1013 of file vls.c. References bu_bomb(), BU_CK_VLS, bu_log(), and bu_vls_strcat(). Here is the call graph for this function: ![]() |
|
Definition at line 1079 of file vls.c. References BU_CK_VLS, bu_vls_printf(), and bu_vls_trunc(). Here is the call graph for this function: ![]() |
|
B U _ V L S _ S P A C E S Efficiently append 'cnt' spaces to the current vls. Definition at line 1094 of file vls.c. References BU_CK_VLS, and bu_vls_extend(). Here is the call graph for this function: ![]() |
|
!0 = bu_jmpbuf is valid
Definition at line 80 of file bomb.c. Referenced by bu_bomb(). |
|
for BU_SETJMP()
Definition at line 81 of file bomb.c. Referenced by bu_bomb(). |
|
Definition at line 74 of file vls.c. Referenced by bu_prmem(). |
|
Definition at line 113 of file malloc.c. Referenced by bu_prmem(). |