| 1 |
#ifdef offsetof |
| 2 |
#define Blt_Offset(type, field) ((int) offsetof(type, field)) |
| 3 |
#else |
| 4 |
#define Blt_Offset(type, field) ((int) ((char *) &((type *) 0)->field)) |
| 5 |
#endif |
| 6 |
|
| 7 |
typedef int (Blt_SwitchParseProc) _ANSI_ARGS_((ClientData clientData, |
| 8 |
Tcl_Interp *interp, char *switchName, char *value, char *record, |
| 9 |
int offset)); |
| 10 |
|
| 11 |
typedef void (Blt_SwitchFreeProc) _ANSI_ARGS_((char *ptr)); |
| 12 |
|
| 13 |
typedef struct { |
| 14 |
Blt_SwitchParseProc *parseProc; |
| 15 |
|
| 16 |
|
| 17 |
Blt_SwitchFreeProc *freeProc; |
| 18 |
ClientData clientData; |
| 19 |
|
| 20 |
|
| 21 |
} Blt_SwitchCustom; |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
typedef enum { |
| 28 |
BLT_SWITCH_BOOLEAN, BLT_SWITCH_INT, BLT_SWITCH_INT_POSITIVE, |
| 29 |
BLT_SWITCH_INT_NONNEGATIVE, BLT_SWITCH_DOUBLE, BLT_SWITCH_STRING, |
| 30 |
BLT_SWITCH_LIST, BLT_SWITCH_FLAG, BLT_SWITCH_VALUE, |
| 31 |
BLT_SWITCH_OBJ, BLT_SWITCH_CUSTOM, |
| 32 |
BLT_SWITCH_END |
| 33 |
} Blt_SwitchTypes; |
| 34 |
|
| 35 |
typedef struct { |
| 36 |
Blt_SwitchTypes type; |
| 37 |
|
| 38 |
|
| 39 |
char *switchName; |
| 40 |
|
| 41 |
int offset; |
| 42 |
|
| 43 |
|
| 44 |
int flags; |
| 45 |
|
| 46 |
Blt_SwitchCustom *customPtr; |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
int value; |
| 51 |
} Blt_SwitchSpec; |
| 52 |
|
| 53 |
#define BLT_SWITCH_ARGV_ONLY (1<<0) |
| 54 |
#define BLT_SWITCH_OBJV_ONLY (1<<0) |
| 55 |
#define BLT_SWITCH_ARGV_PARTIAL (1<<1) |
| 56 |
#define BLT_SWITCH_OBJV_PARTIAL (1<<1) |
| 57 |
#define BLT_SWITCH_EXACT (1<<2) |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
#define BLT_SWITCH_NULL_OK (1<<0) |
| 64 |
#define BLT_SWITCH_DONT_SET_DEFAULT (1<<3) |
| 65 |
#define BLT_SWITCH_SPECIFIED (1<<4) |
| 66 |
#define BLT_SWITCH_USER_BIT (1<<8) |
| 67 |
|
| 68 |
extern int Blt_ProcessSwitches _ANSI_ARGS_((Tcl_Interp *interp, |
| 69 |
Blt_SwitchSpec *specs, int argc, char **argv, char *record, int flags)); |
| 70 |
|
| 71 |
extern void Blt_FreeSwitches _ANSI_ARGS_((Tcl_Interp *interp, Blt_SwitchSpec *specs, char *record, |
| 72 |
int flags)); |
| 73 |
|
| 74 |
extern int Blt_SwitchChanged _ANSI_ARGS_(TCL_VARARGS(Blt_SwitchSpec *, specs)); |
| 75 |
|
| 76 |
extern Blt_SwitchSpec * Blt_GetCachedSwitchSpecs _ANSI_ARGS_((Tcl_Interp *interp, |
| 77 |
const Blt_SwitchSpec *staticSpecs)); |
| 78 |
|
| 79 |
#if (TCL_VERSION_NUMBER >= _VERSION(8,0,0)) |
| 80 |
extern int Blt_ProcessObjSwitches _ANSI_ARGS_((Tcl_Interp *interp, |
| 81 |
Blt_SwitchSpec *specPtr, int objc, Tcl_Obj *CONST *objv, char *record, |
| 82 |
int flags)); |
| 83 |
#endif |