diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2008-10-02 23:32:13 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2008-10-02 23:32:13 (GMT) |
commit | b6d0e8df2a36c2c588369036359615f7156d1ba2 (patch) | |
tree | 9b873f2f402426ed96e97b7ba3de43b23c0913d2 /generic/tcl.h | |
parent | a04fa2fcec1f882f780d333beb09284c89ff7bff (diff) | |
download | tcl-b6d0e8df2a36c2c588369036359615f7156d1ba2.zip tcl-b6d0e8df2a36c2c588369036359615f7156d1ba2.tar.gz tcl-b6d0e8df2a36c2c588369036359615f7156d1ba2.tar.bz2 |
Implement TIP #265. [FRQ 1446696]
Diffstat (limited to 'generic/tcl.h')
-rw-r--r-- | generic/tcl.h | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index abe1157..d7b5ec7 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.271 2008/10/02 20:59:45 dgp Exp $ + * RCS: @(#) $Id: tcl.h,v 1.272 2008/10/02 23:32:13 dkf Exp $ */ #ifndef _TCL @@ -2186,6 +2186,65 @@ typedef unsigned long mp_digit; #endif /* + *---------------------------------------------------------------------------- + * Definitions needed for Tcl_ParseArgvObj routines. + * Based on tkArgv.c. + * Modifications from the original are copyright (c) Sam Bromley 2006 + *---------------------------------------------------------------------------- + */ + +typedef struct { + int type; /* Indicates the option type; see below. */ + const char *keyStr; /* The key string that flags the option in the + * argv array. */ + void *srcPtr; /* Value to be used in setting dst; usage + * depends on type.*/ + void *dstPtr; /* Address of value to be modified; usage + * depends on type.*/ + const char *helpStr; /* Documentation message describing this + * option. */ + ClientData clientData; /* Word to pass to function callbacks. */ +} Tcl_ArgvInfo; + +/* + * Legal values for the type field of a Tcl_ArgInfo: see the user + * documentation for details. + */ + +#define TCL_ARGV_CONSTANT 15 +#define TCL_ARGV_INT 16 +#define TCL_ARGV_STRING 17 +#define TCL_ARGV_REST 18 +#define TCL_ARGV_FLOAT 19 +#define TCL_ARGV_FUNC 20 +#define TCL_ARGV_GENFUNC 21 +#define TCL_ARGV_HELP 22 +#define TCL_ARGV_END 23 + +/* + * Types of callback functions for the TCL_ARGV_FUNC and TCL_ARGV_GENFUNC + * argument types: + */ + +typedef int (*Tcl_ArgvFuncProc)(ClientData clientData, Tcl_Obj *objPtr, + void *dstPtr); +typedef int (*Tcl_ArgvGenFuncProc)(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const *objv, void *dstPtr); + +/* + * Shorthand for commonly used argTable entries. + */ + +#define TCL_ARGV_AUTO_HELP \ + {TCL_ARGV_HELP, "-help", NULL, NULL, \ + "Print summary of command-line options and abort"} +#define TCL_ARGV_AUTO_REST \ + {TCL_ARGV_REST, "--", NULL, NULL, \ + "Marks the end of the options"} +#define TCL_ARGV_TABLE_END \ + {TCL_ARGV_END} + +/* * The following constant is used to test for older versions of Tcl in the * stubs tables. * |