Database5
[Database IO]

Collaboration diagram for Database5:


Files

file  db5.h
 Definition of the BRL-CAD "v5" database format used for new ".g" files.
file  binary_obj.c
file  db5_alloc.c
file  db5_bin.c
file  db5_comb.c
file  db5_io.c
file  db5_scan.c
file  db5_types.c

Data Structures

struct  db5_ondisk_header
struct  db5_raw_internal
struct  db5_type

Defines

#define DB5_H   seen
#define DB5_EXPORT
#define DB5HDR_MAGIC1   0x76
#define DB5HDR_MAGIC2   0x35
#define DB5HDR_HFLAGS_DLI_MASK   0x03
#define DB5HDR_HFLAGS_DLI_APPLICATION_DATA_OBJECT   0
#define DB5HDR_HFLAGS_DLI_HEADER_OBJECT   1
#define DB5HDR_HFLAGS_DLI_FREE_STORAGE   2
#define DB5HDR_HFLAGS_HIDDEN_OBJECT   0x4
#define DB5HDR_HFLAGS_NAME_PRESENT   0x20
#define DB5HDR_HFLAGS_OBJECT_WIDTH_MASK   0xc0
#define DB5HDR_HFLAGS_OBJECT_WIDTH_SHIFT   6
#define DB5HDR_HFLAGS_NAME_WIDTH_MASK   0x18
#define DB5HDR_HFLAGS_NAME_WIDTH_SHIFT   3
#define DB5HDR_WIDTHCODE_8BIT   0
#define DB5HDR_WIDTHCODE_16BIT   1
#define DB5HDR_WIDTHCODE_32BIT   2
#define DB5HDR_WIDTHCODE_64BIT   3
#define DB5HDR_AFLAGS_ZZZ_MASK   0x07
#define DB5HDR_AFLAGS_PRESENT   0x20
#define DB5HDR_AFLAGS_WIDTH_MASK   0xc0
#define DB5HDR_AFLAGS_WIDTH_SHIFT   6
#define DB5HDR_BFLAGS_ZZZ_MASK   0x07
#define DB5HDR_BFLAGS_PRESENT   0x20
#define DB5HDR_BFLAGS_WIDTH_MASK   0xc0
#define DB5HDR_BFLAGS_WIDTH_SHIFT   6
#define DB5_GLOBAL_OBJECT_NAME   "_GLOBAL"
#define DB5_ZZZ_UNCOMPRESSED   0
#define DB5_ZZZ_GNU_GZIP   1
#define DB5_ZZZ_BURROUGHS_WHEELER   2
#define DB5_MAJORTYPE_RESERVED   0
#define DB5_MAJORTYPE_BRLCAD   1
#define DB5_MAJORTYPE_ATTRIBUTE_ONLY   2
#define DB5_MAJORTYPE_BINARY_MASK   0x18
#define DB5_MAJORTYPE_BINARY_EXPM   8
#define DB5_MAJORTYPE_BINARY_UNIF   9
#define DB5_MAJORTYPE_BINARY_MIME   10
#define DB5_MINORTYPE_RESERVED   0
#define DB5_MINORTYPE_BRLCAD_TOR   1
#define DB5_MINORTYPE_BRLCAD_TGC   2
#define DB5_MINORTYPE_BRLCAD_ELL   3
#define DB5_MINORTYPE_BRLCAD_ARB8   4
#define DB5_MINORTYPE_BRLCAD_ARS   5
#define DB5_MINORTYPE_BRLCAD_HALF   6
#define DB5_MINORTYPE_BRLCAD_REC   7
#define DB5_MINORTYPE_BRLCAD_POLY   8
#define DB5_MINORTYPE_BRLCAD_BSPLINE   9
#define DB5_MINORTYPE_BRLCAD_SPH   10
#define DB5_MINORTYPE_BRLCAD_NMG   11
#define DB5_MINORTYPE_BRLCAD_EBM   12
#define DB5_MINORTYPE_BRLCAD_VOL   13
#define DB5_MINORTYPE_BRLCAD_ARBN   14
#define DB5_MINORTYPE_BRLCAD_PIPE   15
#define DB5_MINORTYPE_BRLCAD_PARTICLE   16
#define DB5_MINORTYPE_BRLCAD_RPC   17
#define DB5_MINORTYPE_BRLCAD_RHC   18
#define DB5_MINORTYPE_BRLCAD_EPA   19
#define DB5_MINORTYPE_BRLCAD_EHY   20
#define DB5_MINORTYPE_BRLCAD_ETO   21
#define DB5_MINORTYPE_BRLCAD_GRIP   22
#define DB5_MINORTYPE_BRLCAD_JOINT   23
#define DB5_MINORTYPE_BRLCAD_HF   24
#define DB5_MINORTYPE_BRLCAD_DSP   25
#define DB5_MINORTYPE_BRLCAD_SKETCH   26
#define DB5_MINORTYPE_BRLCAD_EXTRUDE   27
#define DB5_MINORTYPE_BRLCAD_SUBMODEL   28
#define DB5_MINORTYPE_BRLCAD_CLINE   29
#define DB5_MINORTYPE_BRLCAD_BOT   30
#define DB5_MINORTYPE_BRLCAD_COMBINATION   31
#define DB5_MINORTYPE_BRLCAD_SUPERELL   32
#define DB5_MINORTYPE_BRLCAD_METABALL   33
#define DB5_MINORTYPE_BINU_WID_MASK   0x30
#define DB5_MINORTYPE_BINU_SGN_MASK   0x08
#define DB5_MINORTYPE_BINU_ATM_MASK   0x07
#define DB5_MINORTYPE_BINU_FLOAT   0x02
#define DB5_MINORTYPE_BINU_DOUBLE   0x03
#define DB5_MINORTYPE_BINU_8BITINT_U   0x04
#define DB5_MINORTYPE_BINU_16BITINT_U   0x05
#define DB5_MINORTYPE_BINU_32BITINT_U   0x06
#define DB5_MINORTYPE_BINU_64BITINT_U   0x07
#define DB5_MINORTYPE_BINU_8BITINT   0x0c
#define DB5_MINORTYPE_BINU_16BITINT   0x0d
#define DB5_MINORTYPE_BINU_32BITINT   0x0e
#define DB5_MINORTYPE_BINU_64BITINT   0x0f
#define DB5_RAW_INTERNAL_MAGIC   0x64357269
#define RT_CK_RIP(_ptr)   BU_CKMAG( _ptr, DB5_RAW_INTERNAL_MAGIC, "db5_raw_internal" )

Functions

DB5_EXPORT unsigned char * db5_encode_length (unsigned char *cp, long val, int format)
DB5_EXPORT const unsigned
char * 
db5_get_raw_internal_ptr (struct db5_raw_internal *rip, const unsigned char *ip)
int db5_write_free (struct db_i *dbip, struct directory *dp, long length)
int db5_realloc (struct db_i *dbip, struct directory *dp, struct bu_external *ep)
int db5_header_is_valid (const unsigned char *hp)
int db5_select_length_encoding (long int len)
int db5_decode_length (long int *lenp, const unsigned char *cp, int format)
int db5_decode_signed (long int *lenp, const unsigned char *cp, int format)
int db5_crack_disk_header (struct db5_raw_internal *rip, const unsigned char *cp)
int db5_get_raw_internal_fp (struct db5_raw_internal *rip, FILE *fp)
void db5_export_object3 (struct bu_external *out, int dli, const char *name, const unsigned char hidden, const struct bu_external *attrib, const struct bu_external *body, int major, int minor, int a_zzz, int b_zzz)
void db5_make_free_object_hdr (struct bu_external *ep, long length)
void db5_make_free_object (struct bu_external *ep, long length)
int db5_import_attributes (struct bu_attribute_value_set *avs, const struct bu_external *ap)
void db5_export_attributes (struct bu_external *ext, const struct bu_attribute_value_set *avs)
int db5_replace_attributes (struct directory *dp, struct bu_attribute_value_set *avsp, struct db_i *dbip)
int db5_update_attributes (struct directory *dp, struct bu_attribute_value_set *avsp, struct db_i *dbip)
int db5_update_attribute (const char *obj_name, const char *aname, const char *value, struct db_i *dbip)
int db5_update_ident (struct db_i *dbip, const char *title, double local2mm)
int db5_fwrite_ident (FILE *fp, const char *title, double local2mm)
int rt_db_cvt_to_external5 (struct bu_external *ext, const char *name, const struct rt_db_internal *ip, double conv2mm, struct db_i *dbip, struct resource *resp, const int major)
int db_wrap_v5_external (struct bu_external *ep, const char *name)
int db_put_external5 (struct bu_external *ep, struct directory *dp, struct db_i *dbip)
int rt_db_put_internal5 (struct directory *dp, struct db_i *dbip, struct rt_db_internal *ip, struct resource *resp, const int major)
int rt_db_external5_to_internal5 (struct rt_db_internal *ip, const struct bu_external *ep, const char *name, const struct db_i *dbip, const mat_t mat, struct resource *resp)
int rt_db_get_internal5 (struct rt_db_internal *ip, const struct directory *dp, const struct db_i *dbip, const mat_t mat, struct resource *resp)
void db5_export_color_table (struct bu_vls *ostr, struct db_i *dbip)
void db5_import_color_table (char *cp)
int db5_put_color_table (struct db_i *dbip)
int db5_get_attributes (const struct db_i *dbip, struct bu_attribute_value_set *avs, const struct directory *dp)
int db5_scan (struct db_i *dbip, void(*handler)(struct db_i *, const struct db5_raw_internal *, long addr, genptr_t client_data), genptr_t client_data)
directorydb_diradd5 (struct db_i *dbip, const char *name, long laddr, unsigned char major_type, unsigned char minor_type, unsigned char name_hidden, long object_length, struct bu_attribute_value_set *avs)
directorydb5_diradd (struct db_i *dbip, const struct db5_raw_internal *rip, long laddr, genptr_t client_data)
HIDDEN void db5_diradd_handler (struct db_i *dbip, const struct db5_raw_internal *rip, long laddr, genptr_t client_data)
int db_dirbuild (struct db_i *dbip)
int db_get_version (struct db_i *dbip)
int db5_type_tag_from_major (char **tag, const int major)
int db5_type_descrip_from_major (char **descrip, const int major)
int db5_type_tag_from_codes (char **tag, const int major, const int minor)
int db5_type_descrip_from_codes (char **descrip, const int major, const int minor)
int db5_type_codes_from_tag (int *major, int *minor, const char *tag)
int db5_type_codes_from_descrip (int *major, int *minor, const char *descrip)
size_t db5_type_sizeof_h_binu (const int minor)
size_t db5_type_sizeof_n_binu (const int minor)

