BRL-CAD
Collaboration diagram for Tcl Interfacing:

Files

file  observer.c
 Routines for implementing the observer pattern.
 
file  tcl.c
 Routine(s) to allow TCL calling libbu code.
 

Data Structures

struct  bu_observer
 

Macros

#define BU_OBSERVER_NULL   ((struct bu_observer *)0)
 
#define BU_CK_OBSERVER(_op)   BU_CKMAG(_op, BU_OBSERVER_MAGIC, "bu_observer magic")
 
#define BU_OBSERVER_INIT(_op)
 
#define BU_OBSERVER_INIT_ZERO   { {BU_OBSERVER_MAGIC, BU_LIST_NULL, BU_LIST_NULL}, BU_VLS_INIT_ZERO, BU_VLS_INIT_ZERO }
 
#define BU_OBSERVER_IS_INITIALIZED(_op)   (((struct bu_observer *)(_op) != BU_OBSERVER_NULL) && LIKELY((_op)->magic == BU_OBSERVER_MAGIC))
 

Typedefs

typedef struct bu_observer bu_observer_t
 

Functions

int bu_observer_cmd (void *clientData, int argc, const char *argv[])
 
void bu_observer_notify (Tcl_Interp *interp, struct bu_observer *headp, char *self)
 
void bu_observer_free (struct bu_observer *)
 
int Bu_Init (void *interp)
 

Variables

Tcl_Interp * brlcad_interp
 

Detailed Description

Macro Definition Documentation

#define BU_OBSERVER_NULL   ((struct bu_observer *)0)

Definition at line 53 of file bu_tcl.h.

#define BU_CK_OBSERVER (   _op)    BU_CKMAG(_op, BU_OBSERVER_MAGIC, "bu_observer magic")

asserts the integrity of a non-head node bu_observer struct.

Definition at line 58 of file bu_tcl.h.

#define BU_OBSERVER_INIT (   _op)
Value:
{ \
BU_VLS_INIT(&(_op)->observer); \
BU_VLS_INIT(&(_op)->cmd); \
}
#define BU_LIST_INIT_MAGIC(_hp, _magic)
Definition: list.h:156
#define BU_OBSERVER_MAGIC
Definition: magic.h:58
#define BU_VLS_INIT(_vp)
Definition: vls.h:74

initializes a bu_observer struct without allocating any memory.

Definition at line 63 of file bu_tcl.h.

#define BU_OBSERVER_INIT_ZERO   { {BU_OBSERVER_MAGIC, BU_LIST_NULL, BU_LIST_NULL}, BU_VLS_INIT_ZERO, BU_VLS_INIT_ZERO }

macro suitable for declaration statement initialization of a bu_observer struct. does not allocate memory. not suitable for a head node.

Definition at line 73 of file bu_tcl.h.

#define BU_OBSERVER_IS_INITIALIZED (   _op)    (((struct bu_observer *)(_op) != BU_OBSERVER_NULL) && LIKELY((_op)->magic == BU_OBSERVER_MAGIC))

returns truthfully whether a bu_observer has been initialized.

Definition at line 78 of file bu_tcl.h.

Typedef Documentation

typedef struct bu_observer bu_observer_t

Definition at line 52 of file bu_tcl.h.

Function Documentation

int bu_observer_cmd ( void *  clientData,
int  argc,
const char *  argv[] 
)

runs a given command, calling the corresponding observer callback if it matches.

Referenced by dmo_observer_tcl(), and vo_observer_cmd().

void bu_observer_notify ( Tcl_Interp *  interp,
struct bu_observer headp,
char *  self 
)

Notify observers.

Definition at line 140 of file observer.c.

References BU_LIST_FOR, bu_vls_addr(), bu_vls_free(), BU_VLS_INIT_ZERO, bu_vls_printf(), bu_vls_strcpy(), bu_vls_strlen(), bu_vls_trunc(), bu_observer::cmd, bu_observer::l, and bu_observer::observer.

Referenced by vo_update().

Here is the call graph for this function:

void bu_observer_free ( struct bu_observer )

Free observers.

Definition at line 162 of file observer.c.

References BU_LIST_DEQUEUE, BU_LIST_FIRST, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, BU_PUT, bu_vls_free(), bu_observer::cmd, bu_observer::l, and bu_observer::observer.

Referenced by dmo_deleteProc().

Here is the call graph for this function:

int Bu_Init ( void *  interp)

Bu_Init

Allows LIBBU to be dynamically loaded to a vanilla tclsh/wish with "load /usr/brlcad/lib/libbu.so"

Parameters
interp- tcl interpreter in which this command was registered.
Returns
BRLCAD_OK if successful, otherwise, BRLCAD_ERROR.

Definition at line 422 of file tcl.c.

References brlcad_interp, BRLCAD_OK, BU_CMD_NULL, bu_debug, BU_DEBUG_FORMAT, OSL::Strings::interp, tcl_bu_brlcad_data(), tcl_bu_brlcad_dir(), tcl_bu_brlcad_root(), tcl_bu_get_value_by_keyword(), tcl_bu_hsv_to_rgb(), tcl_bu_mem_barriercheck(), tcl_bu_prmem(), tcl_bu_rgb_to_hsv(), and tcl_bu_units_conversion().

Referenced by Tclcad_Init().

Here is the call graph for this function:

Variable Documentation