libbu (utility functions)

Collaboration diagram for libbu (utility functions):


Files

file  bu.h
 Header file for the BRL-CAD Utility Library, LIBBU.
file  cmd.h
 Command history data structures.

Modules

 Attribute/Value Sets
 Bit Vectors
 Color
 Debugging
 Endian Support
 getopt
 Hashing
 Histogram Support
 Linked Lists
 Mapped Files
 Memory
 Magic Numbers
 Multiply Represented Objects
 Parallel processing, semaphores
 Pointer Tables
 File I/O
 RedBlack trees
 Structure Parse/Print/read/write
 Tcl
 Variable Length Strings
 vector fonts
 Data Conversion

Data Structures

struct  bu_cmdhist
struct  bu_cmdhist_obj

Defines

#define BU_H_VERSION   "@(#)$Header: /cvsroot/brlcad/brlcad/include/bu.h,v 14.38 2006/09/18 05:24:07 lbutler Exp $ (BRL)"
#define BU_DIR_SEPARATOR   '/'
#define MAXPATHLEN   1024
#define BU_PATH_SEPARATOR   ':'
#define BU_FLSTR   __FILE__ ":" bu_cpp_xstr(__LINE__)
#define bu_cpp_str(s)   # s
#define bu_cpp_xstr(s)   bu_cpp_str(s)
#define bu_cpp_glue(a, b)   a ## b
#define bu_cpp_xglue(a, b)   bu_cpp_glue(a, b)
#define BU_QFLSTR   bu_cpp_xstr(__FILE__ line __LINE__)
#define BU_EXTERN(type_and_name, args)   extern type_and_name()
#define BU_ARGS(args)   ()
#define BU_FORTRAN(lc, uc)   lc
#define BU_GETSTRUCT(_p, _str)   _p = (struct _str *)bu_calloc(1,sizeof(struct _str), "_str (getstruct)" )
#define BU_GETUNION(_p, _unn)   _p = (union _unn *)bu_calloc(1,sizeof(union _unn), "_unn (getunion)" )
#define BU_GETTYPE(_p, _type)   _p = (_type *)bu_calloc(1,sizeof(_type), "_type (getstruct)")
#define BU_CKMAG(_ptr, _magic, _str)
#define BU_CKMAG_TCL(_interp, _ptr, _magic, _str)
#define BU_ASSERT(_equation)
#define BU_ASSERT_PTR(_lhs, _relation, _rhs)
#define BU_ASSERT_LONG(_lhs, _relation, _rhs)
#define BU_ASSERT_DOUBLE(_lhs, _relation, _rhs)
#define MAXARGS   9000
#define CMD_NULL   (int (*)())NULL
#define CMDHIST_NULL   (struct bu_cmdhist *)NULL
#define CMDHIST_OBJ_NULL   (struct bu_cmdhist_obj *)NULL

Functions

int bu_cmd ()
void bu_register_cmds ()
int bu_cmdhist_history ()
int bu_cmdhist_add ()
int bu_cmdhist_curr ()
int bu_cmdhist_next ()
int bu_cmdhist_prev ()
int cho_open_tcl ()

Define Documentation

#define BU_H_VERSION   "@(#)$Header: /cvsroot/brlcad/brlcad/include/bu.h,v 14.38 2006/09/18 05:24:07 lbutler Exp $ (BRL)"
 

Definition at line 87 of file bu.h.

#define BU_DIR_SEPARATOR   '/'
 

define BU_DIR_SEPARATOR to the directory separator character

Definition at line 102 of file bu.h.

Referenced by bu_brlcad_root().

#define MAXPATHLEN   1024
 

Maximum length of a filesystem path. Typically defined in a system file but if it isn't set, we create it.

Definition at line 112 of file bu.h.

Referenced by bu_fopen_uniq().

#define BU_PATH_SEPARATOR   ':'
 

set to the path list separator character

Definition at line 124 of file bu.h.

Referenced by bu_whereis(), and bu_which().

