cctw  0.2.1
Macros | Functions
cctwtclutils.h File Reference
#include <tcl.h>
Include dependency graph for cctwtclutils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TCL_ARGS(count_expr, help)
 
#define TCL_RETURN_ERROR(format, args...)
 
#define TCL_CHECK_MSG(rc, format, args...)
 
#define TCL_CHECK(rc)   { if (rc != TCL_OK) { return TCL_ERROR; }}
 
#define TCL_CONDITION(condition, format, args...)
 

Functions

void tcl_condition_failed (Tcl_Interp *interp, Tcl_Obj *command, const char *format,...) __attribute__((format(printf
 

Macro Definition Documentation

#define TCL_ARGS (   count_expr,
  help 
)
Value:
{ \
int count = count_expr; \
if (objc != count) { \
char* tmp = Tcl_GetStringFromObj(objv[0], NULL); \
printf("command %s requires %i arguments, received %i\n", \
tmp, count, objc); \
printf(help "\n"); \
return TCL_ERROR; \
} \
}

Check that the user gave us the correct number of arguments objc should be equal to count. If not, fail. Note that in Tcl, the command name counts as an argument

Definition at line 18 of file cctwtclutils.h.

Referenced by Cctwtcl_Input_Cmd(), Cctwtcl_Merge_Cmd(), Cctwtcl_Output_Cmd(), and Cctwtcl_Transform_Cmd().

#define TCL_CHECK (   rc)    { if (rc != TCL_OK) { return TCL_ERROR; }}

If rc is not TCL_OK, return a blank Tcl error

Definition at line 57 of file cctwtclutils.h.

#define TCL_CHECK_MSG (   rc,
  format,
  args... 
)
Value:
if (rc != TCL_OK) { \
TCL_RETURN_ERROR(format, ## args); \
}

If rc is not TCL_OK, return a Tcl error with message

Definition at line 49 of file cctwtclutils.h.

#define TCL_CONDITION (   condition,
  format,
  args... 
)
Value:
if (!(condition)) { \
TCL_RETURN_ERROR(format, ## args); \
}

Definition at line 59 of file cctwtclutils.h.

#define TCL_RETURN_ERROR (   format,
  args... 
)
Value:
{ \
tcl_condition_failed(interp, objv[0], format, ## args); \
return TCL_ERROR; \
}

Print error message and return a Tcl error Requires Tcl_Interp interp and Tcl_Obj* objv in scope

Definition at line 40 of file cctwtclutils.h.

Function Documentation

void tcl_condition_failed ( Tcl_Interp *  interp,
Tcl_Obj *  command,
const char *  format,
  ... 
)

Print error message and setup Tcl error state