BRL-CAD
Collaboration diagram for Database IO:

Modules

 Database5
 
 Database4
 
 WriteDatabase
 

Files

file  db_anim.c
 
file  db_fullpath.c
 
file  db_inmem.c
 
file  db_lookup.c
 
file  db_match.c
 
file  db_open.c
 
file  db_tree.c
 
file  db_walk.c
 
file  dir.c
 
file  ls.c
 

Data Structures

struct  db_walk_parallel_state
 

Macros

#define DEFAULT_DB_TITLE   "Untitled BRL-CAD Database"
 
#define SEEK_SET   0
 
#define DEFAULT_DB_TITLE   "Untitled BRL-CAD Database"
 
#define DB_WALK_PARALLEL_STATE_MAGIC   0x64777073 /* dwps */
 
#define DB_CK_WPS(_p)   BU_CKMAG(_p, DB_WALK_PARALLEL_STATE_MAGIC, "db_walk_parallel_state")
 

Functions

int db_add_anim (struct db_i *dbip, register struct animate *anp, int root)
 
int db_do_anim (register struct animate *anp, mat_t stack, mat_t arc, struct mater_info *materp)
 
void db_free_1anim (struct animate *anp)
 
void db_free_anim (struct db_i *dbip)
 
struct animatedb_parse_1anim (struct db_i *dbip, int argc, const char *argv[])
 
int db_parse_anim (struct db_i *dbip, int argc, const char **argv)
 
void db_write_anim (FILE *fop, struct animate *anp)
 
void db_full_path_init (struct db_full_path *pathp)
 
void db_add_node_to_full_path (struct db_full_path *pp, struct directory *dp)
 
void db_dup_full_path (struct db_full_path *newp, const struct db_full_path *oldp)
 
void db_extend_full_path (struct db_full_path *pathp, size_t incr)
 
void db_append_full_path (struct db_full_path *dest, const struct db_full_path *src)
 
void db_dup_path_tail (struct db_full_path *newp, const struct db_full_path *oldp, off_t start)
 
char * db_path_to_string (const struct db_full_path *pp)
 
void db_path_to_vls (struct bu_vls *str, const struct db_full_path *pp)
 
void db_fullpath_to_vls (struct bu_vls *vls, const struct db_full_path *full_path, const struct db_i *dbip, int fp_flags)
 
void db_pr_full_path (const char *msg, const struct db_full_path *pathp)
 
int db_string_to_path (struct db_full_path *pp, const struct db_i *dbip, const char *str)
 
int db_argv_to_path (struct db_full_path *pp, struct db_i *dbip, int argc, const char *const *argv)
 
void db_free_full_path (struct db_full_path *pp)
 
int db_identical_full_paths (const struct db_full_path *a, const struct db_full_path *b)
 
int db_full_path_subset (const struct db_full_path *a, const struct db_full_path *b, const int skip_first)
 
int db_full_path_match_top (const struct db_full_path *a, const struct db_full_path *b)
 
int db_full_path_search (const struct db_full_path *a, const struct directory *dp)
 
int cyclic_path (const struct db_full_path *fp, const char *name)
 
int db_path_to_mat (struct db_i *dbip, struct db_full_path *pathp, mat_t mat, int depth, struct resource *resp)
 
struct db_idb_open_inmem (void)
 
struct db_idb_create_inmem (void)
 
void db_inmem (struct directory *dp, struct bu_external *ext, int flags, struct db_i *dbip)
 
int db_is_directory_non_empty (const struct db_i *dbip)
 
size_t db_directory_size (const struct db_i *dbip)
 
void db_ck_directory (const struct db_i *dbip)
 
int db_dirhash (const char *str)
 
int db_dircheck (struct db_i *dbip, struct bu_vls *ret_name, int noisy, struct directory ***headp)
 
struct directorydb_lookup (const struct db_i *dbip, const char *name, int noisy)
 
struct directorydb_diradd (struct db_i *dbip, const char *name, off_t laddr, size_t len, int flags, void *ptr)
 
int db_dirdelete (struct db_i *dbip, struct directory *dp)
 
int db_rename (struct db_i *dbip, struct directory *dp, const char *newname)
 
void db_pr_dir (const struct db_i *dbip)
 
struct bu_ptbldb_lookup_by_attr (struct db_i *dbip, int dir_flags, struct bu_attribute_value_set *avs, int op)
 
int db_regexp_match_all (struct bu_vls *dest, struct db_i *dbip, const char *pattern)
 
HIDDEN void db_count_refs (struct db_i *dbip, struct rt_comb_internal *comb, union tree *comb_leaf, void *dummy1, void *dummy2, void *dummy3, void *dummy4)
 
void db_update_nref (struct db_i *dbip, struct resource *resp)
 
struct db_idb_open (const char *name, const char *mode)
 
struct db_idb_create (const char *name, int version)
 
void db_close_client (struct db_i *dbip, long int *client)
 
void db_close (register struct db_i *dbip)
 
int db_dump (struct rt_wdb *wdbp, struct db_i *dbip)
 
struct db_idb_clone_dbi (struct db_i *dbip, long int *client)
 
void db_sync (struct db_i *dbip)
 
void db_dup_db_tree_state (struct db_tree_state *otsp, const struct db_tree_state *itsp)
 
void db_free_db_tree_state (struct db_tree_state *tsp)
 
void db_init_db_tree_state (struct db_tree_state *tsp, struct db_i *dbip, struct resource *resp)
 
struct combined_tree_statedb_new_combined_tree_state (const struct db_tree_state *tsp, const struct db_full_path *pathp)
 
struct combined_tree_statedb_dup_combined_tree_state (const struct combined_tree_state *old_ctsp)
 
void db_free_combined_tree_state (struct combined_tree_state *ctsp)
 
void db_pr_tree_state (const struct db_tree_state *tsp)
 
void db_pr_combined_tree_state (const struct combined_tree_state *ctsp)
 
int db_apply_state_from_comb (struct db_tree_state *tsp, const struct db_full_path *pathp, const struct rt_comb_internal *comb)
 
int db_apply_state_from_memb (struct db_tree_state *tsp, struct db_full_path *pathp, const union tree *tp)
 
int db_apply_state_from_one_member (struct db_tree_state *tsp, struct db_full_path *pathp, const char *cp, int sofar, const union tree *tp)
 
union treedb_find_named_leaf (union tree *tp, const char *cp)
 
union treedb_find_named_leafs_parent (int *side, union tree *tp, const char *cp)
 
void db_tree_del_lhs (union tree *tp, struct resource *resp)
 
void db_tree_del_rhs (union tree *tp, struct resource *resp)
 
int db_tree_del_dbleaf (union tree **tp, const char *cp, struct resource *resp, int nflag)
 
void db_tree_mul_dbleaf (union tree *tp, const mat_t mat)
 
void db_tree_funcleaf (struct db_i *dbip, struct rt_comb_internal *comb, union tree *comb_tree, void(*leaf_func)(struct db_i *, struct rt_comb_internal *, union tree *, void *, void *, void *, void *), void *user_ptr1, void *user_ptr2, void *user_ptr3, void *user_ptr4)
 
int db_follow_path (struct db_tree_state *tsp, struct db_full_path *total_path, const struct db_full_path *new_path, int noisy, long depth)
 
int db_follow_path_for_state (struct db_tree_state *tsp, struct db_full_path *total_path, const char *orig_str, int noisy)
 
HIDDEN void _db_recurse_subtree (union tree *tp, struct db_tree_state *msp, struct db_full_path *pathp, struct combined_tree_state **region_start_statepp, void *client_data)
 
union treedb_recurse (struct db_tree_state *tsp, struct db_full_path *pathp, struct combined_tree_state **region_start_statepp, void *client_data)
 
union treedb_dup_subtree (const union tree *tp, struct resource *resp)
 
void db_ck_tree (const union tree *tp)
 
void db_free_tree (union tree *tp, struct resource *resp)
 
void db_left_hvy_node (union tree *tp)
 
void db_non_union_push (union tree *tp, struct resource *resp)
 
int db_count_tree_nodes (const union tree *tp, int count)
 
int db_is_tree_all_unions (const union tree *tp)
 
int db_count_subtree_regions (const union tree *tp)
 
int db_tally_subtree_regions (union tree *tp, union tree **reg_trees, int cur, int lim, struct resource *resp)
 
HIDDEN union tree_db_gettree_region_end (struct db_tree_state *tsp, const struct db_full_path *pathp, union tree *curtree, void *client_data)
 
HIDDEN union tree_db_gettree_leaf (struct db_tree_state *tsp, const struct db_full_path *pathp, struct rt_db_internal *ip, void *client_data)
 
HIDDEN void _db_walk_subtree (union tree *tp, struct combined_tree_state **region_start_statepp, union tree *(*leaf_func)(struct db_tree_state *, const struct db_full_path *, struct rt_db_internal *, void *), void *client_data, struct resource *resp)
 
HIDDEN void _db_walk_dispatcher (int cpu, void *arg)
 
int db_walk_tree (struct db_i *dbip, int argc, const char **argv, int ncpu, const struct db_tree_state *init_state, int(*reg_start_func)(struct db_tree_state *, const struct db_full_path *, const struct rt_comb_internal *, void *), union tree *(*reg_end_func)(struct db_tree_state *, const struct db_full_path *, union tree *, void *), union tree *(*leaf_func)(struct db_tree_state *, const struct db_full_path *, struct rt_db_internal *, void *), void *client_data)
 
void db_apply_anims (struct db_full_path *pathp, struct directory *dp, mat_t stack, mat_t arc, struct mater_info *materp)
 
int db_region_mat (mat_t m, struct db_i *dbip, const char *name, struct resource *resp)
 
int rt_shader_mat (mat_t model_to_shader, const struct rt_i *rtip, const struct region *rp, point_t p_min, point_t p_max, struct resource *resp)
 
HIDDEN int tree_list_needspace (struct bu_vls *vls)
 
HIDDEN void tree_list_sublist_begin (struct bu_vls *vls)
 
HIDDEN void tree_list_sublist_end (struct bu_vls *vls)
 
HIDDEN void tree_list_append (struct bu_vls *vls, const char *str)
 
int db_tree_list (struct bu_vls *vls, const union tree *tp)
 
union treedb_tree_parse (struct bu_vls *vls, const char *str, struct resource *resp)
 
void db_traverse_subtree (union tree *tp, void(*traverse_func)(struct directory *, struct db_traverse *), struct db_traverse *dtp)
 
void db_preorder_traverse (struct directory *dp, struct db_traverse *dtp)
 