#define BU_FLSTR   __FILE__ ":" bu_cpp_xstr(__LINE__)
 

Macro for getting a concatenated string of the current file and line number. Produces something of the form: "filename.c"":""1234"

Definition at line 139 of file bu.h.

Referenced by db_get_directory(), rt_memclose(), and rt_memfree().

#define bu_cpp_str  )     # s
 

Definition at line 135 of file bu.h.

#define bu_cpp_xstr  )     bu_cpp_str(s)
 

Definition at line 136 of file bu.h.

#define bu_cpp_glue a,
 )     a ## b
 

Definition at line 137 of file bu.h.

#define bu_cpp_xglue a,
 )     bu_cpp_glue(a, b)
 

Definition at line 138 of file bu.h.

#define BU_QFLSTR   bu_cpp_xstr(__FILE__ line __LINE__)
 

Definition at line 140 of file bu.h.

#define BU_EXTERN type_and_name,
args   )     extern type_and_name()
 

Definition at line 153 of file bu.h.

#define BU_ARGS args   )     ()
 

Definition at line 154 of file bu.h.

#define BU_FORTRAN lc,
uc   )     lc
 

B U _ F O R T R A N

This macro is used to take the 'C' function name, and convert it at compile time to the FORTRAN calling convention used for this particular system.

Both lower-case and upper-case alternatives have to be provided because there is no way to get the C preprocessor to change the case of a token.

Definition at line 181 of file bu.h.

#define BU_GETSTRUCT _p,
_str   )     _p = (struct _str *)bu_calloc(1,sizeof(struct _str), "_str (getstruct)" )
 

Handy memory allocator macro

Allocate storage for a structure

Definition at line 200 of file bu.h.

Referenced by add_solid(), bend_pipe_shot(), bn_vlblock_init(), bu_add_hook(), bu_avs_new(), bu_list_new(), bu_log_add_hook(), bu_open_mapped_file(), classify_seg(), db_dup_combined_tree_state(), db_new_combined_tree_state(), db_open(), db_open_inmem(), db_parse_1anim(), dgo_E_cmd(), dgo_open_cmd(), linear_pipe_shot(), nmg_mm(), nmg_radial_build_list(), pipe_end_shot(), pipe_start_shot(), rt_ars_prep(), rt_bot_xform(), rt_cline_prep(), rt_color_addrec(), rt_comb_import5(), rt_dsp_prep(), rt_ebm_prep(), rt_ehy_prep(), rt_ell_prep(), rt_epa_prep(), rt_eto_prep(), rt_extrude_prep(), rt_find_identical_solid(), rt_gettree_region_end(), rt_grp_prep(), rt_hf_prep(), rt_hf_to_dsp(), rt_hlf_prep(), rt_metaball_import5(), rt_new_rti(), rt_nmg_prep(), rt_nurb_prep(), rt_part_prep(), rt_pgface(), rt_pipe_import(), rt_pipe_import5(), rt_rec_prep(), rt_rhc_prep(), rt_rpc_prep(), rt_shootray(), rt_shootray_bundle(), rt_sph_prep(), rt_submodel_prep(), rt_submodel_shot(), rt_superell_prep(), rt_tgc_prep(), rt_tor_prep(), rt_vol_prep(), shoot_and_plot(), vo_open_cmd(), wdb_color_cmd(), wdb_combadd(), wdb_dbopen(), wdb_get_obj_bounds2(), wdb_nmg_simplify_cmd(), wdb_push_cmd(), wdb_rt_gettrees_cmd(), wdb_which_cmd(), and XGLUE().

#define BU_GETUNION _p,
_unn   )     _p = (union _unn *)bu_calloc(1,sizeof(union _unn), "_unn (getunion)" )
 

Allocate storage for a union

Definition at line 202 of file bu.h.

Referenced by add_solid(), build_etree(), and rt_cut_it().

#define BU_GETTYPE _p,
_type   )     _p = (_type *)bu_calloc(1,sizeof(_type), "_type (getstruct)")
 

B U _ G E T T Y P E