Variables

const char * binu_types []
DB5_EXPORT const int db5_enc_len [4]
const int db5_enc_len [4]

Define Documentation

#define DB5_H   seen
 

Definition at line 39 of file db5.h.

#define DB5_EXPORT
 

Definition at line 51 of file db5.h.

#define DB5HDR_MAGIC1   0x76
 

Definition at line 70 of file db5.h.

Referenced by db5_crack_disk_header(), db5_export_object3(), db5_header_is_valid(), db5_make_free_object(), and db5_make_free_object_hdr().

#define DB5HDR_MAGIC2   0x35
 

Definition at line 71 of file db5.h.

Referenced by db5_export_object3(), db5_get_raw_internal_fp(), db5_get_raw_internal_ptr(), db5_header_is_valid(), db5_make_free_object(), and db5_write_free().

#define DB5HDR_HFLAGS_DLI_MASK   0x03
 

Definition at line 74 of file db5.h.

Referenced by db5_crack_disk_header(), db5_export_object3(), and db5_header_is_valid().

#define DB5HDR_HFLAGS_DLI_APPLICATION_DATA_OBJECT   0
 

Definition at line 75 of file db5.h.

Referenced by db5_fwrite_ident(), db5_update_ident(), db_create_inmem(), and db_wrap_v5_external().

#define DB5HDR_HFLAGS_DLI_HEADER_OBJECT   1
 

Definition at line 76 of file db5.h.

Referenced by db5_diradd_handler(), db5_fwrite_ident(), db5_header_is_valid(), db_create_inmem(), and wdb_dir_check5().

#define DB5HDR_HFLAGS_DLI_FREE_STORAGE   2
 

Definition at line 77 of file db5.h.

Referenced by db5_diradd_handler(), db5_make_free_object(), db5_make_free_object_hdr(), and wdb_dir_check5().

#define DB5HDR_HFLAGS_HIDDEN_OBJECT   0x4
 

Definition at line 78 of file db5.h.

Referenced by db5_crack_disk_header(), db5_export_object3(), db5_fwrite_ident(), db5_update_ident(), and db_create_inmem().

#define DB5HDR_HFLAGS_NAME_PRESENT   0x20
 

Definition at line 79 of file db5.h.

Referenced by db5_crack_disk_header(), db5_export_object3(), and db5_header_is_valid().

#define DB5HDR_HFLAGS_OBJECT_WIDTH_MASK   0xc0
 

Definition at line 80 of file db5.h.

Referenced by db5_crack_disk_header(), and db5_header_is_valid().

#define DB5HDR_HFLAGS_OBJECT_WIDTH_SHIFT   6
 

Definition at line 81 of file db5.h.

Referenced by db5_crack_disk_header(), db5_export_object3(), db5_header_is_valid(), db5_make_free_object(), and db5_make_free_object_hdr().

#define DB5HDR_HFLAGS_NAME_WIDTH_MASK   0x18
 

Definition at line 82 of file db5.h.

Referenced by db5_crack_disk_header().

#define DB5HDR_HFLAGS_NAME_WIDTH_SHIFT   3
 

Definition at line 83 of file db5.h.

Referenced by db5_crack_disk_header(), and db5_export_object3().

#define DB5HDR_WIDTHCODE_8BIT   0
 

Definition at line 85 of file db5.h.

Referenced by db5_decode_length(), db5_decode_signed(), db5_encode_length(), db5_get_raw_internal_fp(), db5_header_is_valid(), and db5_select_length_encoding().

#define DB5HDR_WIDTHCODE_16BIT   1
 

Definition at line 86 of file db5.h.

Referenced by db5_decode_length(), db5_decode_signed(), db5_encode_length(), db5_get_raw_internal_fp(), and db5_select_length_encoding().

#define DB5HDR_WIDTHCODE_32BIT   2
 

Definition at line 87 of file db5.h.

Referenced by db5_decode_length(), db5_decode_signed(), db5_encode_length(), db5_get_raw_internal_fp(), and db5_select_length_encoding().

#define DB5HDR_WIDTHCODE_64BIT   3
 

Definition at line 88 of file db5.h.

Referenced by db5_decode_length(), db5_decode_signed(), db5_encode_length(), db5_get_raw_internal_fp(), and db5_select_length_encoding().

#define DB5HDR_AFLAGS_ZZZ_MASK   0x07
 

Definition at line 91 of file db5.h.

Referenced by db5_crack_disk_header(), db5_export_object3(), and db5_header_is_valid().

#define DB5HDR_AFLAGS_PRESENT   0x20
 

Definition at line 92 of file db5.h.

Referenced by db5_crack_disk_header(), db5_export_object3(), and db5_header_is_valid().

#define DB5HDR_AFLAGS_WIDTH_MASK   0xc0
 

Definition at line 93 of file db5.h.

Referenced by db5_crack_disk_header(), and db5_header_is_valid().

#define DB5HDR_AFLAGS_WIDTH_SHIFT   6
 

Definition at line 94 of file db5.h.

Referenced by db5_crack_disk_header(), db5_export_object3(), and db5_header_is_valid().

#define DB5HDR_BFLAGS_ZZZ_MASK   0x07
 

Definition at line 97 of file db5.h.

Referenced by db5_crack_disk_header(), db5_export_object3(), and db5_header_is_valid().

#define DB5HDR_BFLAGS_PRESENT   0x20
 

Definition at line 98 of file db5.h.

Referenced by db5_crack_disk_header(), db5_export_object3(), and db5_header_is_valid().

#define DB5HDR_BFLAGS_WIDTH_MASK   0xc0
 

Definition at line 99 of file db5.h.

Referenced by db5_crack_disk_header(), and db5_header_is_valid().

#define DB5HDR_BFLAGS_WIDTH_SHIFT   6
 

Definition at line 100 of file db5.h.

Referenced by db5_crack_disk_header(), db5_export_object3(), and db5_header_is_valid().

#define DB5_GLOBAL_OBJECT_NAME   "_GLOBAL"
 

Definition at line 111 of file db5.h.

Referenced by db5_fwrite_ident(), db5_put_color_table(), db5_update_ident(), db_create_inmem(), and db_dirbuild().

#define DB5_ZZZ_UNCOMPRESSED   0
 

Definition at line 114 of file db5.h.

Referenced by db5_fwrite_ident(), db5_header_is_valid(), db5_update_ident(), and db_create_inmem().

#define DB5_ZZZ_GNU_GZIP   1
 

Definition at line 115 of file db5.h.

#define DB5_ZZZ_BURROUGHS_WHEELER   2
 

Definition at line 116 of file db5.h.

#define DB5_MAJORTYPE_RESERVED   0
 

