Collaboration diagram for File I/O:
![]() |
Files | |
file | association.c |
file | bomb.c |
file | brlcad_path.c |
A support routine to provide the executable code with the path to where the BRL-CAD programs and libraries are installed. | |
file | bu_fgets.c |
fgets replacement function that also handles CR as an EOL marker | |
file | fopen_uniq.c |
Routine to open a unique filename. | |
file | hook.c |
BRL-CAD support library's hook utility. | |
file | lex.c |
file | linebuf.c |
A portable way of doing setlinebuf(). | |
file | log.c |
parallel safe version of fprintf for logging | |
file | mread.c |
multiple-read to fill a buffer | |
file | stat.c |
file | units.c |
file | whereis.c |
file | which.c |
Data Structures | |
struct | bu_lex_t_int |
struct | bu_lex_t_dbl |
struct | bu_lex_t_key |
struct | bu_lex_t_id |
union | bu_lex_token |
struct | bu_lex_key |
Defines | |
#define | BU_LEX_ANY 0 |
#define | BU_LEX_INT 1 |
#define | BU_LEX_DOUBLE 2 |
#define | BU_LEX_SYMBOL 3 |
#define | BU_LEX_KEYWORD 4 |
#define | BU_LEX_IDENT 5 |
#define | BU_LEX_NUMBER 6 |
#define | BU_LEX_NEED_MORE 0 |
Functions | |
void | bu_bomb (const char *str) |
Abort the program with a message. | |
char * | bu_fgets (char *s, int size, FILE *stream) |
bu_file * | bu_fopen (char *fname, char *type) |
int | bu_fclose (struct bu_file *bfp) |
int | bu_fgetc (struct bu_file *bfp) |
void | bu_printfile (struct bu_file *bfp) |
int | bu_file_exists (const char *path) |
const char * | bu_getprogname (void) |
void | bu_setprogname (const char *path) |
char * | bu_brlcad_path (const char *rhs, int fail_quietly) |
char * | bu_brlcad_root (const char *rhs, int fail_quietly) |
Locate where the BRL-CAD applications and libraries are installed. | |
char * | bu_brlcad_data (const char *rhs, int fail_quietly) |
Locate where the BRL-CAD data resources are installed. | |
FILE * | bu_fopen_uniq (const char *outfmt, const char *namefmt, int n) |
Open a file for output. Assures that the file did not previously exist. | |
void | bu_setlinebuf (FILE *fp) |
void | bu_hook_list_init (struct bu_hook_list *hlp) |
void | bu_add_hook (struct bu_hook_list *hlp, bu_hook_t func, genptr_t clientdata) |
void | bu_delete_hook (struct bu_hook_list *hlp, bu_hook_t func, genptr_t clientdata) |
void | bu_call_hook (struct bu_hook_list *hlp, genptr_t buf) |
void | bu_log_indent_delta (int delta) |
void | bu_log_indent_vls (struct bu_vls *v) |
void | bu_log_add_hook (bu_hook_t func, genptr_t clientdata) |
void | bu_log_delete_hook (bu_hook_t func, genptr_t clientdata) |
void | bu_putchar (int c) |
void | bu_log () |
void | bu_flog () |
double | bu_units_conversion (const char *str) |
const char * | bu_units_string (const double mm) |
double | bu_mm_value (const char *s) |
void | bu_mm_cvt (register const struct bu_structparse *sdp, register const char *name, char *base, const char *value) |
bu_vls * | bu_association (const char *fname, const char *value, int field_sep) |
int | bu_lex (union bu_lex_token *token, struct bu_vls *rtstr, struct bu_lex_key *keywords, struct bu_lex_key *symbols) |
long int | bu_mread (int fd, void *bufp, long int n) |
void | bu_mro_init_with_string (struct bu_mro *mrop, const char *string) |
void | bu_mro_set (struct bu_mro *mrop, const char *string) |
void | bu_mro_init (struct bu_mro *mrop) |
void | bu_mro_free (struct bu_mro *mrop) |
void | port_setlinebuf (FILE *fp) |
HIDDEN void | bu_log_call_hooks (genptr_t buf) |
HIDDEN void | bu_log_do_indent_level (struct bu_vls *new, register char *old) |
void | bu_log (char *fmt, a, b, c, d, e, f, g, h, i, j) |
void | bu_flog (FILE *fp, char *fmt, a, b, c, d, e, f, g, h, i, j) |
int | bu_whereis (char *argv[], int lim, const char *cmd) |
int | bu_which (char *argv[], int lim, const char *cmd) |
Variables | |
bu_hook_list | bu_bomb_hook_list |
int | bu_setjmp_valid = 0 |
!0 = bu_jmpbuf is valid | |
jmp_buf | bu_jmpbuf |
for BU_SETJMP() | |
bu_hook_list | bu_log_hook_list |
|
|
|
Definition at line 2640 of file bu.h. Referenced by bu_lex(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 2669 of file bu.h. Referenced by bu_lex(). |
|
|
B U _ F G E T S Reads in at most one less than size characters from stream and stores them into the buffer pointed to by s. Reading stops after an EOF, CR, LF, or a CR/LF combination. If a LF or CR is read, it is stored into the buffer. If a CR/LF is read, just a CR is stored into the buffer. A '\0' is stored after the last character in the buffer. Returns s on success, and NULL on error or when end of file occurs while no characters have been read. Definition at line 65 of file bu_fgets.c. References NULL. |
|
|
|
|
|
|
|
|
|
B U _ F I L E _ E X I S T S
Definition at line 60 of file stat.c. References bu_debug, and NULL. Referenced by bu_which(). |
|
b u _ g e t p r o g n a m e get the name of the running application if they ran bu_setprogname() first or if we know what it's supposed to be anyways. Definition at line 122 of file brlcad_path.c. References NULL. Referenced by bu_brlcad_root(). |
|
b u _ s e t p r o g n a m e Set the name of the running application. This isn't necessary on modern systems that support getprogname() and call setprogname() before main() for you, but necessary otherwise for portability. Definition at line 135 of file brlcad_path.c. References void(). Here is the call graph for this function: ![]() |
|
B U _ B R L C A D _ P A T H
Definition at line 573 of file brlcad_path.c. References bu_brlcad_root(), and bu_log(). Referenced by bu_tcl_brlcad_path(). Here is the call graph for this function: ![]() |
|
Locate where the BRL-CAD applications and libraries are installed. B U _ B R L C A D _ R O O T The BRL-CAD root is searched for in the following order of precedence by testing for the rhs existence if provided or the directory existence otherwise: BRLCAD_ROOT environment variable if set BRLCAD_ROOT compile-time path run-time path identification /usr/brlcad static path current directory
Definition at line 320 of file brlcad_path.c. References BRLCAD_ROOT, bu_debug, BU_DIR_SEPARATOR, bu_getprogname(), bu_log(), bu_vls_addr(), bu_vls_init(), bu_vls_strcat(), getenv(), and NULL. Referenced by bu_brlcad_data(), bu_brlcad_path(), and bu_tcl_brlcad_root(). Here is the call graph for this function: ![]() |
|
Locate where the BRL-CAD data resources are installed. B U _ B R L C A D _ D A T A The BRL-CAD data resources are searched for in the following order of precedence by testing for the existence of rhs if provided or the directory existence otherwise: BRLCAD_DATA environment variable if set BRLCAD_DATA compile-time path bu_brlcad_root/share/brlcad/VERSION path bu_brlcad_root path current directory A STATIC buffer is returned. It is the caller's responsibility to call bu_strdup() or make other provisions to save the returned string, before calling again. Definition at line 446 of file brlcad_path.c. References BRLCAD_DATA, BRLCAD_VERSION, bu_brlcad_root(), bu_debug, bu_log(), bu_vls_addr(), bu_vls_init(), bu_vls_strcat(), getenv(), and NULL. Referenced by bu_tcl_brlcad_data(), and vfont_get(). Here is the call graph for this function: ![]() |
|
Open a file for output. Assures that the file did not previously exist. B U _ F O P E N _ U N I Q Typical Usages: static int n = 0; FILE *fp; fp = bu_fopen_uniq("writing to %s for results", "output%d.pl", n++); ... fclose(fp); fp = bu_fopen_uniq((char *)NULL, "output%d.pl", n++); ... fclose(fp); Definition at line 79 of file fopen_uniq.c. References bu_bomb(), BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), fp, MAXPATHLEN, and NULL. Referenced by rt_dsp_norm(). Here is the call graph for this function: ![]() |
|
Definition at line 67 of file linebuf.c. References NULL, perror(), and void(). Referenced by bu_log(), and port_setlinebuf(). Here is the call graph for this function: ![]() |
|
Definition at line 56 of file hook.c. References BU_LIST_INIT, BUHOOK_NULL, bu_hook_list::clientdata, GENPTR_NULL, bu_hook_list::hookfunc, and bu_hook_list::l. Referenced by Bu_Init(). |
|
Definition at line 64 of file hook.c. References BU_GETSTRUCT, BU_LIST_APPEND, BUHOOK_LIST_MAGIC, bu_hook_list::clientdata, bu_hook_list::hookfunc, bu_hook_list::l, and bu_list::magic. Referenced by bu_log_add_hook(). |
|
Definition at line 76 of file hook.c. References bu_free(), BU_LIST_DEQUEUE, BU_LIST_FOR, BU_LIST_PLAST, bu_hook_list::clientdata, bu_hook_list::hookfunc, and bu_hook_list::l. Referenced by bu_log_delete_hook(). Here is the call graph for this function: ![]() |
|
Definition at line 91 of file hook.c. References BU_LIST_FOR, bu_hook_list::clientdata, bu_hook_list::hookfunc, and bu_hook_list::l. Referenced by bu_bomb(), bu_flog(), bu_log(), bu_log_call_hooks(), and bu_putchar(). |
|
B U _ L O G _ I N D E N T _ D E L T A Change indentation level by indicated number of characters. Call with a large negative number to cancel all indentation. Definition at line 83 of file log.c. Referenced by bu_matprint(), bu_vls_matprint(), rt_cell_n_on_ray(), rt_pr_partitions(), rt_pr_pt_vls(), rt_shootray(), rt_shootray_bundle(), and rt_submodel_print(). |
|
B U _ L O G _ I N D E N T _ V L S For multi-line vls generators, honor logindent level like bu_log() does, and prefix the proper number of spaces. Should be called at the front of each new line. Definition at line 97 of file log.c. References bu_vls_spaces(). Referenced by bu_vls_matprint(), rt_pr_hit_vls(), rt_pr_hitarray_vls(), rt_pr_partitions(), rt_pr_pt_vls(), and rt_pr_seg_vls(). Here is the call graph for this function: ![]() |
|
B U _ L O G _ A D D _ H O O K Adds a hook to the list of bu_log hooks. The top (newest) one of these will be called with its associated client data and a string to be processed. Typcially, these hook functions will display the output (possibly in an X window) or record it. XXX The hook functions are all non-PARALLEL. Definition at line 130 of file log.c. References bu_add_hook(), BU_GETSTRUCT, BU_LIST_APPEND, bu_log_hook_list, BUHOOK_LIST_MAGIC, bu_hook_list::clientdata, bu_hook_list::hookfunc, bu_hook_list::l, and bu_list::magic. Here is the call graph for this function: ![]() |
|
B U _ L O G _ D E L E T E _ H O O K Removes the hook matching the function and clientdata parameters from the hook list. Note that it is not necessarily the active (top) hook. Definition at line 157 of file log.c. References bu_delete_hook(), bu_free(), BU_LIST_DEQUEUE, BU_LIST_FOR, BU_LIST_PLAST, bu_log_hook_list, bu_hook_list::clientdata, bu_hook_list::hookfunc, and bu_hook_list::l. Here is the call graph for this function: ![]() |
|
B U _ P U T C H A R Log a single character with no flushing. Definition at line 233 of file log.c. References bu_call_hook(), BU_LIST_IS_EMPTY, bu_log_call_hooks(), bu_log_hook_list, and bu_hook_list::l. Here is the call graph for this function: ![]() |
|
|
Referenced by anim_mat_print(), and anim_mat_printf(). |
|
B U _ U N I T S _ C O N V E R S I O N Given a string representation of a unit of distance (eg, "feet"), return the multiplier which will convert that unit into millimeters. Returns - 0.0 error >0.0 success Definition at line 113 of file units.c. Referenced by bu_tcl_units_conversion(), and vo_units_cmd(). |
|
Referenced by db_fwrite_ident(), db_update_ident(), vo_units_cmd(), wdb_do_list(), and wdb_units_cmd(). |
|
B U _ M M _ V A L U E Given a string of the form "25cm" or "5.2ft" returns the corresponding distance in mm. Returns - -1 on error >0 on success Definition at line 201 of file units.c. References ptr. Referenced by bu_mm_cvt(), bu_parse_mm(), and wdb_units_cmd(). |
|
B U _ M M _ C V T Used primarily as a hooked function for bu_structparse tables to allow input of floating point values in other units. Definition at line 237 of file units.c. References bu_mm_value(). Here is the call graph for this function: ![]() |
|
B U _ A S S O C I A T I O N Look up the association for a specified value This function reads the specified file, searches for the first line of the form
<value><field_sep>... and returns the rest of the line beyond the field separator. Definition at line 68 of file association.c. References bu_log(), bu_malloc(), bu_vls_addr(), bu_vls_gets(), bu_vls_init(), bu_vls_strcpy(), bu_vls_trunc(), buffer, fp, and NULL. Here is the call graph for this function: ![]() |
|
B U _ L E X Definition at line 170 of file lex.c. References bu_bomb(), bu_free(), BU_LEX_INT, BU_LEX_NEED_MORE, bu_lex_token::t_int, bu_lex_token::type, and bu_lex_t_int::value. Here is the call graph for this function: ![]() |
|
"Multiple try" read. Read multiple times until quantity is obtained or an error occurs. This is useful for pipes. |
|
Definition at line 104 of file mro.c. References BU_MRO_INVALIDATE, BU_MRO_MAGIC, bu_vls_init(), bu_vls_strcpy(), bu_mro::magic, and bu_mro::string_rep. Referenced by rt_gettree_region_end(). Here is the call graph for this function: ![]() |
|
Definition at line 90 of file mro.c. References BU_CK_MRO, BU_MRO_INVALIDATE, bu_vls_strcpy(), bu_vls_trunc(), and bu_mro::string_rep. Here is the call graph for this function: ![]() |
|
Definition at line 65 of file mro.c. References BU_MRO_INVALIDATE, BU_MRO_MAGIC, bu_vls_init(), bu_mro::magic, and bu_mro::string_rep. Referenced by rt_load_attrs(). Here is the call graph for this function: ![]() |
|
Definition at line 77 of file mro.c. References BU_CK_MRO, BU_MRO_INVALIDATE, bu_vls_free(), and bu_mro::string_rep. Referenced by rt_clean(), rt_del_regtree(), and rt_load_attrs(). Here is the call graph for this function: ![]() |
|
deprecated call for compatibility Definition at line 57 of file linebuf.c. References bu_log(), and bu_setlinebuf(). Here is the call graph for this function: ![]() |
|
Definition at line 177 of file log.c. References bu_call_hook(), BU_LIST_FIRST, bu_log_hook_list, bu_hook_list::clientdata, bu_hook_list::hookfunc, and bu_hook_list::l. Referenced by bu_flog(), bu_log(), and bu_putchar(). Here is the call graph for this function: ![]() |
|
B U _ L O G _ D O _ I N D E N T _ L E V E L This subroutine is used to append bu_log_indent_cur_level spaces into a printf() format specifier string, after each newline character is encountered. It exists primarily for bu_shootray() to affect the indentation level of all messages at that recursion level, even if the calls to bu_log come from non-librt routines. Definition at line 211 of file log.c. References bu_vls_putc(). Referenced by bu_flog(), and bu_log(). Here is the call graph for this function: ![]() |
|
B U _ L O G Log a library event in the Standard way. Definition at line 275 of file log.c. References bu_bomb(), bu_call_hook(), BU_LIST_IS_EMPTY, bu_log_call_hooks(), bu_log_do_indent_level(), bu_log_hook_list, BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), bu_setlinebuf(), bu_vls_addr(), bu_vls_free(), bu_vls_init(), bu_vls_printf(), bu_vls_strlen(), bu_hook_list::l, and void(). Here is the call graph for this function: ![]() |
|
B U _ F L O G Log a library event in the Standard way, to a specified file. Definition at line 391 of file log.c. References bu_bomb(), bu_call_hook(), BU_LIST_IS_EMPTY, bu_log_call_hooks(), bu_log_do_indent_level(), bu_log_hook_list, BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), bu_vls_addr(), bu_vls_free(), bu_vls_init(), bu_vls_printf(), bu_vls_strlen(), and bu_hook_list::l. Here is the call graph for this function: ![]() |
|
b u _ w h e r e i s Sets argv array of path matches to the given executable cmd name returning up to lim number of occurances found. the system environment path is obtained via a sysctl call for the ``user.cs_path'' string. In the absense of sysctl, getenv will be used for the user PATH instead. It is the callers responsibility to allocate sufficient memory to the argv array itself (lim elements), memory for the array contents will be automatically allocated as needed. It is the callers responsibility to free the array contents with bu_free_array() as well as the argv array itself. Definition at line 71 of file whereis.c. References bu_bomb(), bu_calloc(), bu_log(), BU_PATH_SEPARATOR, getenv(), NULL, and perror(). Here is the call graph for this function: ![]() |
|
b u _ w h i c h Sets argv array of path matches to the given executable cmd name returning up to lim number of occurances found. the user path is obtained getenv(PATH) or in its absense, via the sysctl ``user.cs_path'' string. It is the callers responsibility to allocate sufficient memory to the argv array itself (lim elements), memory for the array contents will be automatically allocated as needed. It is the callers responsibility to free the array contents with bu_free_array() as well as the argv array itself. Definition at line 70 of file which.c. References bu_bomb(), bu_calloc(), bu_file_exists(), bu_log(), bu_malloc(), BU_PATH_SEPARATOR, getenv(), NULL, and perror(). Here is the call graph for this function: ![]() |
|
Initial value: { { BU_LIST_HEAD_MAGIC, &bu_bomb_hook_list.l, &bu_bomb_hook_list.l }, BUHOOK_NULL, GENPTR_NULL } |
|
!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(). |
|
Initial value: { { BU_LIST_HEAD_MAGIC, &bu_log_hook_list.l, &bu_log_hook_list.l }, BUHOOK_NULL, GENPTR_NULL } Definition at line 103 of file log.c. Referenced by bu_flog(), Bu_Init(), bu_log(), bu_log_add_hook(), bu_log_call_hooks(), bu_log_delete_hook(), and bu_putchar(). |