Acquire storage for a given TYPE, eg, BU_GETTYPE(ptr, typename); Equivalent to BU_GETSTRUCT, except without the 'struct' Useful for typedef'ed objects.

Definition at line 218 of file bu.h.

#define BU_CKMAG _ptr,
_magic,
_str   ) 
 

Value:

if( !(_ptr) || ( ((long)(_ptr)) & (sizeof(long)-1) ) || \
            *((unsigned long *)(_ptr)) != (unsigned long)(_magic) )  { \
                bu_badmagic( (long *)(_ptr), (unsigned long)_magic, _str, __FILE__, __LINE__ ); \
        }

Definition at line 235 of file bu.h.

Referenced by _rb_neighbor(), _rb_rot_left(), _rb_rot_right(), _rb_walk(), bu_rb_curr(), bu_rb_delete(), bu_rb_diagnose_tree(), bu_rb_extreme(), bu_rb_free(), bu_rb_free_node(), bu_rb_free_package(), bu_rb_insert(), bu_rb_is_uniq(), bu_rb_neighbor(), bu_rb_rank(), bu_rb_search(), bu_rb_select(), bu_rb_set_uniqv(), bu_rb_summarize_tree(), bu_rb_walk(), bu_semaphore_acquire(), and bu_semaphore_release().

#define BU_CKMAG_TCL _interp,
_ptr,
_magic,
_str   ) 
 

Value:

if( !(_ptr) || ( ((long)(_ptr)) & (sizeof(long)-1) ) || \
             *((long *)(_ptr)) != (_magic) )  { \
                bu_badmagic_tcl( (_interp), (long *)(_ptr), (unsigned long)_magic, _str, __FILE__, __LINE__ ); \
                return TCL_ERROR; \
        }

Definition at line 240 of file bu.h.

#define BU_ASSERT _equation   ) 
 

Value:

if( !(_equation) )  { \
                bu_log("BU_ASSERT( _equation ) failed, file %s, line %d\n", \
                        __FILE__, __LINE__ ); \
                bu_bomb("assertion failure\n"); \
        }
B U _ A S S E R T

Quick and easy macros to generate an informative error message and abort execution if the specified condition does not hold true.

Definition at line 276 of file bu.h.

Referenced by bn_tabdata_mk_linear_filter(), bu_realloc(), rt_binunif_make(), rt_ct_piececount(), rt_cut_extend(), rt_dsp_make(), rt_ebm_make(), rt_generic_make(), rt_submodel_export(), and rt_submodel_export5().

#define BU_ASSERT_PTR _lhs,
_relation,
_rhs   ) 
 

Value:

if( !((_lhs) _relation (_rhs)) )  { \
                bu_log("BU_ASSERT_PTR( _lhs _relation _rhs ) failed, lhs=x%lx, rhs=x%lx, file %s, line %d\n", \
                        (long)(_lhs), (long)(_rhs),\
                        __FILE__, __LINE__ ); \
                bu_bomb("BU_ASSERT_PTR failure\n"); \
        }
Quick and easy macros to generate an informative error message and abort execution if the specified condition does not hold true.

Definition at line 297 of file bu.h.

Referenced by bu_open_mapped_file_with_path(), db5_export_object3(), db5_import_attributes(), db_ck_tree(), db_get_directory(), db_tree_flatten_describe(), rt_cell_n_on_ray(), rt_comb_export5(), rt_init_resource(), rt_prep_parallel(), rt_shootray(), rt_shootray_bundle(), and wdb_rt_gettrees_cmd().

#define BU_ASSERT_LONG _lhs,
_relation,
_rhs   ) 
 

Value:

if( !((_lhs) _relation (_rhs)) )  { \
                bu_log("BU_ASSERT_LONG( _lhs _relation _rhs ) failed, lhs=%ld, rhs=%ld, file %s, line %d\n", \
                        (long)(_lhs), (long)(_rhs),\
                        __FILE__, __LINE__ ); \
                bu_bomb("BU_ASSERT_LONG failure\n"); \
        }