void db_functree_subtree (struct db_i *dbip, union tree *tp, void(*comb_func)(struct db_i *, struct directory *, void *), void(*leaf_func)(struct db_i *, struct directory *, void *), struct resource *resp, void *client_data)
 
void db_functree (struct db_i *dbip, struct directory *dp, void(*comb_func)(struct db_i *, struct directory *, void *), void(*leaf_func)(struct db_i *, struct directory *, void *), struct resource *resp, void *client_data)
 
struct rt_irt_dirbuild (const char *filename, char *buf, int len)
 
int rt_db_get_internal (struct rt_db_internal *ip, const struct directory *dp, const struct db_i *dbip, const mat_t mat, struct resource *resp)
 
int rt_db_put_internal (struct directory *dp, struct db_i *dbip, struct rt_db_internal *ip, struct resource *resp)
 
int rt_fwrite_internal (FILE *fp, const char *name, const struct rt_db_internal *ip, double conv2mm)
 
void rt_db_free_internal (struct rt_db_internal *ip)
 
int rt_db_lookup_internal (struct db_i *dbip, const char *obj_name, struct directory **dpp, struct rt_db_internal *ip, int noisy, struct resource *resp)
 
HIDDEN int dp_eval_flags (struct directory *dp, int flags)
 
size_t db_ls (const struct db_i *dbip, int flags, const char *pattern, struct directory ***dpv)
 
struct directory ** db_argv_to_dpv (const struct db_i *dbip, const char **argv)
 
char ** db_dpv_to_argv (struct directory **dpv)
 

Detailed Description

Macro Definition Documentation

#define DEFAULT_DB_TITLE   "Untitled BRL-CAD Database"

Definition at line 46 of file db_inmem.c.

Referenced by db_open_inmem().

#define SEEK_SET   0

Definition at line 52 of file db_open.c.

Referenced by _ged_bot_dump(), ged_bot_dump(), ged_dbot_dump(), and icv_rot().

#define DEFAULT_DB_TITLE   "Untitled BRL-CAD Database"

Definition at line 55 of file db_open.c.

Referenced by db_create().

#define DB_WALK_PARALLEL_STATE_MAGIC   0x64777073 /* dwps */

Definition at line 1845 of file db_tree.c.

Referenced by db_walk_tree().

#define DB_CK_WPS (   _p)    BU_CKMAG(_p, DB_WALK_PARALLEL_STATE_MAGIC, "db_walk_parallel_state")

Definition at line 1846 of file db_tree.c.

Referenced by _db_walk_dispatcher().

Function Documentation

int db_add_anim ( struct db_i dbip,
register struct animate anp,
int  root 
)

Definition at line 40 of file db_anim.c.

References animate::an_forw, animate::an_path, ANIM_NULL, bu_bomb(), bu_log(), directory::d_animate, directory::d_namep, DB_FULL_PATH_CUR_DIR, db_i::dbi_anroot, DEBUG_ANIM, RT_CK_ANIMATE, and RT_G_DEBUG.

Referenced by db_parse_anim().

Here is the call graph for this function:

void db_free_1anim ( struct animate anp)

Free one animation structure

Definition at line 208 of file db_anim.c.

References animate::an_path, animate::an_type, animate::an_u, rt_anim_property::anp_shader, animate::animate_specific::anu_p, bu_free(), bu_vls_free(), db_free_full_path(), RT_AN_MATERIAL, and RT_CK_ANIMATE.

Referenced by db_free_anim(), db_parse_1anim(), and ged_arced().

Here is the call graph for this function:

void db_free_anim ( struct db_i dbip)

Release chain of animation structures

An unfortunate choice of name.

Definition at line 223 of file db_anim.c.

References animate::an_forw, ANIM_NULL, directory::d_animate, directory::d_forw, db_free_1anim(), db_i::dbi_anroot, db_i::dbi_Head, RT_CK_ANIMATE, RT_DBNHASH, and RT_DIR_NULL.

Referenced by db_close(), ged_cm_clean(), ged_preview(), and rt_clean().

Here is the call graph for this function:

int db_parse_anim ( struct db_i dbip,
int  argc,
const char **  argv 
)

A common parser for mged and rt. Experimental. Not the best name for this.

Definition at line 424 of file db_anim.c.

References animate::an_path, db_add_anim(), db_parse_1anim(), and db_full_path::fp_len.

Referenced by ged_cm_anim().

Here is the call graph for this function:

void db_write_anim ( FILE *  fop,
struct animate anp 
)

Writes 'count' bytes into at file offset 'offset' from buffer at 'addr'. A wrapper for the UNIX write() sys-call that takes into account syscall semaphores, stdio-only machines, and in-memory buffering.

Returns - 0 OK -1 FAILURE

Definition at line 447 of file db_anim.c.

References animate::an_path, animate::an_type, animate::an_u, rt_anim_color::anc_rgb, ANM_LMUL, anim_mat::anm_mat, anim_mat::anm_op, ANM_RARC, ANM_RBOTH, ANM_RMUL, ANM_RSTACK, rt_anim_property::anp_op, animate::animate_specific::anu_c, animate::animate_specific::anu_m, animate::animate_specific::anu_p, bu_free(), bu_log(), db_path_to_string(), DEBUG_ANIM, RT_AN_COLOR, RT_AN_MATERIAL, RT_AN_MATRIX, RT_AN_SOLID, RT_ANP_APPEND, RT_ANP_REPLACE, RT_CK_ANIMATE, and RT_G_DEBUG.

Referenced by dl_write_animate().

Here is the call graph for this function:

void db_add_node_to_full_path ( struct db_full_path pp,
struct directory dp 
)

Definition at line 54 of file db_fullpath.c.

References bu_calloc(), bu_malloc(), bu_realloc(), db_full_path::fp_bool, db_full_path::fp_len, db_full_path::fp_maxlen, db_full_path::fp_names, RT_CK_DIR, and RT_CK_FULL_PATH.

Referenced by db_apply_state_from_memb(), db_follow_path(), db_fullpath_list_subtree(), db_search(), invent_solid(), and rt_find_paths().

Here is the call graph for this function:

void db_dup_full_path ( struct db_full_path newp,
const struct db_full_path oldp 
)
void db_extend_full_path ( struct db_full_path pathp,
size_t  incr 
)

Extend "pathp" so that it can grow from current fp_len by incr more names.

This is intended primarily as an internal method.

Definition at line 111 of file db_fullpath.c.

References bu_malloc(), bu_realloc(), db_full_path::fp_bool, db_full_path::fp_len, db_full_path::fp_maxlen, db_full_path::fp_names, and RT_CK_FULL_PATH.

Referenced by db_append_full_path().

Here is the call graph for this function:

void db_append_full_path ( struct db_full_path dest,
const struct db_full_path src 
)

Definition at line 145 of file db_fullpath.c.

References db_extend_full_path(), db_full_path::fp_bool, db_full_path::fp_len, db_full_path::fp_names, and RT_CK_FULL_PATH.

Here is the call graph for this function:

void db_dup_path_tail ( struct db_full_path newp,
const struct db_full_path oldp,
off_t  start 
)

Dup old path from starting index to end.

Definition at line 165 of file db_fullpath.c.

References bu_bomb(), bu_malloc(), db_full_path::fp_bool, db_full_path::fp_len, db_full_path::fp_maxlen, db_full_path::fp_names, and RT_CK_FULL_PATH.

Referenced by _rt_gettree_leaf().

Here is the call graph for this function:

void db_path_to_vls ( struct bu_vls str,
const struct db_full_path pp 
)

Append a string representation of the path onto the vls. Must have exactly the same formatting conventions as db_path_to_string().

Definition at line 233 of file db_fullpath.c.

References BU_CK_VLS, bu_vls_putc(), bu_vls_strcat(), directory::d_namep, db_full_path::fp_len, db_full_path::fp_names, and RT_CK_FULL_PATH.

Referenced by dl_print_schain(), dl_select(), and dl_select_partial().

Here is the call graph for this function:

void db_fullpath_to_vls ( struct bu_vls vls,
const struct db_full_path full_path,
const struct db_i dbip,
int  fp_flags 
)
void db_pr_full_path ( const char *  msg,
const struct db_full_path pathp 
)

Definition at line 342 of file db_fullpath.c.

References bu_free(), bu_log(), and db_path_to_string().

Here is the call graph for this function:

int db_string_to_path ( struct db_full_path pp,
const struct db_i dbip,
const char *  str 
)

Reverse the effects of db_path_to_string().

The db_full_path structure will be initialized. If it was already in use, user should call db_free_full_path() first.

Returns - -1 One or more components of path did not exist in the directory. 0 OK

Definition at line 361 of file db_fullpath.c.

References BU_ASSERT_SIZE_T, bu_calloc(), bu_free(), bu_log(), bu_malloc(), bu_strdup, db_full_path_init(), DB_FULL_PATH_MAGIC, db_lookup(), db_full_path::fp_bool, db_full_path::fp_len, db_full_path::fp_maxlen, db_full_path::fp_names, LOOKUP_NOISY, db_full_path::magic, RT_CK_DBI, RT_DIR_NULL, and strchr().

Referenced by _db_search_full_paths(), _dl_eraseAllNamesFromDisplay(), _dl_eraseAllPathsFromDisplay(), db_follow_path_for_state(), db_full_path_list_add(), db_region_mat(), dl_addToDisplay(), dl_erasePathFromDisplay(), edit_str_to_arg(), ged_bb(), ged_E(), ged_get_obj_bounds(), ged_lc(), ged_redraw(), key_matches_path(), main(), rt_joint_process_selection(), rt_tcl_import_from_path(), scloud_setup(), to_edit_redraw(), and wdb_import_from_path2().

Here is the call graph for this function:

int db_argv_to_path ( struct db_full_path pp,
struct db_i dbip,
int  argc,
const char *const *  argv 
)

Treat elements from argv[0] to argv[argc-1] as a path specification.

The path structure will be fully initialized. If it was already in use, user should call db_free_full_path() first.

Returns - -1 One or more components of path did not exist in the directory. 0 OK

Definition at line 438 of file db_fullpath.c.

References bu_calloc(), bu_log(), bu_malloc(), DB_FULL_PATH_MAGIC, db_lookup(), db_full_path::fp_bool, db_full_path::fp_len, db_full_path::fp_maxlen, db_full_path::fp_names, LOOKUP_NOISY, db_full_path::magic, RT_CK_DBI, and RT_DIR_NULL.

Here is the call graph for this function:

int db_identical_full_paths ( const struct db_full_path a,
const struct db_full_path b 
)

Returns - 1 match 0 different

Definition at line 492 of file db_fullpath.c.

References BU_ASSERT_SIZE_T, db_full_path::fp_len, db_full_path::fp_names, and RT_CK_FULL_PATH.

