BRL-CAD
directory.h File Reference
#include "common.h"
#include "vmath.h"
#include "bu/list.h"
#include "rt/anim.h"
Include dependency graph for directory.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  directory
 

Macros

#define RT_DIR_NULL   ((struct directory *)0)
 
#define RT_CK_DIR(_dp)   BU_CKMAG(_dp, RT_DIR_MAGIC, "(librt)directory")
 
#define d_addr   d_un.file_offset
 
#define RT_DIR_PHONY_ADDR   ((b_off_t)-1)
 Special marker for d_addr field. More...
 
#define RT_DIR_SOLID   0x1
 this name is a solid More...
 
#define RT_DIR_COMB   0x2
 combination More...
 
#define RT_DIR_REGION   0x4
 region More...
 
#define RT_DIR_HIDDEN   0x8
 object name is hidden More...
 
#define RT_DIR_NON_GEOM   0x10
 object is not geometry (e.g. binary object) More...
 
#define RT_DIR_USED   0x80
 One bit, used similar to d_nref. More...
 
#define RT_DIR_INMEM   0x100
 object is in memory (only) More...
 
#define LOOKUP_NOISY   1
 
#define LOOKUP_QUIET   0
 
#define FOR_ALL_DIRECTORY_START(_dp, _dbip)
 
#define FOR_ALL_DIRECTORY_END   }}}
 
#define RT_DIR_SET_NAMEP(_dp, _name)
 
#define RT_DIR_FREE_NAMEP(_dp)
 
#define RT_GET_DIRECTORY(_p, _res)
 

Functions

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

Macro Definition Documentation

◆ RT_DIR_NULL

#define RT_DIR_NULL   ((struct directory *)0)

Definition at line 78 of file directory.h.

◆ RT_CK_DIR

#define RT_CK_DIR (   _dp)    BU_CKMAG(_dp, RT_DIR_MAGIC, "(librt)directory")

Definition at line 79 of file directory.h.

◆ d_addr

#define d_addr   d_un.file_offset

Definition at line 81 of file directory.h.

◆ RT_DIR_PHONY_ADDR

#define RT_DIR_PHONY_ADDR   ((b_off_t)-1)

Special marker for d_addr field.

Definition at line 82 of file directory.h.

◆ RT_DIR_SOLID

#define RT_DIR_SOLID   0x1

this name is a solid

Definition at line 85 of file directory.h.

◆ RT_DIR_COMB

#define RT_DIR_COMB   0x2

combination

Definition at line 86 of file directory.h.

◆ RT_DIR_REGION

#define RT_DIR_REGION   0x4

region

Definition at line 87 of file directory.h.

◆ RT_DIR_HIDDEN

#define RT_DIR_HIDDEN   0x8

object name is hidden

Definition at line 88 of file directory.h.

◆ RT_DIR_NON_GEOM

#define RT_DIR_NON_GEOM   0x10

object is not geometry (e.g. binary object)

Definition at line 89 of file directory.h.

◆ RT_DIR_USED

#define RT_DIR_USED   0x80

One bit, used similar to d_nref.

Definition at line 90 of file directory.h.

◆ RT_DIR_INMEM

#define RT_DIR_INMEM   0x100

object is in memory (only)

Args to db_lookup()

Definition at line 93 of file directory.h.

◆ LOOKUP_NOISY

#define LOOKUP_NOISY   1

Definition at line 94 of file directory.h.

◆ LOOKUP_QUIET

#define LOOKUP_QUIET   0

Definition at line 95 of file directory.h.

◆ FOR_ALL_DIRECTORY_START

#define FOR_ALL_DIRECTORY_START (   _dp,
  _dbip 
)
Value:
{ int _i; \
for (_i = RT_DBNHASH-1; _i >= 0; _i--) { \
for ((_dp) = (_dbip)->dbi_Head[_i]; (_dp); (_dp) = (_dp)->d_forw) {
#define RT_DBNHASH
hash table is an array of linked lists with this many array pointer elements (Memory use for 32-bit: ...
Definition: defines.h:148

Definition at line 97 of file directory.h.

◆ FOR_ALL_DIRECTORY_END

#define FOR_ALL_DIRECTORY_END   }}}

Definition at line 101 of file directory.h.

◆ RT_DIR_SET_NAMEP

#define RT_DIR_SET_NAMEP (   _dp,
  _name 
)
Value:
{ \
if (strlen(_name) < sizeof((_dp)->d_shortname)) {\
bu_strlcpy((_dp)->d_shortname, (_name), sizeof((_dp)->d_shortname)); \
(_dp)->d_namep = (_dp)->d_shortname; \
} else { \
(_dp)->d_namep = bu_strdup(_name); /* Calls bu_malloc() */ \
} }
#define bu_strdup(s)
Definition: str.h:68

Definition at line 103 of file directory.h.

◆ RT_DIR_FREE_NAMEP

#define RT_DIR_FREE_NAMEP (   _dp)
Value:
{ \
if ((_dp)->d_namep != (_dp)->d_shortname) \
bu_free((_dp)->d_namep, "d_namep"); \
(_dp)->d_namep = NULL; }

Use this macro to free the d_namep member, which is sometimes not dynamic.

Definition at line 116 of file directory.h.

◆ RT_GET_DIRECTORY

#define RT_GET_DIRECTORY (   _p,
  _res 
)
Value:
{ \
while (((_p) = (_res)->re_directory_hd) == NULL) \
db_alloc_directory_block(_res); \
(_res)->re_directory_hd = (_p)->d_forw; \
(_p)->d_forw = NULL; }

allocate and link in a new directory entry to the resource structure's freelist

Definition at line 126 of file directory.h.

Function Documentation

◆ db_argv_to_dpv()

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.

◆ db_dpv_to_argv()

char ** db_dpv_to_argv ( struct directory **  dpv)

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