Definition at line 120 of file db5.h.

Referenced by db5_fwrite_ident(), db5_header_is_valid(), db5_type_codes_from_descrip(), db5_type_codes_from_tag(), db5_type_descrip_from_codes(), db5_type_descrip_from_major(), db5_type_tag_from_codes(), db5_type_tag_from_major(), and db_create_inmem().

#define DB5_MAJORTYPE_BRLCAD   1
 

Definition at line 121 of file db5.h.

Referenced by add_solid(), db5_diradd(), db_diradd(), db_diradd5(), db_flags_raw_internal(), db_update_nref(), nmg_stash_model_to_file(), rt_arb_import(), rt_arb_import5(), rt_arbn_import(), rt_arbn_import5(), rt_ars_import(), rt_ars_import5(), rt_ars_prep(), rt_bot_import(), rt_bot_import5(), rt_bot_xform(), rt_cline_import(), rt_cline_import5(), rt_comb_import5(), rt_comb_make(), rt_db_external5_to_internal5(), rt_db_put_internal(), rt_dsp_import(), rt_dsp_import5(), rt_dsp_make(), rt_ebm_import(), rt_ebm_import5(), rt_ebm_make(), rt_ehy_import(), rt_ehy_import5(), rt_ell_import(), rt_ell_import5(), rt_epa_import(), rt_epa_import5(), rt_eto_import(), rt_eto_import5(), rt_extrude_ifree(), rt_extrude_import(), rt_extrude_import5(), rt_extrude_xform(), rt_generic_make(), rt_grp_import(), rt_grp_import5(), rt_hf_import(), rt_hf_to_dsp(), rt_hlf_import(), rt_hlf_import5(), rt_metaball_import5(), rt_nmg_make(), rt_nurb_import(), rt_nurb_import5(), rt_part_import(), rt_part_import5(), rt_pg_import(), rt_pipe_import(), rt_pipe_import5(), rt_rhc_import(), rt_rhc_import5(), rt_rpc_import(), rt_rpc_import5(), rt_sketch_import(), rt_sketch_import5(), rt_submodel_import(), rt_submodel_import5(), rt_superell_import(), rt_superell_import5(), rt_tgc_import(), rt_tgc_import5(), rt_tor_import(), rt_tor_import5(), rt_vol_import(), rt_vol_import5(), rt_xxx_import(), rt_xxx_import5(), wdb_bot_decimate_cmd(), wdb_combadd(), wdb_export(), wdb_facetize_cmd(), wdb_get_type_cmd(), wdb_make_bb_cmd(), wdb_move_all_cmd(), wdb_move_arb_edge_cmd(), wdb_move_arb_face_cmd(), wdb_nmg_simplify_cmd(), wdb_node_write(), wdb_rotate_arb_face_cmd(), and wdb_shells_cmd().

#define DB5_MAJORTYPE_ATTRIBUTE_ONLY   2
 

Definition at line 122 of file db5.h.

Referenced by db5_diradd(), db5_fwrite_ident(), db5_update_ident(), db_create_inmem(), db_diradd5(), db_dirbuild(), wdb_concat_cmd(), wdb_dir_check5(), wdb_do_list(), and wdb_vls_long_dpp().

#define DB5_MAJORTYPE_BINARY_MASK   0x18
 

Definition at line 123 of file db5.h.

Referenced by wdb_binary_cmd().

#define DB5_MAJORTYPE_BINARY_EXPM   8
 

Definition at line 124 of file db5.h.

Referenced by db5_diradd(), db_diradd5(), rt_bin_import5(), and wdb_vls_long_dpp().

#define DB5_MAJORTYPE_BINARY_UNIF   9
 

Definition at line 125 of file db5.h.

Referenced by db5_diradd(), db_diradd5(), rt_bin_import5(), rt_binunif_import5(), rt_binunif_make(), rt_db_external5_to_internal5(), rt_mk_binunif(), rt_retrieve_binunif(), wdb_binary_cmd(), and wdb_vls_long_dpp().

#define DB5_MAJORTYPE_BINARY_MIME   10
 

Definition at line 126 of file db5.h.

Referenced by db5_diradd(), db_diradd5(), rt_bin_import5(), and wdb_vls_long_dpp().

#define DB5_MINORTYPE_RESERVED   0
 

Definition at line 132 of file db5.h.

#define DB5_MINORTYPE_BRLCAD_TOR   1
 

Definition at line 133 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_TGC   2
 

Definition at line 134 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_ELL   3
 

Definition at line 135 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_ARB8   4
 

Definition at line 136 of file db5.h.

Referenced by wdb_get_type_cmd(), wdb_move_arb_edge_cmd(), wdb_move_arb_face_cmd(), and wdb_rotate_arb_face_cmd().

#define DB5_MINORTYPE_BRLCAD_ARS   5
 

Definition at line 137 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_HALF   6
 

Definition at line 138 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_REC   7
 

Definition at line 139 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_POLY   8
 

Definition at line 140 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_BSPLINE   9
 

Definition at line 141 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_SPH   10
 

Definition at line 142 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_NMG   11
 

Definition at line 143 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_EBM   12
 

Definition at line 144 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_VOL   13
 

Definition at line 145 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_ARBN   14
 

Definition at line 146 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_PIPE   15
 

Definition at line 147 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_PARTICLE   16
 

Definition at line 148 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_RPC   17
 

Definition at line 149 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_RHC   18
 

Definition at line 150 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_EPA   19
 

Definition at line 151 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_EHY   20
 

Definition at line 152 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_ETO   21
 

Definition at line 153 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_GRIP   22
 

Definition at line 154 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_JOINT   23
 

Definition at line 155 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_HF   24
 

Definition at line 156 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_DSP   25
 

Definition at line 157 of file db5.h.

Referenced by wdb_get_type_cmd(), and wdb_node_write().

#define DB5_MINORTYPE_BRLCAD_SKETCH   26
 

Definition at line 158 of file db5.h.

Referenced by wdb_get_type_cmd(), and wdb_move_all_cmd().

#define DB5_MINORTYPE_BRLCAD_EXTRUDE   27
 

Definition at line 159 of file db5.h.

Referenced by db_update_nref(), wdb_get_type_cmd(), wdb_move_all_cmd(), and wdb_node_write().

#define DB5_MINORTYPE_BRLCAD_SUBMODEL   28
 

Definition at line 160 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_CLINE   29
 

Definition at line 161 of file db5.h.

Referenced by wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_BOT   30
 

Definition at line 162 of file db5.h.

Referenced by wdb_bot_decimate_cmd(), and wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_COMBINATION   31
 

Definition at line 163 of file db5.h.

Referenced by db_flags_raw_internal(), and wdb_get_type_cmd().

#define DB5_MINORTYPE_BRLCAD_SUPERELL   32
 

Definition at line 164 of file db5.h.

#define DB5_MINORTYPE_BRLCAD_METABALL   33
 

Definition at line 165 of file db5.h.

#define DB5_MINORTYPE_BINU_WID_MASK   0x30
 

Definition at line 168 of file db5.h.

Referenced by rt_binunif_describe().

#define DB5_MINORTYPE_BINU_SGN_MASK   0x08
 

Definition at line 169 of file db5.h.

#define DB5_MINORTYPE_BINU_ATM_MASK   0x07
 

Definition at line 170 of file db5.h.

Referenced by rt_binunif_describe().

#define DB5_MINORTYPE_BINU_FLOAT   0x02
 

Definition at line 171 of file db5.h.

Referenced by db5_type_sizeof_h_binu(), db5_type_sizeof_n_binu(), rt_binunif_describe(), rt_binunif_export5(), rt_binunif_import5(), rt_retrieve_binunif(), and wdb_binary_cmd().

#define DB5_MINORTYPE_BINU_DOUBLE   0x03
 

Definition at line 172 of file db5.h.

Referenced by db5_type_sizeof_h_binu(), db5_type_sizeof_n_binu(), rt_binunif_describe(), rt_binunif_export5(), rt_binunif_import5(), rt_retrieve_binunif(), and wdb_binary_cmd().

#define DB5_MINORTYPE_BINU_8BITINT_U   0x04
 

Definition at line 173 of file db5.h.

Referenced by db5_type_sizeof_h_binu(), db5_type_sizeof_n_binu(), rt_binunif_describe(), rt_binunif_export5(), rt_binunif_import5(), rt_retrieve_binunif(), and wdb_binary_cmd().

#define DB5_MINORTYPE_BINU_16BITINT_U   0x05
 

Definition at line 174 of file db5.h.

Referenced by db5_type_sizeof_h_binu(), db5_type_sizeof_n_binu(), rt_binunif_describe(), rt_binunif_export5(), rt_binunif_import5(), rt_retrieve_binunif(), and wdb_binary_cmd().