int db_full_path_subset ( const struct db_full_path a,
const struct db_full_path b,
const int  skip_first 
)

Returns - 1 if 'b' is a proper subset of 'a' 0 if not.

Definition at line 515 of file db_fullpath.c.

References db_full_path::fp_len, db_full_path::fp_names, and RT_CK_FULL_PATH.

Referenced by _dl_eraseAllPathsFromDisplay(), _dl_eraseFirstSubpath(), and eraseAllSubpathsFromSolidList().

int db_full_path_match_top ( const struct db_full_path a,
const struct db_full_path b 
)

Returns - 1 if 'a' matches the top part of 'b' 0 if not.

For example, /a/b matches both the top part of /a/b/c and /a/b.

Definition at line 559 of file db_fullpath.c.

References db_full_path::fp_len, db_full_path::fp_names, and RT_CK_FULL_PATH.

Referenced by dl_addToDisplay(), dl_erasePathFromDisplay(), f_above(), ged_redraw(), headsolid_splitGDL(), and key_matches_path().

int db_full_path_search ( const struct db_full_path a,
const struct directory dp 
)

Returns - 1 'dp' is found on this path 0 not found

Definition at line 579 of file db_fullpath.c.

References BU_ASSERT_SIZE_T, db_full_path::fp_len, db_full_path::fp_names, RT_CK_DIR, and RT_CK_FULL_PATH.

Referenced by to_edit_redraw().

int cyclic_path ( const struct db_full_path fp,
const char *  name 
)

Function to test whether a path has a cyclic entry in it.

Parameters
fp[i] Full path to test
name[i] String to use when checking path (optional). If NULL, use the name of the current directory pointer in fp.
Returns
1 if the path is cyclic, 0 if it is not.

Definition at line 598 of file db_fullpath.c.

References BU_STR_EQUAL, directory::d_namep, DB_FULL_PATH_CUR_DIR, db_full_path::fp_len, db_full_path::fp_names, and RT_CK_FULL_PATH.

Referenced by _db_recurse_subtree(), and db_fullpath_list_subtree().

int db_path_to_mat ( struct db_i dbip,
struct db_full_path pathp,
mat_t  mat,
int  depth,
struct resource resp 
)

Build the transformation matrix obtained when traversing the path to the specified depth.

Returns - 1 OK, path matrix written into 'mat'. 0 FAIL

Called in librt/db_tree.c, mged/dodraw.c, and mged/animedit.c

Definition at line 630 of file db_fullpath.c.

References bu_bomb(), db_follow_path(), db_free_db_tree_state(), db_free_full_path(), db_full_path_init(), db_init_db_tree_state(), LOOKUP_NOISY, RT_CHECK_DBI, RT_CK_FULL_PATH, RT_DBTS_INIT_IDN, and db_tree_state::ts_mat.

Referenced by add_comb_child(), db_region_mat(), full_region_node(), rt_joint_process_selection(), and scloud_setup().

Here is the call graph for this function:

struct db_i* db_open_inmem ( void  )

"open" an in-memory-only database instance. this initializes a dbip for use, creating an inmem dbi_wdbp as the means to add geometry to the directory (use wdb_export_external()).

Definition at line 49 of file db_inmem.c.

References BU_ALLOC, bu_ptbl_init(), bu_strdup, db_i::dbi_base2local, db_i::dbi_clients, db_i::dbi_eof, db_i::dbi_filename, db_i::dbi_filepath, db_i::dbi_fp, db_i::dbi_Head, db_i::dbi_local2base, DBI_MAGIC, db_i::dbi_magic, db_i::dbi_mf, DBI_NULL, db_i::dbi_read_only, db_i::dbi_title, db_i::dbi_uses, db_i::dbi_version, db_i::dbi_wdbp, DEFAULT_DB_TITLE, RT_DBNHASH, RT_DIR_NULL, RT_WDB_TYPE_DB_INMEM, and wdb_dbopen().

Referenced by db_create_inmem().

Here is the call graph for this function:

struct db_i* db_create_inmem ( void  )

creates an in-memory-only database. this is very similar to db_open_inmem() with the exception that the this routine adds a default _GLOBAL object.

Definition at line 93 of file db_inmem.c.

References bu_avs_add(), bu_avs_free(), bu_avs_init(), bu_free_external(), bu_vls_addr(), bu_vls_free(), BU_VLS_INIT_ZERO, bu_vls_printf(), db5_export_attributes(), db5_export_object3(), db_open_inmem(), db_i::dbi_local2base, db_i::dbi_title, db_i::dbi_wdbp, RT_CK_DBI, RT_CK_WDB, RT_DIR_HIDDEN, RT_DIR_INMEM, RT_DIR_NON_GEOM, and wdb_export_external().

Referenced by gcv_execute(), and gcv_init().

Here is the call graph for this function:

void db_inmem ( struct directory dp,
struct bu_external ext,
int  flags,
struct db_i dbip 
)

Transmogrify an existing directory entry to be an in-memory-only one, stealing the external representation from 'ext'.

Definition at line 130 of file db_inmem.c.

References BU_CK_EXTERNAL, bu_free(), directory::d_flags, directory::d_len, directory::d_un, db_version(), bu_external::ext_buf, bu_external::ext_nbytes, directory::ptr, RT_CK_DIR, and RT_DIR_INMEM.

Referenced by wdb_export_external().

Here is the call graph for this function:

int db_is_directory_non_empty ( const struct db_i dbip)

Returns - 0 if the in-memory directory is empty 1 if the in-memory directory has entries, which implies that a db_scan() has already been performed.

Definition at line 39 of file db_lookup.c.

References db_i::dbi_Head, RT_CK_DBI, RT_DBNHASH, and RT_DIR_NULL.

Referenced by rt_submodel_plot(), and rt_submodel_prep().

size_t db_directory_size ( const struct db_i dbip)

Return the number of "struct directory" nodes in the given database.

Definition at line 54 of file db_lookup.c.

References directory::d_forw, db_i::dbi_Head, RT_CK_DBI, RT_DBNHASH, and RT_DIR_NULL.

Referenced by _ged_getspace().

void db_ck_directory ( const struct db_i dbip)

For debugging, ensure that all the linked-lists for the directory structure are intact.

Definition at line 71 of file db_lookup.c.

References directory::d_forw, db_i::dbi_Head, RT_CK_DBI, RT_CK_DIR, RT_DBNHASH, and RT_DIR_NULL.

Referenced by rt_ck().

int db_dirhash ( const char *  str)

Returns a hash index for a given string that corresponds with the head of that string's hash chain.

Definition at line 86 of file db_lookup.c.

References RT_DBHASH, and s.

Referenced by _rt_find_identical_solid(), _rt_gettree_leaf(), db_dircheck(), db_dirdelete(), db_lookup(), db_rename(), and rt_free_soltab().

int db_dircheck ( struct db_i dbip,
struct bu_vls ret_name,
int  noisy,
struct directory ***  headp 
)

This routine ensures that ret_name is not already in the directory. If it is, it tries a fixed number of times to modify ret_name before giving up. Note - most of the time, the hash for ret_name is computed once.

Inputs - dbip database instance pointer ret_name the original name noisy to blather or not

Outputs - ret_name the name to use headp pointer to the first (struct directory *) in the bucket

Returns - 0 success <0 fail

Definition at line 105 of file db_lookup.c.

References bu_log(), BU_STR_EQUAL, bu_vls_addr(), bu_vls_strcat(), bu_vls_strcpy(), directory::d_forw, directory::d_namep, db_dirhash(), db_lookup(), db_i::dbi_Head, and RT_DIR_NULL.

Referenced by db5_diradd(), db_diradd(), and db_diradd5().

Here is the call graph for this function:

struct directory* db_lookup ( const struct db_i ,
const char *  name,
int  noisy 
)

This routine takes a name and looks it up in the directory table. If the name is present, a pointer to the directory struct element is returned, otherwise NULL is returned.

If noisy is non-zero, a print occurs, else only the return code indicates failure.

Returns - struct directory if name is found RT_DIR_NULL on failure

Definition at line 153 of file db_lookup.c.

References bu_log(), BU_STR_EQUAL, directory::d_forw, directory::d_namep, db_dirhash(), db_i::dbi_Head, DEBUG_DB, RT_CK_DBI, RT_DIR_NULL, and RT_G_DEBUG.

Referenced by _ged_append_pipept_common(), _ged_build_dpp(), _ged_combadd(), _ged_combadd2(), _ged_print_node(), _ged_search_characterize_path(), brep_conversion_tree(), build_etree(), check_syntax(), comb_lift_region(), comb_wrap(), combmem_set_empty(), constraint_eval(), constraint_get(), constraint_set(), constraint_show(), conv_tree(), db5_update_attribute(), db5_update_ident(), db_apply_state_from_memb(), db_argv_to_dpv(), db_argv_to_path(), db_count_refs(), db_diff(), db_diff3(), db_dirbuild(), db_dircheck(), db_fullpath_list_subtree(), db_functree(), db_functree_subtree(), db_object_exists(), db_preorder_traverse(), db_string_to_path(), db_traverse_subtree(), db_update_nref(), dl_addToDisplay(), edcodes_traverse_node(), edit_str_to_arg(), ged_add_metaballpt(), ged_analyze(), ged_bb(), ged_bo(), ged_bot_edge_split(), ged_bot_face_sort(), ged_bot_face_split(), ged_bot_flip(), ged_bot_merge(), ged_bot_split(), ged_bot_sync(), ged_brep(), ged_cat(), ged_comb(), ged_concat(), ged_cpi(), ged_dbcopy(), ged_decompose(), ged_delete_metaballpt(), ged_delete_pipept(), ged_edcodes(), ged_expand(), ged_facetize(), ged_find_metaballpt_nearest_pt(), ged_find_pipept_nearest_pt(), ged_fracture(), ged_get_comb(), ged_getmat(), ged_hide(), ged_in(), ged_inside(), ged_inside_internal(), ged_instance(), ged_joint2(), ged_keep(), ged_kill(), ged_killtree(), ged_list(), ged_ls(), ged_lt(), ged_make_name(), ged_mirror(), ged_move(), ged_move_arb_edge(), ged_move_arb_face(), ged_move_botpt(), ged_move_botpts(), ged_move_metaballpt(), ged_move_pipept(), ged_nmg_collapse(), ged_nmg_fix_normals(), ged_nmg_simplify(), ged_orotate(), ged_oscale(), ged_pathsum(), ged_prefix(), ged_protate(), ged_pscale(), ged_pset(), ged_ptranslate(), ged_pull(), ged_push(), ged_put(), ged_put_comb(), ged_rcodes(), ged_red(), ged_region(), ged_remove(), ged_rfarb(), ged_rmater(), ged_rotate_arb_face(), ged_search(), ged_shells(), ged_sphgroup(), ged_tables(), ged_track2(), ged_tree(), ged_unhide(), ged_voxelize(), ged_wcodes(), ged_whatid(), ged_wmater(), ged_xpush(), get_densities_from_database(), get_surface(), img_load_datasource(), invent_solid(), main(), make_hole(), make_hole_in_prepped_regions(), mk_unique_brlcad_name(), move_all_func(), node_write(), rt_db_lookup_internal(), rt_extrude_import4(), rt_extrude_import5(), rt_find_solid(), rt_joint_process_selection(), rt_load_attrs(), rt_retrieve_binunif(), rt_revolve_import5(), rt_traverse_tree(), rt_unprep(), tables_new(), txt_load_datasource(), wcodes_printnode(), wdb_export_external(), wdb_import(), and write_comb().

