Initialization Function Example
List of: Discussion Topic
Subjects: Scheme Interface
Contents: Scheme Support

Example 3-13 shows the initialization for the bounded_curve class described previously in this section.

// Purpose---Define S_BndCrv type.

void init_S_BndCrv()
{

ENTER_FUNCTION("init_S_BndCrv");


T_BndCrv = Define_Type(0,


"bounded_curve",


(int (*)(size_t))NOFUNC,


sizeof(S_BndCrv),


BndCrv_Equal,


BndCrv_Equal,


BndCrv_Print,


(void (*)(ScmObject*, void


(*)(ScmObject*)))NOFUNC);
}

// Bind the procedure to the Scheme Interpreter so that it is
// called.
SCM_INIT(init_S_BndCrv);

Example 3-13. Initializing the bounded_curve Class

The following items are specified in Example 3-13:

init_S_BndCrv takes no arguments and defines a variable pertaining to bounded curves.

ENTER_FUNCTION is a diagnostic hook macro commonly used by Spatial for stack tracing and other debugging. During normal operations, it does nothing. If the code is compiled with the DEBUG_TRACE flag defined, ENTER_FUNCTION prints the name of the function each time the function is entered.

SCM_INIT is a binding macro that registers init_S_BndCrv as a function to be run at program initialization time. This macro takes the name of the function as its only argument.
PDF/SCM/03EXTSC.PDF
HTM/DATA/SCM/SCM/03EXTSC/0021.HTM