#define DB5_MINORTYPE_BINU_32BITINT_U   0x06
 

Definition at line 175 of file db5.h.

Referenced by db5_type_sizeof_h_binu(), db5_type_sizeof_n_binu(), rt_binunif_describe(), rt_binunif_export5(), rt_binunif_import5(), rt_retrieve_binunif(), and wdb_binary_cmd().

#define DB5_MINORTYPE_BINU_64BITINT_U   0x07
 

Definition at line 176 of file db5.h.

Referenced by db5_type_sizeof_h_binu(), db5_type_sizeof_n_binu(), rt_binunif_describe(), rt_binunif_export5(), rt_retrieve_binunif(), and wdb_binary_cmd().

#define DB5_MINORTYPE_BINU_8BITINT   0x0c
 

Definition at line 177 of file db5.h.

Referenced by db5_type_sizeof_h_binu(), db5_type_sizeof_n_binu(), rt_binunif_describe(), rt_binunif_export5(), rt_binunif_import5(), rt_binunif_make(), rt_retrieve_binunif(), and wdb_binary_cmd().

#define DB5_MINORTYPE_BINU_16BITINT   0x0d
 

Definition at line 178 of file db5.h.

Referenced by db5_type_sizeof_h_binu(), db5_type_sizeof_n_binu(), rt_binunif_describe(), rt_binunif_export5(), rt_binunif_import5(), rt_retrieve_binunif(), and wdb_binary_cmd().

#define DB5_MINORTYPE_BINU_32BITINT   0x0e
 

Definition at line 179 of file db5.h.

Referenced by db5_type_sizeof_h_binu(), db5_type_sizeof_n_binu(), rt_binunif_describe(), rt_binunif_export5(), rt_binunif_import5(), rt_retrieve_binunif(), and wdb_binary_cmd().

#define DB5_MINORTYPE_BINU_64BITINT   0x0f
 

Definition at line 180 of file db5.h.

Referenced by db5_type_sizeof_h_binu(), db5_type_sizeof_n_binu(), rt_binunif_describe(), rt_binunif_export5(), rt_binunif_tcladjust(), rt_retrieve_binunif(), and wdb_binary_cmd().

#define DB5_RAW_INTERNAL_MAGIC   0x64357269
 

Definition at line 212 of file db5.h.

Referenced by db5_scan().

#define RT_CK_RIP _ptr   )     BU_CKMAG( _ptr, DB5_RAW_INTERNAL_MAGIC, "db5_raw_internal" )
 

Definition at line 213 of file db5.h.

Referenced by wdb_dir_check5().


Function Documentation

unsigned char * db5_encode_length unsigned char *  cp,
long  val,
int  format
 

D B 5 _ E N C O D E _ L E N G T H

Given a value and a variable-width format spec, store it in network order (XDR).

Returns - pointer to next available byte.

Definition at line 215 of file db5_io.c.

References bu_bomb(), bu_plong(), bu_pshort(), DB5HDR_WIDTHCODE_16BIT, DB5HDR_WIDTHCODE_32BIT, DB5HDR_WIDTHCODE_64BIT, and DB5HDR_WIDTHCODE_8BIT.

Referenced by db5_export_object3(), db5_make_free_object(), db5_make_free_object_hdr(), rt_comb_export5(), and rt_comb_v5_serialize().

Here is the call graph for this function:

const unsigned char * db5_get_raw_internal_ptr struct db5_raw_internal rip,
const unsigned char *  ip
 

D B 5 _ G E T _ R A W _ I N T E R N A L _ P T R

Returns - on success, pointer to first unused byte NULL, on error

Definition at line 309 of file db5_io.c.

References db5_raw_internal::a_present, db5_raw_internal::a_width, db5_raw_internal::attributes, db5_raw_internal::b_present, db5_raw_internal::b_width, db5_raw_internal::body, BU_INIT_EXTERNAL, bu_log(), db5_raw_internal::buf, db5_crack_disk_header(), db5_decode_length(), DB5HDR_MAGIC2, bu_external::ext_buf, bu_external::ext_nbytes, db5_raw_internal::h_name_present, db5_raw_internal::h_name_width, db5_raw_internal::h_object_width, db5_raw_internal::name, NULL, and db5_raw_internal::object_length.

Referenced by db5_get_attributes(), db5_replace_attributes(), db5_scan(), db5_update_attributes(), db_dirbuild(), db_wrap_v5_external(), rt_db_external5_to_internal5(), and rt_retrieve_binunif().

Here is the call graph for this function:

int db5_write_free struct db_i dbip,
struct directory dp,
long  length
 

D B 5 _ W R I T E _ F R E E

Create a v5 database "free" object of the specified size, and place it at the indicated location in the database.

There are two interesting cases:

  • The free object is "small". Just write it all at once.
  • The free object is "large". Write header and trailer separately

Returns:
0 OK

-1 Fail. This is a horrible error.

Definition at line 76 of file db5_alloc.c.

References bcopy, bu_free_external(), BU_INIT_EXTERNAL, directory::d_flags, directory::d_un, db5_make_free_object(), db5_make_free_object_hdr(), DB5HDR_MAGIC2, db_write(), bu_external::ext_buf, bu_external::ext_nbytes, directory::ptr, RT_CK_DBI, RT_CK_DIR, and RT_DIR_INMEM.

Referenced by db5_realloc(), and db_delete().

Here is the call graph for this function:

int db5_realloc struct db_i dbip,
struct directory dp,
struct bu_external ep
 

D B 5 _ R E A L L O C

Change the size of a v5 database object.

If the object is getting smaller, break it into two pieces, and write out free objects for both. The caller is expected to re-write new data on the first one.

If the object is getting larger, seek a suitable "hole" large enough to hold it, throwing back any surplus, properly marked.

If the object is getting larger and there is no suitable "hole" in the database, extend the file, write a free object in the new space, and write a free object in the old space.

There is no point to trying to extend in place, that would require two searches through the memory map, and doesn't save any disk I/O.

Returns - 0 OK -1 Failure

Definition at line 154 of file db5_alloc.c.

References BU_ASSERT_LONG, BU_CK_EXTERNAL, bu_log(), bu_malloc(), bu_realloc(), directory::d_flags, directory::d_len, directory::d_namep, directory::d_un, db5_write_free(), db_i::dbi_eof, db_i::dbi_freep, db_i::dbi_read_only, DEBUG_DB, bu_external::ext_nbytes, mem_map::m_addr, mem_map::m_size, MAP_NULL, directory::ptr, RT_CK_DBI, RT_CK_DIR, RT_DIR_INMEM, RT_G_DEBUG, rt_memalloc_nosplit(), and rt_memfree().

Referenced by db_put_external5(), and rt_db_put_internal5().

Here is the call graph for this function:

int db5_header_is_valid const unsigned char *  hp  ) 
 

D B 5 _ H E A D E R _ I S _ V A L I D

Verify that this is a valid header for a BRL-CAD v5 database.

Returns - 0 Not valid v5 header 1 Valid v5 header

Definition at line 79 of file db5_io.c.

References DB5_MAJORTYPE_RESERVED, DB5_ZZZ_UNCOMPRESSED, db5_ondisk_header::db5h_aflags, db5_ondisk_header::db5h_bflags, db5_ondisk_header::db5h_hflags, db5_ondisk_header::db5h_magic1, db5_ondisk_header::db5h_major_type, db5_ondisk_header::db5h_minor_type, DB5HDR_AFLAGS_PRESENT, DB5HDR_AFLAGS_WIDTH_MASK, DB5HDR_AFLAGS_WIDTH_SHIFT, DB5HDR_AFLAGS_ZZZ_MASK, DB5HDR_BFLAGS_PRESENT, DB5HDR_BFLAGS_WIDTH_MASK, DB5HDR_BFLAGS_WIDTH_SHIFT, DB5HDR_BFLAGS_ZZZ_MASK, DB5HDR_HFLAGS_DLI_HEADER_OBJECT, DB5HDR_HFLAGS_DLI_MASK, DB5HDR_HFLAGS_NAME_PRESENT, DB5HDR_HFLAGS_OBJECT_WIDTH_MASK, DB5HDR_HFLAGS_OBJECT_WIDTH_SHIFT, DB5HDR_MAGIC1, DB5HDR_MAGIC2, and DB5HDR_WIDTHCODE_8BIT.

Referenced by db5_scan(), db_dirbuild(), and db_get_version().

int db5_select_length_encoding long int  len  ) 
 

D B 5 _ S E L E C T _ L E N G T H _ E N C O D I N G

Given a number to encode, decide which is the smallest encoding format which will contain it.