Here is the call graph for this function:

struct directory* db_diradd ( struct db_i ,
const char *  name,
off_t  laddr,
size_t  len,
int  flags,
void *  ptr 
)

Add an entry to the directory. Try to make the regular path through the code as fast as possible, to speed up building the table of contents.

dbip is a pointer to a valid/opened database instance

name is the string name of the object being added

laddr is the offset into the file to the object

len is the length of the object, number of db granules used

flags are defined in raytrace.h (RT_DIR_SOLID, RT_DIR_COMB, RT_DIR_REGION, RT_DIR_INMEM, etc.) for db version 5, ptr is the minor_type (non-null pointer to valid unsigned char code)

an laddr of RT_DIR_PHONY_ADDR means that database storage has not been allocated yet.

Definition at line 190 of file db_lookup.c.

References BU_LIST_INIT, bu_log(), bu_vls_addr(), bu_vls_free(), BU_VLS_INIT_ZERO, bu_vls_strcpy(), bu_vls_strncpy(), directory::d_animate, directory::d_flags, directory::d_forw, directory::d_len, directory::d_major_type, directory::d_minor_type, directory::d_nref, directory::d_use_hd, directory::d_uses, db_dircheck(), db_version(), DEBUG_DB, RT_CK_DBI, RT_CK_DIR, RT_DIR_INMEM, RT_DIR_NULL, RT_DIR_SET_NAMEP, RT_G_DEBUG, RT_GET_DIRECTORY, rt_uniresource, and strchr().

Referenced by db5_update_ident(), db_dirbuild(), ged_bb(), ged_bot_split(), ged_copyeval(), ged_cpi(), ged_decompose(), ged_facetize(), ged_in(), ged_inside_internal(), ged_mirror(), ged_nmg_collapse(), ged_nmg_simplify(), ged_red(), ged_rfarb(), ged_shells(), invent_solid(), main(), and wdb_export_external().

Here is the call graph for this function:

int db_dirdelete ( struct db_i ,
struct directory dp 
)

Given a pointer to a directory entry, remove it from the linked list, and free the associated memory.

It is the responsibility of the caller to have released whatever structures have been hung on the d_use_hd bu_list, first.

Returns - 0 on success non-0 on failure

Definition at line 262 of file db_lookup.c.

References bu_free(), directory::d_flags, directory::d_forw, directory::d_namep, directory::d_un, db_dirhash(), db_i::dbi_Head, directory::ptr, resource::re_directory_hd, RT_CK_DBI, RT_CK_DIR, RT_DIR_FREE_NAMEP, RT_DIR_INMEM, RT_DIR_NULL, and rt_uniresource.

Referenced by _dl_freeDisplayListItem(), comb_flatten(), dl_erasePathFromDisplay(), dl_zap(), ged_kill(), and killtree_callback().

Here is the call graph for this function:

int db_rename ( struct db_i ,
struct directory ,
const char *  newname 
)

Change the name string of a directory entry. Because of the hashing function, this takes some extra work.

Returns - 0 on success non-0 on failure

Definition at line 302 of file db_lookup.c.

References directory::d_forw, directory::d_namep, db_dirhash(), db_i::dbi_Head, out, RT_CK_DBI, RT_CK_DIR, RT_DIR_FREE_NAMEP, RT_DIR_NULL, and RT_DIR_SET_NAMEP.

Referenced by ged_move(), ged_prefix(), and move_all_func().

Here is the call graph for this function:

void db_pr_dir ( const struct db_i dbip)

For debugging, print the entire contents of the database directory.

Definition at line 340 of file db_lookup.c.

References bu_log(), directory::d_animate, directory::d_flags, directory::d_forw, directory::d_len, directory::d_namep, directory::d_nref, directory::d_uses, db_i::dbi_filename, db_i::dbi_Head, db_i::dbi_read_only, db_i::dbi_title, RT_CK_DBI, RT_DBNHASH, RT_DIR_COMB, RT_DIR_INMEM, RT_DIR_NULL, RT_DIR_REGION, and RT_DIR_SOLID.

Referenced by ged_debugdir().

Here is the call graph for this function:

struct bu_ptbl* db_lookup_by_attr ( struct db_i dbip,
int  dir_flags,
struct bu_attribute_value_set avs,
int  op 
)

lookup directory entries based on directory flags (dp->d_flags) and attributes the "dir_flags" arg is a mask for the directory flags the *"avs" is an attribute value set used to select from the objects that *pass the flags mask. if "op" is 1, then the object must have all the *attributes and values that appear in "avs" in order to be *selected. If "op" is 2, then the object must have at least one of *the attribute/value pairs from "avs".

dir_flags are in the form used in struct directory (d_flags)

for op: 1 -> all attribute name/value pairs must be present and match 2 -> at least one of the name/value pairs must be present and match

returns a ptbl list of selected directory pointers an empty list means nothing met the requirements a NULL return means something went wrong.

Definition at line 386 of file db_lookup.c.

References bu_attribute_value_set::avp, BU_ALLOC, bu_avs_free(), bu_avs_init_empty(), BU_CK_AVS, bu_log(), bu_ptbl_init(), bu_ptbl_ins(), BU_STR_EQUAL, bu_attribute_value_set::count, directory::d_flags, directory::d_namep, db5_get_attributes(), FOR_ALL_DIRECTORY_END, FOR_ALL_DIRECTORY_START, bu_attribute_value_pair::name, RT_CK_DBI, RT_DIR_PHONY_ADDR, and bu_attribute_value_pair::value.

Referenced by ged_draw_guts(), ged_erase(), and ged_ls().

Here is the call graph for this function:

int db_regexp_match_all ( struct bu_vls dest,
struct db_i dbip,
const char *  pattern 
)

DEPRECATED: Use db_ls() instead of this function.

Appends a list of all database matches to the given vls, or the pattern itself if no matches are found. Returns the number of matches.

Definition at line 39 of file db_match.c.

References bu_fnmatch(), bu_vls_strcat(), directory::d_forw, directory::d_namep, db_i::dbi_Head, RT_DBNHASH, and RT_DIR_NULL.

Here is the call graph for this function:

HIDDEN void db_count_refs ( struct db_i dbip,
struct rt_comb_internal comb,
union tree comb_leaf,
void *  dummy1,
void *  dummy2,
void *  dummy3,
void *  dummy4 
)

Definition at line 63 of file db_match.c.

References directory::d_nref, db_lookup(), LOOKUP_QUIET, RT_CK_COMB, RT_CK_TREE, RT_DIR_NULL, tree::tree_db_leaf::tl_name, and tree::tr_l.

Referenced by db_update_nref().

Here is the call graph for this function:

void db_update_nref ( struct db_i dbip,
struct resource resp 
)

Updates the d_nref fields (which count the number of times a given entry is referenced by a COMBination in the database).

Definition at line 75 of file db_match.c.

References bu_log(), bu_vls_addr(), bu_vls_strlen(), directory::d_flags, directory::d_forw, directory::d_major_type, directory::d_minor_type, directory::d_namep, directory::d_nref, db_count_refs(), db_lookup(), db_tree_funcleaf(), db_i::dbi_Head, ID_COMBINATION, rt_db_internal::idb_ptr, LOOKUP_QUIET, RT_CK_DBI, RT_CK_RESOURCE, rt_db_free_internal(), rt_db_get_internal(), RT_DB_INTERNAL_INIT, RT_DBNHASH, RT_DIR_COMB, RT_DIR_NULL, and rt_comb_internal::tree.

Referenced by ged_search(), and ged_tops().

Here is the call graph for this function:

struct db_i* db_open ( const char *  name,
const char *  mode 
)

Open the named database.

The 'name' parameter specifies the file or filepath to a .g geometry database file for reading and/or writing.

The 'mode' parameter specifies whether to open read-only or in read-write mode, specified via the DB_OPEN_READONLY and DB_OPEN_READWRITE symbols respectively.

As a convenience, the returned db_t structure's dbi_filepath field is a C-style argv array of dirs to search when attempting to open related files (such as data files for EBM solids or texture-maps). The default values are "." and the directory containing the ".g" file. They may be overridden by setting the environment variable BRLCAD_FILE_PATH.

Returns: DBI_NULL error db_i * success

Definition at line 59 of file db_open.c.

References bu_mapped_file::apbuf, BU_ALLOC, bu_close_mapped_file(), bu_dirname(), bu_free(), bu_free_mapped_files(), bu_log(), bu_malloc(), bu_open_mapped_file(), bu_ptbl_init(), bu_strdup, bu_vls_addr(), bu_vls_free(), BU_VLS_INIT_ZERO, bu_vls_printf(), bu_mapped_file::buf, bu_mapped_file::buflen, db_version(), db_i::dbi_base2local, db_i::dbi_clients, db_i::dbi_eof, db_i::dbi_filename, db_i::dbi_filepath, db_i::dbi_fp, db_i::dbi_Head, db_i::dbi_inmem, db_i::dbi_local2base, DBI_MAGIC, db_i::dbi_magic, db_i::dbi_mf, DBI_NULL, db_i::dbi_read_only, db_i::dbi_title, db_i::dbi_uses, db_i::dbi_version, DEBUG_DB, MAXPATHLEN, RT_CK_DBI, rt_db_flip_endian(), RT_DBNHASH, RT_DIR_NULL, and RT_G_DEBUG.

Referenced by _ged_open_dbip(), db_create(), gcv_brlcad_read(), ged_concat(), ged_dup(), ged_keep(), main(), rt_dirbuild(), rt_submodel_plot(), and rt_submodel_prep().

Here is the call graph for this function:

struct db_i* db_create ( const char *  name,
int  version 
)

