diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-04-21 21:03:18 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-04-21 21:03:18 (GMT) |
commit | 73ed1b3d2cdeffe239f2f4b5237cac1a661516b6 (patch) | |
tree | 2f1e6c13531209667163c9aec4c49b8c4b9c1ba0 /tls/tclOpts.h | |
parent | 027b9ea484ea3067496696cb8fe2cb33eb6c8b7e (diff) | |
parent | ea8141157cab7d1b2f6cff5463988d1f68f66db3 (diff) | |
download | blt-73ed1b3d2cdeffe239f2f4b5237cac1a661516b6.zip blt-73ed1b3d2cdeffe239f2f4b5237cac1a661516b6.tar.gz blt-73ed1b3d2cdeffe239f2f4b5237cac1a661516b6.tar.bz2 |
Merge commit 'ea8141157cab7d1b2f6cff5463988d1f68f66db3' as 'tls'
Diffstat (limited to 'tls/tclOpts.h')
-rw-r--r-- | tls/tclOpts.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tls/tclOpts.h b/tls/tclOpts.h new file mode 100644 index 0000000..4a0b3b7 --- /dev/null +++ b/tls/tclOpts.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 1997-2000 Matt Newman <matt@novadigm.com> + * + * $Header: /cvsroot/tls/tls/tclOpts.h,v 1.2 2000/01/20 01:49:31 aborr Exp $ + * + * Stylized option processing - requires consitent + * external vars: opt, idx, objc, objv + */ +#ifndef _TCL_OPTS_H +#define _TCL_OPTS_H + +#define OPT_PROLOG(option) \ + if (strcmp(opt, (option)) == 0) { \ + if (++idx >= objc) { \ + Tcl_AppendResult(interp, \ + "no argument given for ", \ + (option), " option", \ + (char *) NULL); \ + return TCL_ERROR; \ + } +#define OPT_POSTLOG() \ + continue; \ + } +#define OPTOBJ(option, var) \ + OPT_PROLOG(option) \ + var = objv[idx]; \ + OPT_POSTLOG() + +#define OPTSTR(option, var) \ + OPT_PROLOG(option) \ + var = Tcl_GetStringFromObj(objv[idx], NULL);\ + OPT_POSTLOG() + +#define OPTINT(option, var) \ + OPT_PROLOG(option) \ + if (Tcl_GetIntFromObj(interp, objv[idx], \ + &(var)) != TCL_OK) { \ + return TCL_ERROR; \ + } \ + OPT_POSTLOG() + +#define OPTBOOL(option, var) \ + OPT_PROLOG(option) \ + if (Tcl_GetBooleanFromObj(interp, objv[idx],\ + &(var)) != TCL_OK) { \ + return TCL_ERROR; \ + } \ + OPT_POSTLOG() + +#define OPTBAD(type, list) \ + Tcl_AppendResult(interp, "bad ", (type), \ + " \"", opt, "\": must be ", \ + (list), (char *) NULL) + +#endif /* _TCL_OPTS_H */ |