Definition at line 122 of file db5_io.c.

References DB5HDR_WIDTHCODE_16BIT, DB5HDR_WIDTHCODE_32BIT, DB5HDR_WIDTHCODE_64BIT, and DB5HDR_WIDTHCODE_8BIT.

int db5_decode_length long int *  lenp,
const unsigned char *  cp,
int  format
 

D B 5 _ D E C O D E _ L E N G T H

Given a variable-width length field in network order (XDR), store it in *lenp.

This routine processes unsigned values.

Returns - The number of bytes of input that were decoded.

Definition at line 142 of file db5_io.c.

References bu_bomb(), BU_GLONG, BU_GLONGLONG, BU_GSHORT, DB5HDR_WIDTHCODE_16BIT, DB5HDR_WIDTHCODE_32BIT, DB5HDR_WIDTHCODE_64BIT, and DB5HDR_WIDTHCODE_8BIT.

Here is the call graph for this function:

int db5_decode_signed long int *  lenp,
const unsigned char *  cp,
int  format
 

D B 5 _ D E C O D E _ S I G N E D

Given a variable-width length field in network order (XDR), store it in *lenp.

This routine processes signed values.

Returns - The number of bytes of input that were decoded.

Definition at line 179 of file db5_io.c.

References bu_bomb(), BU_GLONG, BU_GLONGLONG, BU_GSHORT, DB5HDR_WIDTHCODE_16BIT, DB5HDR_WIDTHCODE_32BIT, DB5HDR_WIDTHCODE_64BIT, and DB5HDR_WIDTHCODE_8BIT.

Here is the call graph for this function:

int db5_crack_disk_header struct db5_raw_internal rip,
const unsigned char *  cp
 

D B 5 _ C R A C K _ D I S K _ H E A D E R

Returns - 0 on success -1 on error

Definition at line 245 of file db5_io.c.

References db5_raw_internal::a_present, db5_raw_internal::a_width, db5_raw_internal::a_zzz, db5_raw_internal::b_present, db5_raw_internal::b_width, db5_raw_internal::b_zzz, bu_log(), DB5HDR_AFLAGS_PRESENT, DB5HDR_AFLAGS_WIDTH_MASK, DB5HDR_AFLAGS_WIDTH_SHIFT, DB5HDR_AFLAGS_ZZZ_MASK, DB5HDR_BFLAGS_PRESENT, DB5HDR_BFLAGS_WIDTH_MASK, DB5HDR_BFLAGS_WIDTH_SHIFT, DB5HDR_BFLAGS_ZZZ_MASK, DB5HDR_HFLAGS_DLI_MASK, DB5HDR_HFLAGS_HIDDEN_OBJECT, DB5HDR_HFLAGS_NAME_PRESENT, DB5HDR_HFLAGS_NAME_WIDTH_MASK, DB5HDR_HFLAGS_NAME_WIDTH_SHIFT, DB5HDR_HFLAGS_OBJECT_WIDTH_MASK, DB5HDR_HFLAGS_OBJECT_WIDTH_SHIFT, DB5HDR_MAGIC1, DEBUG_DB, db5_raw_internal::h_dli, db5_raw_internal::h_name_hidden, db5_raw_internal::h_name_present, db5_raw_internal::h_name_width, db5_raw_internal::h_object_width, db5_raw_internal::major_type, db5_raw_internal::minor_type, and RT_G_DEBUG.

Referenced by db5_get_raw_internal_fp(), and db5_get_raw_internal_ptr().

Here is the call graph for this function:

int db5_get_raw_internal_fp struct db5_raw_internal rip,
FILE *  fp
 

D B 5 _ G E T _ R A W _ I N T E R N A L _ F P

Returns - 0 on success -1 on EOF -2 on error

Definition at line 374 of file db5_io.c.

References db5_raw_internal::a_present, db5_raw_internal::a_width, db5_raw_internal::attributes, db5_raw_internal::b_present, db5_raw_internal::b_width, bcopy, db5_raw_internal::body, BU_ASSERT_LONG, BU_INIT_EXTERNAL, bu_log(), bu_malloc(), db5_raw_internal::buf, db5_crack_disk_header(), db5_decode_length(), DB5HDR_MAGIC2, DB5HDR_WIDTHCODE_16BIT, DB5HDR_WIDTHCODE_32BIT, DB5HDR_WIDTHCODE_64BIT, DB5HDR_WIDTHCODE_8BIT, bu_external::ext_buf, bu_external::ext_nbytes, db5_raw_internal::h_name_present, db5_raw_internal::h_name_width, db5_raw_internal::h_object_width, db5_raw_internal::name, and db5_raw_internal::object_length.

Referenced by db5_scan().

Here is the call graph for this function:

void db5_export_object3 struct bu_external out,
int  dli,
const char *  name,
const unsigned char  hidden,
const struct bu_external attrib,
const struct bu_external body,
int  major,
int  minor,
int  a_zzz,
int  b_zzz
 

D B 5 _ E X P O R T _ O B J E C T 3

A routine for merging together the three optional parts of an object into the final on-disk format. Results in extra data copies, but serves as a starting point for testing. Any of name, attrib, and body may be null.

Definition at line 480 of file db5_io.c.

References bcopy, body, BU_ASSERT_LONG, BU_ASSERT_PTR, bu_bomb(), BU_CK_EXTERNAL, BU_EXTERNAL_MAGIC, bu_malloc(), db5_enc_len, db5_encode_length(), db5_select_length_encoding(), db5_ondisk_header::db5h_aflags, db5_ondisk_header::db5h_bflags, db5_ondisk_header::db5h_hflags, db5_ondisk_header::db5h_magic1, db5_ondisk_header::db5h_major_type, db5_ondisk_header::db5h_minor_type, DB5HDR_AFLAGS_PRESENT, DB5HDR_AFLAGS_WIDTH_SHIFT, DB5HDR_AFLAGS_ZZZ_MASK, DB5HDR_BFLAGS_PRESENT, DB5HDR_BFLAGS_WIDTH_SHIFT, DB5HDR_BFLAGS_ZZZ_MASK, DB5HDR_HFLAGS_DLI_MASK, DB5HDR_HFLAGS_HIDDEN_OBJECT, DB5HDR_HFLAGS_NAME_PRESENT, DB5HDR_HFLAGS_NAME_WIDTH_SHIFT, DB5HDR_HFLAGS_OBJECT_WIDTH_SHIFT, DB5HDR_MAGIC1, DB5HDR_MAGIC2, bu_external::ext_buf, bu_external::ext_magic, bu_external::ext_nbytes, and NULL.

Referenced by db5_fwrite_ident(), db5_replace_attributes(), db5_update_attributes(), db5_update_ident(), db_create_inmem(), and db_wrap_v5_external().

Here is the call graph for this function:

void db5_make_free_object_hdr struct bu_external ep,
long  length
 

D B 5 _ M A K E _ F R E E _ O B J E C T _ H D R

Make only the front (header) portion of a free object. This is used when operating on very large contiguous free objects in the database (e.g. 50 MBytes).

Definition at line 639 of file db5_io.c.

References BU_ASSERT_LONG, bu_calloc(), BU_CK_EXTERNAL, db5_encode_length(), db5_select_length_encoding(), db5_ondisk_header::db5h_hflags, db5_ondisk_header::db5h_magic1, DB5HDR_HFLAGS_DLI_FREE_STORAGE, DB5HDR_HFLAGS_OBJECT_WIDTH_SHIFT, DB5HDR_MAGIC1, bu_external::ext_buf, and bu_external::ext_nbytes.

Referenced by db5_write_free().

Here is the call graph for this function:

void db5_make_free_object struct bu_external ep,
long  length
 

D B 5 _ M A K E _ F R E E _ O B J E C T

Make a complete, zero-filled, free object. Note that free objects can sometimes get quite large.

Definition at line 674 of file db5_io.c.

References BU_ASSERT_LONG, bu_calloc(), BU_CK_EXTERNAL, db5_encode_length(), db5_select_length_encoding(), db5_ondisk_header::db5h_hflags, db5_ondisk_header::db5h_magic1, DB5HDR_HFLAGS_DLI_FREE_STORAGE, DB5HDR_HFLAGS_OBJECT_WIDTH_SHIFT, DB5HDR_MAGIC1, DB5HDR_MAGIC2, bu_external::ext_buf, and bu_external::ext_nbytes.

Referenced by db5_write_free().

Here is the call graph for this function:

int db5_import_attributes struct bu_attribute_value_set avs,
const struct bu_external ap
 

D B 5 _ I M P O R T _ A T T R I B U T E S