Create a new database containing just a header record, regardless of whether the database previously existed or not, and open it for reading and writing.

This routine also calls db_dirbuild(), so the caller doesn't need to.

Returns: DBI_NULL on error db_i * on success

Definition at line 225 of file db_open.c.

References bu_log(), db5_fwrite_ident(), db_dirbuild(), db_fwrite_ident(), db_open(), DB_OPEN_READWRITE, DBI_NULL, DEBUG_DB, DEFAULT_DB_TITLE, and RT_G_DEBUG.

Referenced by _ged_open_dbip(), and wdb_fopen_v().

Here is the call graph for this function:

void db_close_client ( struct db_i dbip,
long int *  client 
)

Definition at line 269 of file db_open.c.

References bu_ptbl_rm(), db_close(), db_i::dbi_clients, and RT_CK_DBI.

Here is the call graph for this function:

int db_dump ( struct rt_wdb wdbp,
struct db_i dbip 
)

Dump a full copy of one database into another. This is a good way of committing a ".inmem" database to a ".g" file. The input is a database instance, the output is a LIBWDB object, which could be a disk file or another database instance.

Returns - -1 error 0 success

Definition at line 384 of file db_open.c.

References bu_free_external(), bu_log(), directory::d_flags, directory::d_forw, directory::d_minor_type, directory::d_namep, db_get_external(), db_version(), db_i::dbi_Head, rt_wdb::dbip, RT_CK_DBI, RT_CK_DIR, RT_CK_WDB, RT_DBNHASH, RT_DIR_INMEM, RT_DIR_NULL, and wdb_export_external().

Referenced by gcv_brlcad_read(), gcv_brlcad_write(), gcv_execute(), and ged_dump().

Here is the call graph for this function:

struct db_i* db_clone_dbi ( struct db_i dbip,
long int *  client 
)

Definition at line 422 of file db_open.c.

References bu_ptbl_ins_unique(), db_i::dbi_clients, db_i::dbi_uses, and RT_CK_DBI.

Here is the call graph for this function:

void db_sync ( struct db_i dbip)

Ensure that the on-disk database has been completely written out of the operating system's cache.

Definition at line 434 of file db_open.c.

References BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), db_i::dbi_fp, and RT_CK_DBI.

Referenced by db_close(), ged_concat(), and ged_sync().

Here is the call graph for this function:

void db_dup_db_tree_state ( struct db_tree_state otsp,
const struct db_tree_state itsp 
)

Duplicate the contents of a db_tree_state structure, including a private copy of the ts_mater field(s) and the attribute/value set.

Definition at line 46 of file db_tree.c.

References bu_attribute_value_set::avp, bu_avs_add(), bu_avs_init(), bu_avs_init_empty(), bu_malloc(), bu_strlcpy, bu_attribute_value_set::count, mater_info::ma_shader, bu_attribute_value_pair::name, RT_CK_DBI, RT_CK_DBTS, db_tree_state::ts_attrs, db_tree_state::ts_dbip, db_tree_state::ts_mater, and bu_attribute_value_pair::value.

Referenced by _db_recurse_subtree(), db_dup_combined_tree_state(), db_new_combined_tree_state(), and db_recurse().

Here is the call graph for this function:

void db_free_db_tree_state ( struct db_tree_state tsp)

Release dynamic fields inside the structure, but not the structure itself.

Definition at line 76 of file db_tree.c.

References bu_attribute_value_set::avp, bu_avs_free(), bu_free(), mater_info::ma_shader, bu_attribute_value_set::max, RT_CK_DBI, RT_CK_DBTS, db_tree_state::ts_attrs, db_tree_state::ts_dbip, and db_tree_state::ts_mater.

Referenced by _db_recurse_subtree(), db_free_combined_tree_state(), db_parse_1anim(), db_path_to_mat(), db_recurse(), and rt_unprep().

Here is the call graph for this function:

void db_init_db_tree_state ( struct db_tree_state tsp,
struct db_i dbip,
struct resource resp 
)

In most cases, you don't want to use this routine, you want to struct copy mged_initial_tree_state or rt_initial_tree_state, and then set ts_dbip in your copy.

Definition at line 93 of file db_tree.c.

References bu_avs_init_empty(), db_tree_state::magic, memset(), RT_CK_DBI, RT_CK_RESOURCE, RT_DBTS_MAGIC, rt_uniresource, db_tree_state::ts_attrs, db_tree_state::ts_dbip, db_tree_state::ts_mat, and db_tree_state::ts_resp.

Referenced by db_parse_1anim(), db_path_to_mat(), ged_facetize(), rt_tcl_import_from_path(), and wdb_import_from_path2().

Here is the call graph for this function:

struct combined_tree_state* db_new_combined_tree_state ( const struct db_tree_state tsp,
const struct db_full_path pathp 
)

Definition at line 111 of file db_tree.c.

References BU_ALLOC, combined_tree_state::cts_p, combined_tree_state::cts_s, db_dup_db_tree_state(), db_dup_full_path(), db_full_path_init(), combined_tree_state::magic, RT_CK_DBI, RT_CK_DBTS, RT_CK_FULL_PATH, RT_CTS_MAGIC, and db_tree_state::ts_dbip.

Referenced by _db_gettree_leaf(), _db_gettree_region_end(), and db_recurse().

Here is the call graph for this function:

struct combined_tree_state* db_dup_combined_tree_state ( const struct combined_tree_state old_ctsp)

Definition at line 129 of file db_tree.c.

References BU_ALLOC, combined_tree_state::cts_p, combined_tree_state::cts_s, db_dup_db_tree_state(), db_dup_full_path(), db_full_path_init(), combined_tree_state::magic, RT_CK_CTS, and RT_CTS_MAGIC.

Referenced by db_dup_subtree().

Here is the call graph for this function:

void db_free_combined_tree_state ( struct combined_tree_state ctsp)

Definition at line 144 of file db_tree.c.

References bu_free(), combined_tree_state::cts_p, combined_tree_state::cts_s, db_free_db_tree_state(), db_free_full_path(), memset(), and RT_CK_CTS.

Referenced by _db_walk_dispatcher(), _db_walk_subtree(), db_free_tree(), and db_walk_tree().

Here is the call graph for this function:

void db_pr_combined_tree_state ( const struct combined_tree_state ctsp)

Definition at line 186 of file db_tree.c.

References bu_free(), bu_log(), combined_tree_state::cts_p, combined_tree_state::cts_s, db_path_to_string(), db_pr_tree_state(), and RT_CK_CTS.

Referenced by _db_walk_dispatcher(), db_recurse(), and rt_pr_tree().

Here is the call graph for this function:

int db_apply_state_from_comb ( struct db_tree_state tsp,
const struct db_full_path pathp,
const struct rt_comb_internal comb 
)
int db_apply_state_from_memb ( struct db_tree_state tsp,
struct db_full_path pathp,
const union tree tp 
)

Updates state via *tsp, pushes member's directory entry on *pathp. (Caller is responsible for popping it).

Returns - -1 failure 0 success, member pushed on path

Definition at line 304 of file db_tree.c.

References bn_mat_mul(), bu_free(), bu_log(), db_add_node_to_full_path(), db_apply_anims(), db_lookup(), db_path_to_string(), LOOKUP_QUIET, RT_CK_DBTS, RT_CK_FULL_PATH, RT_CK_TREE, RT_DIR_NULL, tree::tree_db_leaf::tl_mat, tree::tree_db_leaf::tl_name, tree::tr_l, db_tree_state::ts_dbip, db_tree_state::ts_mat, db_tree_state::ts_mater, db_tree_state::ts_sofar, and TS_SOFAR_REGION.

Referenced by _db_recurse_subtree(), and db_apply_state_from_one_member().

Here is the call graph for this function:

int db_apply_state_from_one_member ( struct db_tree_state tsp,
struct db_full_path pathp,
const char *  cp,
int  sofar,
const union tree tp 
)

Returns - -1 found member, failed to apply state 0 unable to find member 'cp' 1 state applied OK

Definition at line 346 of file db_tree.c.

References bu_bomb(), bu_log(), BU_STR_EQUAL, db_apply_state_from_memb(), OP_DB_LEAF, OP_INTERSECT, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CHECK_DBI, RT_CK_DBTS, RT_CK_FULL_PATH, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_db_leaf::tl_name, tree::tr_b, tree::tr_l, db_tree_state::ts_dbip, db_tree_state::ts_sofar, TS_SOFAR_INTER, and TS_SOFAR_MINUS.

Referenced by db_follow_path().

Here is the call graph for this function:

union tree* db_find_named_leaf ( union tree tp,
const char *  cp 
)

The search stops on the first match.

Returns - tp if found TREE_NULL if not found in this tree

Definition at line 393 of file db_tree.c.

References bu_bomb(), bu_log(), BU_STR_EQUAL, OP_DB_LEAF, OP_INTERSECT, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_db_leaf::tl_name, tree::tr_b, tree::tr_l, and TREE_NULL.

Referenced by edit_arg_to_apparent_coord(), edit_translate(), ged_arced(), ged_copymat(), ged_getmat(), path_validate_recurse(), and rt_joint_process_selection().

Here is the call graph for this function:

union tree* db_find_named_leafs_parent ( int *  side,
union tree tp,
const char *  cp 
)

The search stops on the first match.

Returns - TREE_NULL if not found in this tree tp if found *side == 1 if leaf is on lhs. *side == 2 if leaf is on rhs.

Definition at line 423 of file db_tree.c.

References bu_bomb(), bu_log(), BU_STR_EQUAL, OP_DB_LEAF, OP_INTERSECT, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_db_leaf::tl_name, tree::tr_b, tree::tr_l, and TREE_NULL.

Referenced by db_tree_del_dbleaf().

Here is the call graph for this function:

void db_tree_del_lhs ( union tree tp,
struct resource resp 
)

Definition at line 466 of file db_tree.c.

References bu_bomb(), db_free_tree(), OP_DB_LEAF, OP_INTERSECT, OP_NMG_TESS, OP_NOP, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CK_RESOURCE, RT_CK_TREE, RT_FREE_TREE, rt_uniresource, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tr_b, and TREE_NULL.

Referenced by db_non_union_push(), and db_tree_del_dbleaf().

Here is the call graph for this function:

void db_tree_del_rhs ( union tree tp,
struct resource resp 
)

Definition at line 512 of file db_tree.c.

References bu_bomb(), db_free_tree(), OP_DB_LEAF, OP_INTERSECT, OP_NMG_TESS, OP_NOP, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CK_RESOURCE, RT_CK_TREE, RT_FREE_TREE, rt_uniresource, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tr_b, and TREE_NULL.