Quick and easy macros to generate an informative error message and abort execution if the specified condition does not hold true.

Definition at line 320 of file bu.h.

Referenced by db5_export_object3(), db5_get_raw_internal_fp(), db5_import_attributes(), db5_make_free_object(), db5_make_free_object_hdr(), db5_put_color_table(), db5_realloc(), db5_replace_attributes(), db5_scan(), db5_update_attributes(), db_put_external5(), db_string_to_path(), db_tree_flatten_describe(), db_update_ident(), db_wrap_v5_external(), db_zapper(), rt_arb_import5(), rt_arbn_import5(), rt_cline_import5(), rt_comb_export4(), rt_comb_export5(), rt_comb_import5(), rt_comb_v5_serialize(), rt_db_external5_to_internal5(), rt_db_get_internal5(), rt_db_put_internal5(), rt_dsp_import5(), rt_ehy_import5(), rt_ell_import5(), rt_epa_import5(), rt_eto_import5(), rt_grp_import5(), rt_hlf_import5(), rt_init_resource(), rt_part_import5(), rt_pg_to_bot(), rt_pipe_import5(), rt_rhc_import5(), rt_rpc_import5(), rt_submodel_shot(), rt_superell_import5(), rt_tgc_import5(), rt_tor_import5(), rt_xxx_import5(), and wdb_combadd().

#define BU_ASSERT_DOUBLE _lhs,
_relation,
_rhs   ) 
 

Value:

if( !((_lhs) _relation (_rhs)) )  { \
                bu_log("BU_ASSERT_DOUBLE( _lhs _relation _rhs ) failed, lhs=%lf, rhs=%lf, file %s, line %d\n", \
                        (long)(_lhs), (long)(_rhs),\
                        __FILE__, __LINE__ ); \
                bu_bomb("BU_ASSERT_DOUBLE failure\n"); \
        }
Quick and easy macros to generate an informative error message and abort execution if the specified condition does not hold true.

Example: BU_ASSERT_LONG( j+7, <, 42 );

Definition at line 343 of file bu.h.

Referenced by rt_submodel_a_hit().

#define MAXARGS   9000
 

Definition at line 38 of file cmd.h.

Referenced by dgo_rt_cmd(), dgo_rtcheck_cmd(), dgo_vnirt_cmd(), wdb_cat_cmd(), wdb_comb_cmd(), wdb_expand_cmd(), wdb_find_cmd(), wdb_group_cmd(), wdb_keep_cmd(), wdb_kill_cmd(), wdb_killall_cmd(), wdb_killtree_cmd(), wdb_list_cmd(), wdb_ls_cmd(), wdb_make_bb_cmd(), wdb_pathsum_cmd(), wdb_push_cmd(), wdb_region_cmd(), wdb_remove_cmd(), wdb_title_cmd(), wdb_tree_cmd(), and wdb_which_cmd().

#define CMD_NULL   (int (*)())NULL
 

Definition at line 39 of file cmd.h.

#define CMDHIST_NULL   (struct bu_cmdhist *)NULL
 

Definition at line 40 of file cmd.h.

#define CMDHIST_OBJ_NULL   (struct bu_cmdhist_obj *)NULL
 

Definition at line 41 of file cmd.h.

Referenced by cho_open_tcl().


Function Documentation

int bu_cmd  ) 
 

Referenced by cho_hist(), dgo_cmd(), dgo_observer_cmd(), dgo_vdraw_cmd(), vo_observer_cmd(), and wdb_observer_cmd().

void bu_register_cmds  ) 
 

Referenced by bu_tcl_setup().

int bu_cmdhist_history  ) 
 

int bu_cmdhist_add  ) 
 

int bu_cmdhist_curr  ) 
 

int bu_cmdhist_next  ) 
 

int bu_cmdhist_prev  ) 
 

int cho_open_tcl  ) 
 

Referenced by Cho_Init().


Generated on Mon Sep 18 01:25:19 2006 for BRL-CAD by  doxygen 1.4.6