Dali VM : Useful Macros


Header Files

#include <macro.h>

Allocations

NEW(t)

Return a pointer to a newly allocated structure of type t

NEWARRAY(t, n)

Return a pointer to a newly allocated array of type t with n elements.

Error Checking

ReturnErrorIf(c)

ReturnErrorIf0(c,msg)

ReturnErrorIf1(c,msg,arg1)

ReturnErrorIf2(c,msg,arg1,arg2)

ReturnErrorIf3(c,msg,arg1,arg2,arg3)

ReturnErrorIf4(c,msg,arg1,arg2,arg3,arg4)

Can only be called in a function that returns integer and has a variable Tcl_Interp *interp.

Checks for condition c. If c is true, printout the string msg into interp->result. argn are arguments to the msg in printf style. Return TCL_ERROR.


Duff Device

DO_N_TIMES(n, code)

n must not be 0. Execute the code n number of times.

Last Updated :