Referenced by db_non_union_push(), and db_tree_del_dbleaf().

Here is the call graph for this function:

int db_tree_del_dbleaf ( union tree **  tp,
const char *  cp,
struct resource resp,
int  nflag 
)

Given a name presumably referenced in a OP_DB_LEAF node, delete that node, and the operation node that references it. Not that this may not produce an equivalent tree, for example when rewriting (A - subtree) as (subtree), but that will be up to the caller/user to adjust. This routine gets rid of exactly two nodes in the tree: leaf, and op. Use some other routine if you wish to kill the entire rhs below "-" and "intersect" nodes.

The two nodes deleted will have their memory freed.

If the tree is a single OP_DB_LEAF node, the leaf is freed and *tp is set to NULL.

Returns - -3 Internal error -2 Tree is empty -1 Unable to find OP_DB_LEAF node specified by 'cp'. 0 OK

Definition at line 558 of file db_tree.c.

References bu_log(), BU_STR_EQUAL, db_find_named_leafs_parent(), db_free_tree(), db_tree_del_lhs(), db_tree_del_rhs(), OP_DB_LEAF, RT_CK_RESOURCE, RT_CK_TREE, rt_uniresource, and TREE_NULL.

Referenced by ged_killrefs(), and ged_remove().

Here is the call graph for this function:

void db_tree_mul_dbleaf ( union tree tp,
const mat_t  mat 
)

Multiply on the left every matrix found in a DB_LEAF node in a tree.

Definition at line 607 of file db_tree.c.

References bn_mat_dup(), bn_mat_mul(), bu_bomb(), bu_log(), OP_DB_LEAF, OP_INTERSECT, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_db_leaf::tl_mat, tree::tr_b, and tree::tr_l.

Referenced by rt_comb_mirror().

Here is the call graph for this function:

void db_tree_funcleaf ( struct db_i dbip,
struct rt_comb_internal comb,
union tree comb_tree,
void(*)(struct db_i *, struct rt_comb_internal *, union tree *, void *, void *, void *, void *)  leaf_func,
void *  user_ptr1,
void *  user_ptr2,
void *  user_ptr3,
void *  user_ptr4 
)

This routine traverses a combination (union tree) in LNR order and calls the provided function for each OP_DB_LEAF node. Note that this routine does not go outside this one combination!!!!

was previously named comb_functree()

Definition at line 640 of file db_tree.c.

References bu_bomb(), bu_log(), OP_DB_LEAF, OP_INTERSECT, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CK_DBI, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, and tree::tr_b.

Referenced by db_update_nref(), edcodes_collect_regnames(), ged_find(), ged_prefix(), ged_trace(), ged_xpush(), pull_comb(), and wcodes_printcodes().

Here is the call graph for this function:

int db_follow_path ( struct db_tree_state tsp,
struct db_full_path total_path,
const struct db_full_path new_path,
int  noisy,
long  pdepth 
)

Starting with possible prior partial path and corresponding accumulated state, follow the path given by "new_path", updating *tsp and *total_path with full state information along the way. In a better world, there would have been a "combined_tree_state" arg.

Parameter 'depth' controls how much of 'new_path' is used:

0 use all of new_path >0 use only this many of the first elements of the path <0 use all but this many path elements.

A much more complete version of rt_plookup() and pathHmat(). There is also a TCL interface.

Returns - 0 success (plus *tsp is updated) -1 error (*tsp values are not useful)

Definition at line 682 of file db_tree.c.

References animate::an_forw, animate::an_path, ANIM_NULL, bn_mat_mul(), bu_bomb(), bu_free(), bu_log(), directory::d_flags, directory::d_namep, db_add_node_to_full_path(), db_apply_state_from_comb(), db_apply_state_from_one_member(), db_do_anim(), DB_FULL_PATH_CUR_DIR, db_path_to_string(), db_i::dbi_anroot, DEBUG_TREEWALK, db_full_path::fp_len, db_full_path::fp_names, rt_db_internal::idb_ptr, out, RT_CHECK_DBI, RT_CK_ANIMATE, RT_CK_COMB, RT_CK_DBTS, RT_CK_DIR, RT_CK_FULL_PATH, RT_CK_RESOURCE, rt_db_free_internal(), rt_db_get_internal(), RT_DIR_COMB, RT_DIR_NULL, RT_G_DEBUG, rt_comb_internal::tree, db_tree_state::ts_dbip, db_tree_state::ts_mat, db_tree_state::ts_mater, and db_tree_state::ts_resp.

Referenced by db_follow_path_for_state(), db_path_to_mat(), rt_tcl_import_from_path(), rt_unprep(), and wdb_import_from_path2().

Here is the call graph for this function:

int db_follow_path_for_state ( struct db_tree_state tsp,
struct db_full_path pathp,
const char *  orig_str,
int  noisy 
)

Follow the slash-separated path given by "cp", and update *tsp and *total_path with full state information along the way.

A much more complete version of rt_plookup().

Returns - 0 success (plus *tsp is updated) -1 error (*tsp values are not useful)

Definition at line 839 of file db_tree.c.

References db_follow_path(), db_free_full_path(), db_full_path_init(), db_string_to_path(), db_full_path::fp_len, RT_CK_DBTS, and db_tree_state::ts_dbip.

Referenced by db_parse_1anim(), db_walk_tree(), dm_draw_labels(), ged_copymat(), and ged_list().

Here is the call graph for this function:

HIDDEN void _db_recurse_subtree ( union tree tp,
struct db_tree_state msp,
struct db_full_path pathp,
struct combined_tree_state **  region_start_statepp,
void *  client_data 
)
union tree* db_recurse ( struct db_tree_state tsp,
struct db_full_path pathp,
struct combined_tree_state **  region_start_statepp,
void *  client_data 
)
void db_ck_tree ( const union tree tp)

Definition at line 1255 of file db_tree.c.

References BU_ASSERT_PTR, bu_bomb(), bu_log(), OP_DB_LEAF, OP_GUARD, OP_INTERSECT, OP_NOP, OP_NOT, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, OP_XNOP, OP_XOR, RT_CK_CTS, RT_CK_SOLTAB, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_cts::tc_ctsp, tree::tree_db_leaf::tl_name, tree::tr_a, tree::tr_b, tree::tr_c, tree::tr_l, and tree::tree_leaf::tu_stp.

Referenced by rt_ck(), rt_clean(), rt_gettrees_muves(), and rt_prep_parallel().

Here is the call graph for this function:

void db_free_tree ( union tree tp,
struct resource resp 
)
void db_left_hvy_node ( union tree tp)

Re-balance this node to make it left heavy. Union operators will be moved to left side. when finished "tp" MUST still point to top node of this subtree.

Definition at line 1404 of file db_tree.c.

References OP_UNION, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, and tree::tr_b.

Referenced by db_non_union_push().

void db_non_union_push ( union tree tp,
struct resource resp 
)

If there are non-union operations in the tree, above the region nodes, then rewrite the tree so that the entire tree top is nothing but union operations, and any non-union operations are clustered down near the region nodes.

Definition at line 1426 of file db_tree.c.

References A, C, db_dup_subtree(), db_free_tree(), db_left_hvy_node(), db_tree_del_lhs(), db_tree_del_rhs(), OP_DB_LEAF, OP_INTERSECT, OP_NOP, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, RT_CK_RESOURCE, RT_CK_TREE, RT_GET_TREE, rt_uniresource, tree::tree_node::tb_left, tree::tree_node::tb_right, and tree::tr_b.

Referenced by _ged_combadd2(), _ged_print_node(), db_tree_flatten_describe(), db_walk_tree(), ged_get_comb(), mk_tree_gift(), rt_comb_export4(), tables_new(), and write_comb().

Here is the call graph for this function:

int db_count_tree_nodes ( const union tree tp,
int  count 
)

Return a count of the number of "union tree" nodes below "tp", including tp.

Definition at line 1634 of file db_tree.c.

References bu_bomb(), bu_log(), OP_DB_LEAF, OP_GUARD, OP_INTERSECT, OP_NOP, OP_NOT, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, OP_XNOP, OP_XOR, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, and tree::tr_b.

Here is the call graph for this function:

int db_is_tree_all_unions ( const union tree tp)

Returns - 1 if this tree contains nothing but union operations. 0 if at least one subtraction or intersection op exists.

Definition at line 1670 of file db_tree.c.

References bu_bomb(), bu_log(), OP_DB_LEAF, OP_GUARD, OP_INTERSECT, OP_NOP, OP_NOT, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, OP_XNOP, OP_XOR, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, and tree::tr_b.

Referenced by _rt_gettree_region_end().

Here is the call graph for this function:

int db_count_subtree_regions ( const union tree tp)

Definition at line 1705 of file db_tree.c.

References bu_bomb(), bu_log(), OP_DB_LEAF, OP_GUARD, OP_INTERSECT, OP_NOP, OP_NOT, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, OP_XNOP, OP_XOR, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, and tree::tr_b.

Referenced by db_walk_tree().

Here is the call graph for this function:

int db_tally_subtree_regions ( union tree tp,
union tree **  reg_trees,
int  cur,
int  lim,
struct resource resp 
)

Definition at line 1741 of file db_tree.c.

References bu_bomb(), bu_log(), OP_DB_LEAF, OP_GUARD, OP_INTERSECT, OP_NOP, OP_NOT, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, OP_XNOP, OP_XOR, RT_CK_RESOURCE, RT_CK_TREE, RT_GET_TREE, rt_uniresource, tree::tree_node::tb_left, tree::tree_node::tb_right, and tree::tr_b.

Referenced by db_walk_tree().

Here is the call graph for this function:

HIDDEN union tree* _db_gettree_region_end ( struct db_tree_state tsp,
const struct db_full_path pathp,
union tree curtree,
void *  client_data 
)

Definition at line 1800 of file db_tree.c.

References db_new_combined_tree_state(), OP_REGION, RT_CK_DBI, RT_CK_DBTS, RT_CK_FULL_PATH, RT_CK_RESOURCE, RT_GET_TREE, tree::tree_cts::tc_ctsp, tree::tr_c, db_tree_state::ts_dbip, and db_tree_state::ts_resp.

Referenced by db_walk_tree().

Here is the call graph for this function:

HIDDEN union tree* _db_gettree_leaf ( struct db_tree_state tsp,
const struct db_full_path pathp,
struct rt_db_internal ip,
void *  client_data 
)

Definition at line 1817 of file db_tree.c.

References db_new_combined_tree_state(), OP_REGION, RT_CK_DB_INTERNAL, RT_CK_DBI, RT_CK_DBTS, RT_CK_FULL_PATH, RT_CK_RESOURCE, RT_GET_TREE, tree::tree_cts::tc_ctsp, tree::tr_c, db_tree_state::ts_dbip, and db_tree_state::ts_resp.