Convert the on-disk encoding into a handy easy-to-use bu_attribute_value_set structure. Take advantage of the readonly_min/readonly_max capability so that we don't have to bu_strdup() each string, but can simply point to it in the provided buffer *ap. Important implication: don't free *ap until you're done with this avs.

The upshot of this is that bu_avs_add() and bu_avs_remove() can be safely used with this *avs.

Returns - >0 count of attributes successfully imported -1 Error, mal-formed input

Definition at line 722 of file db5_io.c.

References bu_attribute_value_set::avp, BU_ASSERT_LONG, BU_ASSERT_PTR, bu_avs_add(), bu_avs_init(), bu_avs_print(), BU_CK_EXTERNAL, bu_debug, BU_DEBUG_AVS, bu_log(), bu_attribute_value_set::count, bu_external::ext_buf, bu_external::ext_nbytes, bu_attribute_value_set::max, bu_attribute_value_pair::name, name, bu_attribute_value_set::readonly_max, bu_attribute_value_set::readonly_min, and bu_attribute_value_pair::value.

Referenced by db5_diradd(), db5_get_attributes(), db5_update_attributes(), db_dirbuild(), db_flags_raw_internal(), and rt_db_external5_to_internal5().

Here is the call graph for this function:

void db5_export_attributes struct bu_external ext,
const struct bu_attribute_value_set avs
 

D B 5 _ E X P O R T _ A T T R I B U T E S

Encode the attribute-value pair information into the external on-disk format.

The on-disk encoding is:

aname1 NULL value1 NULL ... anameN NULL valueN NULL NULL

'ext' is initialized on behalf of the caller.

Definition at line 820 of file db5_io.c.

References bu_attribute_value_set::avp, bu_avs_print(), BU_CK_AVS, bu_debug, BU_DEBUG_AVS, BU_INIT_EXTERNAL, bu_attribute_value_set::count, bu_attribute_value_pair::name, and bu_attribute_value_pair::value.

Referenced by db5_fwrite_ident(), db5_replace_attributes(), db5_update_attributes(), and db_create_inmem().

Here is the call graph for this function:

int db5_replace_attributes struct directory dp,
struct bu_attribute_value_set avsp,
struct db_i dbip
 

D B 5 _ R E P L A C E _ A T T R I B U T E S

Replace the attributes of a given database object. For efficiency, this is done without looking at the object body at all.

Contents of the bu_attribute_value_set are freed, but not the struct itself.

Returns - 0 on success <0 on error

Definition at line 876 of file db5_io.c.

References db5_raw_internal::a_zzz, db5_raw_internal::b_zzz, db5_raw_internal::body, BU_ASSERT_LONG, bu_avs_free(), bu_avs_print(), BU_CK_AVS, bu_free_external(), BU_INIT_EXTERNAL, bu_log(), directory::d_namep, db5_export_attributes(), db5_export_object3(), db5_get_raw_internal_ptr(), db_get_external(), db_put_external5(), db_i::dbi_filename, db_i::dbi_read_only, db_i::dbi_version, DEBUG_DB, bu_external::ext_buf, db5_raw_internal::h_dli, db5_raw_internal::h_name_hidden, db5_raw_internal::major_type, db5_raw_internal::minor_type, NULL, RT_CK_DBI, RT_CK_DIR, and RT_G_DEBUG.

Here is the call graph for this function:

int db5_update_attributes struct directory dp,
struct bu_attribute_value_set avsp,
struct db_i dbip
 

D B 5 _ U P D A T E _ A T T R I B U T E S

Update an arbitrary number of attributes on a given database object. For efficiency, this is done without looking at the object body at all.

Contents of the bu_attribute_value_set are freed, but not the struct itself.

Returns - 0 on success <0 on error

Definition at line 949 of file db5_io.c.

References db5_raw_internal::a_zzz, db5_raw_internal::attributes, db5_raw_internal::b_zzz, db5_raw_internal::body, BU_ASSERT_LONG, bu_avs_free(), bu_avs_init(), bu_avs_merge(), bu_avs_print(), BU_CK_AVS, bu_free_external(), BU_INIT_EXTERNAL, bu_log(), directory::d_namep, db5_export_attributes(), db5_export_object3(), db5_get_raw_internal_ptr(), db5_import_attributes(), db_get_external(), db_put_external5(), db_i::dbi_filename, db_i::dbi_read_only, db_i::dbi_version, DEBUG_DB, bu_external::ext_buf, db5_raw_internal::h_dli, db5_raw_internal::h_name_hidden, db5_raw_internal::major_type, db5_raw_internal::minor_type, NULL, RT_CK_DBI, RT_CK_DIR, and RT_G_DEBUG.

Referenced by db5_update_attribute(), and db5_update_ident().

Here is the call graph for this function:

int db5_update_attribute const char *  obj_name,
const char *  aname,
const char *  value,
struct db_i dbip
 

D B 5 _ U P D A T E _ A T T R I B U T E

A convenience routine to update the value of a single attribute.

Returns - 0 on success <0 on error

Definition at line 1033 of file db5_io.c.

References bu_avs_add(), bu_avs_init(), db5_update_attributes(), db_lookup(), DIR_NULL, LOOKUP_NOISY, and RT_CK_DBI.

Referenced by db5_put_color_table(), and wdb_color_cmd().

Here is the call graph for this function:

int db5_update_ident struct db_i dbip,
const char *  title,
double  local2mm
 

D B 5 _ U P D A T E _ I D E N T

Update the _GLOBAL object, which in v5 serves the place of the "ident" header record in v4 as the place to stash global information. Since every database will have one of these things, it's no problem to update it.

Returns - 0 Success -1 Fatal Error

Definition at line 1060 of file db5_io.c.

References bu_avs_add(), bu_avs_init(), bu_free(), bu_free_external(), bu_log(), bu_strdup, bu_vls_addr(), bu_vls_free(), bu_vls_init(), bu_vls_printf(), directory::d_major_type, db5_export_object3(), DB5_GLOBAL_OBJECT_NAME, DB5_MAJORTYPE_ATTRIBUTE_ONLY, db5_update_attributes(), DB5_ZZZ_UNCOMPRESSED, DB5HDR_HFLAGS_DLI_APPLICATION_DATA_OBJECT, DB5HDR_HFLAGS_HIDDEN_OBJECT, db_diradd(), db_lookup(), db_put_external(), db_i::dbi_title, DIR_NULL, LOOKUP_QUIET, NULL, RT_CK_DBI, and units.

Referenced by db_dirbuild(), and db_update_ident().

Here is the call graph for this function:

int db5_fwrite_ident FILE *  fp,
const char *  title,
double  local2mm
 

D B 5 _ F W R I T E _ I D E N T

Create a header for a v5 database. This routine has the same calling sequence as db_fwrite_ident() which makes a v4 database header.

In the v5 database, two database objects must be created to match the semantics of what was in the v4 header:

First, a database header object.

Second, create a specially named attribute-only object which contains the attributes "title=" and "units=".

This routine should only be used by db_create(). Everyone else should use db5_update_ident().

Returns - 0 Success -1 Fatal Error

Definition at line 1140 of file db5_io.c.

References bu_avs_add(), bu_avs_free(), bu_avs_init(), bu_free_external(), bu_fwrite_external(), bu_log(), bu_vls_addr(), bu_vls_free(), bu_vls_init(), bu_vls_printf(), db5_export_attributes(), db5_export_object3(), DB5_GLOBAL_OBJECT_NAME, DB5_MAJORTYPE_ATTRIBUTE_ONLY, DB5_MAJORTYPE_RESERVED, DB5_ZZZ_UNCOMPRESSED, DB5HDR_HFLAGS_DLI_APPLICATION_DATA_OBJECT, DB5HDR_HFLAGS_DLI_HEADER_OBJECT, DB5HDR_HFLAGS_HIDDEN_OBJECT, NULL, and units.

Referenced by db_create().

Here is the call graph for this function:

int rt_db_cvt_to_external5 struct bu_external ext,
const char *  name,
const struct rt_db_internal ip,
double  conv2mm,
struct db_i dbip,
struct resource resp,
const int  major
 

R T _ D B _ C V T _ T O _ E X T E R N A L 5

The attributes are taken from ip->idb_avs

If present, convert attributes to on-disk format. This must happen after exporting the body, in case the ft_export5() method happened to extend the attribute set. Combinations are one "solid" which does this.

The internal representation is NOT freed, that's the caller's job.

The 'ext' pointer is accepted in uninitialized form, and an initialized structure is always returned, so that the caller may free it even when an error return is given.

Returns - 0 OK -1 FAIL

Definition at line 1213 of file db5_io.c.

References body, bu_free_external(), BU_INIT_EXTERNAL, bu_log(), rt_db_internal::idb_meth, RT_CK_DB_INTERNAL, RT_CK_DBI, and RT_CK_RESOURCE.

