diff options
author | joye <joye> | 2014-04-15 15:57:36 (GMT) |
---|---|---|
committer | joye <joye> | 2014-04-15 15:57:36 (GMT) |
commit | 2654679adb1a046e969a1522074003e05a4edf81 (patch) | |
tree | d6137014338b4170f17d21daf6dbdb00f4905769 /src/bltSwitch.C | |
parent | ae7a40b3e06b2935bf43b87a6cacced78f378b08 (diff) | |
download | blt-2654679adb1a046e969a1522074003e05a4edf81.zip blt-2654679adb1a046e969a1522074003e05a4edf81.tar.gz blt-2654679adb1a046e969a1522074003e05a4edf81.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'src/bltSwitch.C')
-rw-r--r-- | src/bltSwitch.C | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/bltSwitch.C b/src/bltSwitch.C index 29404f2..53a822c 100644 --- a/src/bltSwitch.C +++ b/src/bltSwitch.C @@ -36,6 +36,35 @@ extern "C" { #include "bltSwitch.h" }; +static int Blt_GetCountFromObj(Tcl_Interp* interp, Tcl_Obj *objPtr, int check, + long *valuePtr) +{ + long count; + if (Tcl_GetLongFromObj(interp, objPtr, &count) != TCL_OK) + return TCL_ERROR; + + switch (check) { + case COUNT_NNEG: + if (count < 0) { + Tcl_AppendResult(interp, "bad value \"", Tcl_GetString(objPtr), + "\": can't be negative", (char *)NULL); + return TCL_ERROR; + } + break; + case COUNT_POS: + if (count <= 0) { + Tcl_AppendResult(interp, "bad value \"", Tcl_GetString(objPtr), + "\": must be positive", (char *)NULL); + return TCL_ERROR; + } + break; + case COUNT_ANY: + break; + } + *valuePtr = count; + return TCL_OK; +} + static void DoHelp(Tcl_Interp* interp, Blt_SwitchSpec *specs) { Tcl_DString ds; |