Referenced by db_walk_tree().

Here is the call graph for this function:

HIDDEN void _db_walk_dispatcher ( int  cpu,
void *  arg 
)

This routine handles the PARALLEL portion of db_walk_tree(). There will be at least one, and possibly more, instances of this routine running simultaneously.

Uses the self-dispatcher pattern: Pick off the next region's tree, and walk it.

Definition at line 1950 of file db_tree.c.

References _db_walk_subtree(), bu_log(), BU_PTBL_GET, bu_semaphore_acquire(), bu_semaphore_release(), db_walk_parallel_state::client_data, combined_tree_state::cts_p, combined_tree_state::cts_s, DB_CK_WPS, db_free_combined_tree_state(), db_pr_combined_tree_state(), DEBUG_TREEWALK, db_walk_parallel_state::reg_count, db_walk_parallel_state::reg_current, db_walk_parallel_state::reg_end_func, db_walk_parallel_state::reg_leaf_func, db_walk_parallel_state::reg_trees, RT_CK_CTS, RT_CK_RESOURCE, RT_CK_RTI, RT_CK_TREE, RT_G_DEBUG, rt_pr_tree(), RT_SEM_WORKER, rt_uniresource, rt_i::rti_resources, db_walk_parallel_state::rtip, and TREE_NULL.

Referenced by db_walk_tree().

Here is the call graph for this function:

int db_walk_tree ( struct db_i dbip,
int  argc,
const char **  argv,
int  ncpu,
const struct db_tree_state init_state,
int(*)(struct db_tree_state *, const struct db_full_path *, const struct rt_comb_internal *, void *)  reg_start_func,
union tree *(*)(struct db_tree_state *, const struct db_full_path *, union tree *, void *)  reg_end_func,
union tree *(*)(struct db_tree_state *, const struct db_full_path *, struct rt_db_internal *, void *)  leaf_func,
void *  client_data 
)
void db_apply_anims ( struct db_full_path pathp,
struct directory dp,
mat_t  stck,
mat_t  arc,
struct mater_info materp 
)

'arc' may be a null pointer, signifying an identity matrix. 'materp' may be a null pointer, signifying that the region has already been finalized above this point in the tree.

Definition at line 2210 of file db_tree.c.

References animate::an_forw, animate::an_path, ANIM_NULL, bu_free(), bu_log(), directory::d_animate, directory::d_namep, db_do_anim(), db_path_to_string(), DEBUG_ANIM, db_full_path::fp_len, db_full_path::fp_names, RT_CK_ANIMATE, and RT_G_DEBUG.

Referenced by db_apply_state_from_memb().

Here is the call graph for this function:

int db_region_mat ( mat_t  m,
struct db_i dbip,
const char *  name,
struct resource resp 
)

Given the name of a region, return the matrix which maps model coordinates into "region" coordinates.

Returns: 0 OK <0 Failure

Definition at line 2269 of file db_tree.c.

References bn_mat_inv(), bu_log(), db_free_full_path(), db_path_to_mat(), and db_string_to_path().

Referenced by grass_setup(), noise_setup(), prj_setup(), rt_shader_mat(), setup(), tcl_setup(), and tthrm_setup().

Here is the call graph for this function:

int rt_shader_mat ( mat_t  model_to_shader,
const struct rt_i rtip,
const struct region rp,
point_t  p_min,
point_t  p_max,
struct resource resp 
)

XXX given that this routine depends on rtip, it should be called XXX rt_shader_mat().

Given a region, return a matrix which maps model coordinates into region "shader space". This is a space where points in the model within the bounding box of the region are mapped into "region" space (the coordinate system in which the region is defined). The area occupied by the region's bounding box (in region coordinates) are then mapped into the unit cube. This unit cube defines "shader space".

Returns: 0 OK <0 Failure

Definition at line 2300 of file db_tree.c.

References bn_mat_mul(), bu_basename(), bu_bomb(), bu_calloc(), bu_free(), bu_semaphore_acquire(), bu_semaphore_release(), db_region_mat(), region::reg_name, RT_CK_RESOURCE, RT_CK_RTI, rt_clean(), rt_gettree(), rt_new_rti(), rt_rpp_region(), RT_SEM_MODEL, rt_i::rti_dbip, and rt_i::useair.

Referenced by fire_setup().

Here is the call graph for this function:

HIDDEN int tree_list_needspace ( struct bu_vls vls)

Definition at line 2371 of file db_tree.c.

References bu_vls_addr(), and bu_vls_strlen().

Referenced by tree_list_append(), and tree_list_sublist_begin().

Here is the call graph for this function:

HIDDEN void tree_list_sublist_begin ( struct bu_vls vls)

Definition at line 2414 of file db_tree.c.

References bu_vls_putc(), bu_vls_strcat(), and tree_list_needspace().

Referenced by db_tree_list(), and tree_list_append().

Here is the call graph for this function:

HIDDEN void tree_list_sublist_end ( struct bu_vls vls)

Definition at line 2427 of file db_tree.c.

References bu_vls_putc().

Referenced by db_tree_list(), and tree_list_append().

Here is the call graph for this function:

HIDDEN void tree_list_append ( struct bu_vls vls,
const char *  str 
)

Definition at line 2438 of file db_tree.c.

References bu_vls_putc(), bu_vls_strcat(), tree_list_needspace(), tree_list_sublist_begin(), and tree_list_sublist_end().

Referenced by db_tree_list().

Here is the call graph for this function:

int db_tree_list ( struct bu_vls vls,
const union tree tp 
)

Fills a bu_vls with a representation of the given tree appropriate for processing by Tcl scripts.

A tree 't' is represented in the following manner:

t := { l dbobjname { mat } } | { l dbobjname } | { u t1 t2 } | { n t1 t2 } | { - t1 t2 } | { ^ t1 t2 } | { ! t1 } | { G t1 } | { X t1 } | { N } | {}

where 'dbobjname' is a string containing the name of a database object, 'mat' is the matrix preceding a leaf, 't1', 't2' are trees (recursively defined).

Notice that in most cases, this tree will be grossly unbalanced.

Definition at line 2489 of file db_tree.c.

References bin(), bn_encode_mat(), bu_bomb(), bu_log(), OP_DB_LEAF, OP_GUARD, OP_INTERSECT, OP_NOP, OP_NOT, OP_SUBTRACT, OP_UNION, OP_XNOP, OP_XOR, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_db_leaf::tl_mat, tree::tree_db_leaf::tl_name, tree::tr_b, tree::tr_l, tree_list_append(), tree_list_sublist_begin(), and tree_list_sublist_end().

Referenced by rt_comb_get().

Here is the call graph for this function:

union tree* db_tree_parse ( struct bu_vls vls,
const char *  str,
struct resource resp 
)

Take a TCL-style string description of a binary tree, as produced by db_tree_list(), and reconstruct the in-memory form of that tree.

Definition at line 2560 of file db_tree.c.

References bn_decode_mat(), bn_mat_ck(), bn_mat_dup(), bn_mat_is_identity(), brlcad_interp, bu_free(), bu_strdup, bu_vls_printf(), db_free_tree(), DB_OP_INTERSECT, DB_OP_NULL, DB_OP_SUBTRACT, DB_OP_UNION, db_str2op(), OP_DB_LEAF, OP_GUARD, OP_INTERSECT, OP_NOT, OP_SUBTRACT, OP_UNION, OP_XNOP, RT_CK_RESOURCE, RT_FREE_TREE, RT_GET_TREE, rt_uniresource, tree::tree_node::tb_left, tree::tree_node::tb_op, tree::tree_node::tb_right, tree::tree_db_leaf::tl_mat, tree::tree_db_leaf::tl_name, tree::tr_b, tree::tr_l, and TREE_NULL.

Referenced by rt_comb_adjust().

Here is the call graph for this function:

void db_traverse_subtree ( union tree tp,
void(*)(struct directory *, struct db_traverse *)  traverse_func,
struct db_traverse dtp 
)

A generic traversal function.

Definition at line 42 of file db_walk.c.

References bu_bomb(), bu_log(), db_lookup(), db_traverse::dbip, LOOKUP_NOISY, OP_DB_LEAF, OP_INTERSECT, OP_SUBTRACT, OP_UNION, OP_XOR, db_traverse::resp, RT_CHECK_DBI, RT_CK_DB_TRAVERSE, RT_CK_RESOURCE, RT_CK_TREE, RT_DIR_NULL, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_db_leaf::tl_name, tree::tr_b, and tree::tr_l.

Referenced by db_preorder_traverse().

Here is the call graph for this function:

void db_functree_subtree ( struct db_i dbip,
union tree tp,
void(*)(struct db_i *, struct directory *, void *)  comb_func,
void(*)(struct db_i *, struct directory *, void *)  leaf_func,
struct resource resp,
void *  client_data 
)

Definition at line 159 of file db_walk.c.

References bu_bomb(), bu_log(), db_functree(), db_lookup(), LOOKUP_NOISY, OP_DB_LEAF, OP_INTERSECT, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CHECK_DBI, RT_CK_RESOURCE, RT_CK_TREE, RT_DIR_NULL, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_db_leaf::tl_name, tree::tr_b, and tree::tr_l.

Referenced by db_functree().

Here is the call graph for this function:

void db_functree ( struct db_i dbip,
struct directory dp,
void(*)(struct db_i *, struct directory *, void *)  comb_func,
void(*)(struct db_i *, struct directory *, void *)  leaf_func,
struct resource resp,
void *  client_data 
)

This subroutine is called for a no-frills tree-walk, with the provided subroutines being called at every combination and leaf (solid) node, respectively.

This routine is recursive, so no variables may be declared static.

Definition at line 199 of file db_walk.c.

References bu_free(), bu_log(), directory::d_flags, directory::d_len, directory::d_major_type, directory::d_namep, db_functree_subtree(), db_getmrec(), db_lookup(), db_version(), DEBUG_DB, rt_db_internal::idb_ptr, LOOKUP_NOISY, M, RT_CK_DBI, RT_CK_RESOURCE, rt_db_free_internal(), rt_db_get_internal5(), RT_DIR_COMB, RT_DIR_NULL, RT_DIR_SOLID, RT_G_DEBUG, and rt_comb_internal::tree.

Referenced by db_functree_subtree(), ged_keep(), ged_killtree(), ged_pull(), and ged_xpush().

Here is the call graph for this function:

struct rt_i* rt_dirbuild ( const char *  filename,
char *  buf,
int  len 
)

Builds a directory of the object names.