Referenced by nmg_stash_model_to_file(), rt_db_put_internal5(), and wdb_put_internal().

Here is the call graph for this function:

int db_wrap_v5_external struct bu_external ep,
const char *  name
 

Definition at line 1268 of file db5_io.c.

References db5_raw_internal::a_zzz, db5_raw_internal::attributes, db5_raw_internal::b_zzz, db5_raw_internal::body, BU_ASSERT_LONG, BU_CK_EXTERNAL, bu_free_external(), BU_INIT_EXTERNAL, bu_log(), db5_export_object3(), db5_get_raw_internal_ptr(), DB5HDR_HFLAGS_DLI_APPLICATION_DATA_OBJECT, bu_external::ext_buf, db5_raw_internal::h_dli, db5_raw_internal::h_name_hidden, db5_raw_internal::major_type, db5_raw_internal::minor_type, db5_raw_internal::name, and NULL.

Referenced by db_put_external5(), and wdb_export_external().

Here is the call graph for this function:

int db_put_external5 struct bu_external ep,
struct directory dp,
struct db_i dbip
 

D B _ P U T _ E X T E R N A L 5

Given that caller already has an external representation of the database object, update it to have a new name (taken from dp->d_namep) in that external representation, and write the new object into the database, obtaining different storage if the size has changed.

Changing the name on a v5 object is a relatively expensive operation.

Caller is responsible for freeing memory of external representation, using bu_free_external().

This routine is used to efficiently support MGED's "cp" and "keep" commands, which don't need to import and decompress objects just to rename and copy them.

Returns - -1 error 0 success

Definition at line 1334 of file db5_io.c.

References bcopy, BU_ASSERT_LONG, BU_CK_EXTERNAL, bu_log(), directory::d_flags, directory::d_len, directory::d_namep, directory::d_un, db5_realloc(), db_wrap_v5_external(), db_write(), db_i::dbi_filename, db_i::dbi_read_only, db_i::dbi_version, DEBUG_DB, bu_external::ext_buf, bu_external::ext_nbytes, directory::ptr, RT_CK_DBI, RT_CK_DIR, RT_DIR_INMEM, and RT_G_DEBUG.

Referenced by db5_replace_attributes(), db5_update_attributes(), and db_put_external().

Here is the call graph for this function:

int rt_db_put_internal5 struct directory dp,
struct db_i dbip,
struct rt_db_internal ip,
struct resource resp,
const int  major
 

R T _ D B _ P U T _ I N T E R N A L 5

Convert the internal representation of a solid to the external one, and write it into the database.

Applications and middleware shouldn't call this directly, they should use the version-generic interface "rt_db_put_internal()".

The internal representation is always freed. (Not the pointer, just the contents).

Returns - <0 error 0 success

Definition at line 1395 of file db5_io.c.

References bcopy, BU_ASSERT_LONG, BU_CK_EXTERNAL, bu_free_external(), bu_log(), directory::d_flags, directory::d_len, directory::d_namep, directory::d_un, db5_realloc(), db_write(), db_i::dbi_version, bu_external::ext_buf, bu_external::ext_nbytes, directory::ptr, RT_CK_DB_INTERNAL, RT_CK_DBI, RT_CK_DIR, RT_CK_RESOURCE, rt_db_cvt_to_external5(), rt_db_free_internal(), and RT_DIR_INMEM.

Referenced by rt_db_put_internal().

Here is the call graph for this function:

int rt_db_external5_to_internal5 struct rt_db_internal ip,
const struct bu_external ep,
const char *  name,
const struct db_i dbip,
const mat_t  mat,
struct resource resp
 

R T _ D B _ E X T E R N A L 5 _ T O _ I N T E R N A L 5

Given an object in external form, convert it to internal form. The caller is responsible for freeing the external form.

Returns - <0 On error id On success.

Definition at line 1456 of file db5_io.c.

References db5_raw_internal::attributes, bn_mat_identity, db5_raw_internal::body, BU_ASSERT_LONG, bu_avs_init_empty(), BU_AVS_MAGIC, BU_CK_EXTERNAL, bu_log(), db5_get_raw_internal_ptr(), db5_import_attributes(), DB5_MAJORTYPE_BINARY_UNIF, DB5_MAJORTYPE_BRLCAD, db_i::dbi_version, bu_external::ext_buf, ID_BINUNIF, rt_db_internal::idb_avs, bu_attribute_value_set::magic, db5_raw_internal::major_type, db5_raw_internal::minor_type, NULL, RT_CK_DB_INTERNAL, RT_CK_DBI, and rt_db_free_internal().

Referenced by rt_db_get_internal5().

Here is the call graph for this function:

int rt_db_get_internal5 struct rt_db_internal ip,
const struct directory dp,
const struct db_i dbip,
const mat_t  mat,
struct resource resp
 

R T _ D B _ G E T _ I N T E R N A L 5

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

Applications and middleware shouldn't call this directly, they should use the generic interface "rt_db_get_internal()".

Returns - <0 On error id On success.

Definition at line 1553 of file db5_io.c.

References BU_ASSERT_LONG, bu_free_external(), BU_INIT_EXTERNAL, directory::d_namep, db_get_external(), db_i::dbi_version, rt_db_external5_to_internal5(), and RT_INIT_DB_INTERNAL.

Referenced by db_functree(), db_preorder_traverse(), rt_db_get_internal(), and rt_retrieve_binunif().

Here is the call graph for this function:

void db5_export_color_table struct bu_vls ostr,
struct db_i dbip
 

Definition at line 1580 of file db5_io.c.

References BU_CK_VLS, bu_vls_printf(), MATER_NULL, mater::mt_b, mater::mt_forw, mater::mt_g, mater::mt_high, mater::mt_low, mater::mt_r, RT_CK_DBI, and rt_material_head.

Referenced by db5_put_color_table().

Here is the call graph for this function:

void db5_import_color_table char *  cp  ) 
 

D B 5 _ I M P O R T _ C O L O R _ T A B L E

Definition at line 1602 of file db5_io.c.

References NULL, and rt_color_addrec().

Referenced by db_dirbuild().

Here is the call graph for this function:

int db5_put_color_table struct db_i dbip  ) 
 

D B 5 _ P U T _ C O L O R _ T A B L E

Put the old region-id-color-table into the global object. A null attribute is set if the material table is empty.

Returns - <0 error 0 OK

Definition at line 1625 of file db5_io.c.

References BU_ASSERT_LONG, bu_vls_addr(), bu_vls_free(), bu_vls_init(), db5_export_color_table(), DB5_GLOBAL_OBJECT_NAME, db5_update_attribute(), db_i::dbi_version, and RT_CK_DBI.

Here is the call graph for this function:

int db5_get_attributes const struct db_i dbip,
struct bu_attribute_value_set avs,
const struct directory dp
 

D B _ G E T _ A T T R I B U T E S

Get attributes for an object pointed to by *dp

returns: 0 - all is well <0 - error

Definition at line 1652 of file db5_io.c.

References db5_raw_internal::attributes, bu_free_external(), BU_INIT_EXTERNAL, db5_get_raw_internal_ptr(), db5_import_attributes(), db_get_external(), db_i::dbi_version, bu_external::ext_buf, NULL, RT_CK_DBI, and RT_CK_DIR.

Referenced by db_lookup_by_attr(), wdb_attr_cmd(), and wdb_do_list().

Here is the call graph for this function:

int db5_scan struct db_i dbip,
void(*)(struct db_i *, const struct db5_raw_internal *, long addr, genptr_t client_data)  handler,
genptr_t  client_data
 

D B 5 _ S C A N

Returns - 0 Success -1 Fatal Error

Definition at line 67 of file db5_scan.c.

References BU_ASSERT_LONG, BU_CK_MAPPED_FILE, bu_free(), bu_log(), bu_mapped_file::buflen, db5_get_raw_internal_fp(), db5_get_raw_internal_ptr(), db5_header_is_valid(), DB5_RAW_INTERNAL_MAGIC, db_i::dbi_eof, db_i::dbi_filename, db_i::dbi_fp, db_i::dbi_inmem, db_i::dbi_mf, DEBUG_DB, db5_raw_internal::magic, NULL, RT_CK_DBI, and RT_G_DEBUG.

Here is the call graph for this function:

struct directory* db_diradd5 struct db_i dbip,
const char *  name,
long  laddr,
unsigned char  major_type,
unsigned char  minor_type,
unsigned char  name_hidden,
long  object_length,
struct bu_attribute_value_set avs
 

Definition at line 145 of file db5_scan.c.

References bu_avs_get(), BU_LIST_INIT, bu_vls_addr(), bu_vls_free(), bu_vls_init(), bu_vls_strcpy(), bu_attribute_value_set::count, 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_un, directory::d_use_hd, directory::d_uses, DB5_MAJORTYPE_ATTRIBUTE_ONLY, DB5_MAJORTYPE_BINARY_EXPM, DB5_MAJORTYPE_BINARY_MIME, DB5_MAJORTYPE_BINARY_UNIF, DB5_MAJORTYPE_BRLCAD, db_dircheck(), DIR_COMB, DIR_HIDDEN, DIR_NON_GEOM, DIR_NULL, DIR_REGION, DIR_SOLID, directory::file_offset, ID_COMBINATION, NULL, directory::ptr, resource::re_magic, RT_CK_DBI, RT_CK_DIR, RT_DIR_SET_NAMEP, RT_GET_DIRECTORY, rt_init_resource(), and rt_uniresource.

Here is the call graph for this function:

struct directory* db5_diradd struct db_i dbip,
const struct db5_raw_internal rip,
long  laddr,
genptr_t  client_data
 

Definition at line 220 of file db5_scan.c.

References db5_raw_internal::attributes, bu_avs_free(), bu_avs_get(), bu_avs_init_empty(), BU_LIST_INIT, bu_log(), bu_vls_addr(), bu_vls_free(), bu_vls_init(), bu_vls_strcpy(), 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_un, directory::d_use_hd, directory::d_uses, db5_import_attributes(), DB5_MAJORTYPE_ATTRIBUTE_ONLY, DB5_MAJORTYPE_BINARY_EXPM, DB5_MAJORTYPE_BINARY_MIME, DB5_MAJORTYPE_BINARY_UNIF, DB5_MAJORTYPE_BRLCAD, db_dircheck(), DIR_COMB, DIR_HIDDEN, DIR_NON_GEOM, DIR_NULL, DIR_REGION, DIR_SOLID, bu_external::ext_buf, bu_external::ext_nbytes, directory::file_offset, db5_raw_internal::h_name_hidden, ID_COMBINATION, db5_raw_internal::major_type, db5_raw_internal::minor_type, db5_raw_internal::name, NULL, db5_raw_internal::object_length, resource::re_magic, RT_CK_DBI, RT_CK_DIR, RT_DIR_SET_NAMEP, RT_GET_DIRECTORY, rt_init_resource(), and rt_uniresource.

Referenced by db5_diradd_handler().

Here is the call graph for this function:

HIDDEN void db5_diradd_handler struct db_i dbip,
const struct db5_raw_internal rip,
long  laddr,
genptr_t  client_data
 

D B 5 _ D I R A D D _ H A N D L E R

In support of db5_scan, add a named entry to the directory.

Definition at line 304 of file db5_scan.c.

References bu_log(), db5_diradd(), DB5HDR_HFLAGS_DLI_FREE_STORAGE, DB5HDR_HFLAGS_DLI_HEADER_OBJECT, db_i::dbi_freep, DEBUG_DB, bu_external::ext_buf, db5_raw_internal::h_dli, db5_raw_internal::name, NULL, db5_raw_internal::object_length, RT_CK_DBI, RT_G_DEBUG, and rt_memfree().

Referenced by db_dirbuild().

Here is the call graph for this function:

int db_dirbuild struct db_i dbip  ) 
 

D B _ D I R B U I L D

A generic routine to determine the type of the database, (v4 or v5) and to invoke the appropriate db_scan()-like routine to build the in-memory directory.

It is the caller's responsibility to close the database in case of error.

Called from rt_dirbuild(), and g_submodel.c

Returns - 0 OK -1 failure

Definition at line 350 of file db5_scan.c.

References db5_raw_internal::attributes, bu_avs_free(), bu_avs_get(), bu_avs_init_empty(), BU_CK_AVS, bu_free_external(), BU_INIT_EXTERNAL, bu_log(), bu_strdup, db5_diradd_handler(), db5_get_raw_internal_ptr(), DB5_GLOBAL_OBJECT_NAME, db5_header_is_valid(), db5_import_attributes(), db5_import_color_table(), DB5_MAJORTYPE_ATTRIBUTE_ONLY, db5_scan(), db5_update_ident(), db_diradd(), db_get_external(), db_lookup(), db_scan(), db_i::dbi_base2local, db_i::dbi_filename, db_i::dbi_fp, db_i::dbi_local2base, db_i::dbi_title, db_i::dbi_version, DIR_NULL, bu_external::ext_buf, LOOKUP_NOISY, db5_raw_internal::major_type, NEAR_ZERO, NULL, RT_CK_DBI, and VUNITIZE_TOL.

Referenced by db_create(), main(), rt_dirbuild(), rt_submodel_plot(), rt_submodel_prep(), wdb_concat_cmd(), and wdb_prep_dbip().

Here is the call graph for this function:

int db_get_version struct db_i dbip  ) 
 

Definition at line 456 of file db5_scan.c.

References bu_log(), db5_header_is_valid(), db_i::dbi_filename, and db_i::dbi_fp.

Referenced by db_open().

Here is the call graph for this function:

int db5_type_tag_from_major char **  tag,
const int  major
 

Definition at line 231 of file db5_types.c.

References DB5_MAJORTYPE_RESERVED, db5_type::heed_minor, and db5_type::major_code.

int db5_type_descrip_from_major char **  descrip,
const int  major
 

Definition at line 246 of file db5_types.c.

References DB5_MAJORTYPE_RESERVED, db5_type::description, db5_type::heed_minor, and db5_type::major_code.

int db5_type_tag_from_codes char **  tag,
const int  major,
const int  minor
 

Definition at line 261 of file db5_types.c.

References DB5_MAJORTYPE_RESERVED, db5_type::heed_minor, db5_type::major_code, and db5_type::minor_code.

int db5_type_descrip_from_codes char **  descrip,
const int  major,
const int  minor
 

Definition at line 281 of file db5_types.c.

References DB5_MAJORTYPE_RESERVED, db5_type::description, db5_type::heed_minor, db5_type::major_code, and db5_type::minor_code.

Referenced by rt_retrieve_binunif().

int db5_type_codes_from_tag int *  major,
int *  minor,
const char *  tag
 

Definition at line 302 of file db5_types.c.

References DB5_MAJORTYPE_RESERVED, db5_type::major_code, and db5_type::minor_code.

int db5_type_codes_from_descrip int *  major,
int *  minor,
const char *  descrip
 

Definition at line 319 of file db5_types.c.

References DB5_MAJORTYPE_RESERVED, db5_type::description, db5_type::major_code, and db5_type::minor_code.

size_t db5_type_sizeof_h_binu const int  minor  ) 
 

Definition at line 337 of file db5_types.c.

References DB5_MINORTYPE_BINU_16BITINT, DB5_MINORTYPE_BINU_16BITINT_U, DB5_MINORTYPE_BINU_32BITINT, DB5_MINORTYPE_BINU_32BITINT_U, DB5_MINORTYPE_BINU_64BITINT, DB5_MINORTYPE_BINU_64BITINT_U, DB5_MINORTYPE_BINU_8BITINT, DB5_MINORTYPE_BINU_8BITINT_U, DB5_MINORTYPE_BINU_DOUBLE, and DB5_MINORTYPE_BINU_FLOAT.

Referenced by rt_mk_binunif(), and wdb_binary_cmd().

size_t db5_type_sizeof_n_binu const int  minor  ) 
 

Definition at line 360 of file db5_types.c.

References DB5_MINORTYPE_BINU_16BITINT, DB5_MINORTYPE_BINU_16BITINT_U, DB5_MINORTYPE_BINU_32BITINT, DB5_MINORTYPE_BINU_32BITINT_U, DB5_MINORTYPE_BINU_64BITINT, DB5_MINORTYPE_BINU_64BITINT_U, DB5_MINORTYPE_BINU_8BITINT, DB5_MINORTYPE_BINU_8BITINT_U, DB5_MINORTYPE_BINU_DOUBLE, DB5_MINORTYPE_BINU_FLOAT, SIZEOF_NETWORK_DOUBLE, and SIZEOF_NETWORK_FLOAT.


Variable Documentation

const char* binu_types[]
 

Definition at line 62 of file db5_bin.c.

Referenced by rt_binunif_tcladjust(), and wdb_vls_long_dpp().

DB5_EXPORT const int db5_enc_len[4]
 

Definition at line 62 of file db5_io.c.

Referenced by db5_export_object3(), and rt_comb_export5().

const int db5_enc_len[4]
 

Initial value:

 {
        1,
        2,
        4,
        8
}

Definition at line 62 of file db5_io.c.

Referenced by db5_export_object3(), and rt_comb_export5().


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