Allocate and initialize information for this instance of an RT model database.

Returns - (struct rt_i *) Success RTI_NULL Fatal Error

Definition at line 48 of file dir.c.

References bu_strlcpy, db_close(), db_dirbuild(), db_open(), DB_OPEN_READONLY, DBI_NULL, db_i::dbi_title, resource::re_magic, RT_CK_DBI, rt_init_resource(), rt_new_rti(), rt_uniresource, and RTI_NULL.

Referenced by BU_FORTRAN().

Here is the call graph for this function:

int rt_db_get_internal ( struct rt_db_internal ip,
const struct directory dp,
const struct db_i dbip,
const mat_t  mat,
struct resource resp 
)

Get an object from the database, and convert it into its internal representation.

Returns - <0 On error id On success.

Definition at line 76 of file dir.c.

References bn_mat_identity, bu_avs_init_empty(), BU_EXTERNAL_INIT, bu_free_external(), bu_log(), directory::d_flags, directory::d_namep, db5_sync_comb_to_attr(), db_get_external(), db_i::dbi_version, rt_functab::ft_import4, ID_COMBINATION, rt_db_internal::idb_avs, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, OBJ, RT_CK_COMB, RT_CK_DB_INTERNAL, rt_db_free_internal(), rt_db_get_internal5(), RT_DB_INTERNAL_INIT, RT_DIR_COMB, and rt_id_solid().

Referenced by _ged_do_list(), _ged_print_node(), add_solid(), bare_comb_node(), bbd_setup(), brep_conversion_tree(), combmem_set_empty(), conv_tree(), db_comb_mvall(), db_follow_path(), db_fullpath_list(), db_fullpath_to_vls(), db_recurse(), db_update_nref(), dl_botdump(), dm_draw_labels(), edcodes_collect_regnames(), f_nnodes(), f_objparam(), f_type(), ged_arced(), ged_bb(), ged_bo(), ged_bot_dump(), ged_cpi(), ged_decompose(), ged_delete_metaballpt(), ged_delete_pipept(), ged_eac(), ged_find(), ged_fracture(), ged_get_comb(), ged_getmat(), ged_inside(), ged_killrefs(), ged_list(), ged_mirror(), ged_move(), ged_nmg_collapse(), ged_nmg_fix_normals(), ged_nmg_simplify(), ged_prefix(), ged_push(), ged_put_comb(), ged_rcodes(), ged_red(), ged_remove(), ged_rmap(), ged_rmater(), ged_shells(), ged_sphgroup(), ged_trace(), ged_whatid(), ged_which(), ged_which_shader(), ged_wmater(), ged_xpush(), get_densities_from_database(), get_diff_components(), get_surface(), img_load_datasource(), main(), make_hole(), make_hole_in_prepped_regions(), move_all_func(), nmg_2_vrml(), node_write(), obj_vlist(), path_validate_recurse(), pull_comb(), rt_arb_uv(), rt_db_lookup_internal(), rt_extrude_import4(), rt_extrude_import5(), rt_find_paths(), rt_joint_process_selection(), rt_revolve_import5(), rt_vlist_solid(), tables_new(), txt_load_datasource(), wcodes_printcodes(), and wdb_import().

Here is the call graph for this function:

int rt_db_put_internal ( struct directory dp,
struct db_i dbip,
struct rt_db_internal ip,
struct resource resp 
)

Convert the internal representation of a solid to the external one, and write it into the database. On success only, the internal representation is freed.

Returns - <0 error 0 success

Definition at line 136 of file dir.c.

References BU_EXTERNAL_INIT, bu_free_external(), bu_log(), directory::d_namep, db_put_external(), db_version(), rt_functab::ft_export4, rt_db_internal::idb_meth, RT_CK_DB_INTERNAL, rt_db_free_internal(), and rt_db_put_internal5().

Referenced by build_comb(), combmem_set_empty(), db_comb_mvall(), ged_arced(), ged_bb(), ged_bot_split(), ged_copyeval(), ged_copymat(), ged_cpi(), ged_decompose(), ged_facetize(), ged_in(), ged_inside_internal(), ged_killrefs(), ged_mirror(), ged_move(), ged_nmg_collapse(), ged_nmg_simplify(), ged_prefix(), ged_push(), ged_rcodes(), ged_red(), ged_remove(), ged_rfarb(), ged_rmater(), ged_shells(), ged_xpush(), main(), move_all_func(), pull_comb(), and rt_joint_process_selection().

Here is the call graph for this function:

int rt_fwrite_internal ( FILE *  fp,
const char *  name,
const struct rt_db_internal ip,
double  conv2mm 
)

Put an object in internal format out onto a file in external format. Used by LIBWDB.

Can't really require a dbip parameter, as many callers won't have one.

THIS ROUTINE ONLY SUPPORTS WRITING V4 GEOMETRY.

Returns - 0 OK <0 error

Definition at line 177 of file dir.c.

References BU_CK_EXTERNAL, BU_EXTERNAL_INIT, bu_free_external(), bu_log(), db_fwrite_external(), rt_functab::ft_export4, rt_db_internal::idb_meth, RT_CK_DB_INTERNAL, RT_CK_FUNCTAB, and rt_uniresource.

Here is the call graph for this function:

void rt_db_free_internal ( struct rt_db_internal ip)

Definition at line 216 of file dir.c.

References bu_avs_free(), BU_AVS_MAGIC, rt_functab::ft_ifree, rt_db_internal::idb_avs, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, bu_attribute_value_set::magic, RT_CK_DB_INTERNAL, RT_CK_FUNCTAB, and RT_DB_INTERNAL_INIT.

Referenced by _ged_append_pipept_common(), _ged_combadd2(), _ged_do_list(), _ged_get_obj_bounds2(), _ged_print_node(), add_solid(), attr_pretty_print(), bbd_setup(), brep_conversion_tree(), comb_tree_clear(), combmem_get(), conv_tree(), db_comb_mvall(), db_follow_path(), db_fullpath_list(), db_fullpath_to_vls(), db_functree(), db_preorder_traverse(), db_recurse(), db_update_nref(), dl_botdump(), dm_draw_labels(), edarb_facedef(), edarb_mirface(), edit_arg_to_apparent_coord(), edit_translate(), f_nnodes(), f_objparam(), f_type(), fix_halfs(), free_diff_components(), ged_add_metaballpt(), ged_adjust(), ged_analyze(), ged_arced(), ged_bb(), ged_bo(), ged_bot_decimate(), ged_bot_dump(), ged_bot_edge_split(), ged_bot_face_sort(), ged_bot_face_split(), ged_bot_fuse(), ged_bot_smooth(), ged_bot_split(), ged_bot_sync(), ged_brep(), ged_comb_color(), ged_copyeval(), ged_copymat(), ged_cpi(), ged_decompose(), ged_delete_metaballpt(), ged_delete_pipept(), ged_facetize(), ged_find(), ged_find_arb_edge_nearest_pt(), ged_find_bot_edge_nearest_pt(), ged_find_botpt_nearest_pt(), ged_find_metaballpt_nearest_pt(), ged_find_pipept_nearest_pt(), ged_fracture(), ged_get(), ged_get_bot_edges(), ged_get_type(), ged_getmat(), ged_import_polygon(), ged_in(), ged_joint2(), ged_list(), ged_make_pnts(), ged_mater(), ged_move(), ged_move_arb_edge(), ged_move_arb_face(), ged_move_botpt(), ged_move_botpts(), ged_move_metaballpt(), ged_move_pipept(), ged_nmg_collapse(), ged_nmg_fix_normals(), ged_nmg_simplify(), ged_protate(), ged_pscale(), ged_pset(), ged_ptranslate(), ged_push(), ged_put(), ged_rcodes(), ged_rfarb(), ged_rmap(), ged_rotate_arb_face(), ged_rselect(), ged_select(), ged_shader(), ged_trace(), ged_whatid(), ged_which(), ged_wmater(), ged_xpush(), get_diff_components(), main(), move_all_func(), nurbs_test(), obj_vlist(), path_validate_recurse(), rt_arb_uv(), rt_bound_internal(), rt_db_external5_to_internal5(), rt_db_get_internal(), rt_db_put_internal(), rt_db_put_internal5(), rt_extrude_xform(), rt_find_paths(), rt_generic_xform(), rt_hf_to_dsp(), rt_hlf_xform(), rt_mk_binunif(), rt_pg_to_bot(), rt_revolve_xform(), rt_vlist_solid(), tables_new(), to_mouse_move_botpt(), and wdb_put_internal().

Here is the call graph for this function:

int rt_db_lookup_internal ( struct db_i dbip,
const char *  obj_name,
struct directory **  dpp,
struct rt_db_internal ip,
int  noisy,
struct resource resp 
)

Convert an object name to a rt_db_internal pointer

Looks up the named object in the directory of the specified model, obtaining a directory pointer. Then gets that object from the database and constructs its internal representation. Returns ID_NULL on error, otherwise returns the type of the object.

Definition at line 240 of file dir.c.

References bu_log(), directory::d_namep, db_lookup(), ID_NULL, LOOKUP_NOISY, rt_db_get_internal(), and RT_DIR_NULL.

Referenced by ged_copymat(), rt_bound_internal(), and rt_traverse_tree().

Here is the call graph for this function:

HIDDEN int dp_eval_flags ( struct directory dp,
int  flags 
)
size_t db_ls ( const struct db_i dbip,
int  flags,
const char *  pattern,
struct directory ***  dpv 
)

Definition at line 58 of file ls.c.

References bu_fnmatch(), bu_malloc(), directory::d_forw, directory::d_namep, db_i::dbi_Head, dp_eval_flags(), RT_CK_DBI, RT_DBNHASH, and RT_DIR_NULL.

Referenced by comb_flatten(), comb_lift_region(), db_search(), ged_attr(), and ged_search().

Here is the call graph for this function:

struct directory** db_argv_to_dpv ( const struct db_i dbip,
const char **  argv 
)

convert an argv list of names to a directory pointer array.

If db_lookup fails for any individual argv, an empty directory structure is created and assigned the name and RT_DIR_PHONY_ADDR

The returned directory ** structure is NULL terminated.

Definition at line 90 of file ls.c.

References BU_ALLOC, bu_malloc(), bu_strdup, directory::d_namep, db_lookup(), LOOKUP_QUIET, RT_DIR_NULL, and RT_DIR_PHONY_ADDR.

Here is the call graph for this function:

char** db_dpv_to_argv ( struct directory **  dpv)

convert a directory pointer array to an argv char pointer array.

Definition at line 123 of file ls.c.

References bu_malloc(), and directory::d_namep.

Here is the call graph for this function: