[2100] | 1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
| 2 | /* |
---|
[3177] | 3 | * Copyright (C) 2004-2012 HUBzero Foundation, LLC |
---|
[2100] | 4 | * |
---|
[2492] | 5 | * Author: George A. Howlett <gah@purdue.edu> |
---|
[2100] | 6 | */ |
---|
| 7 | |
---|
[4059] | 8 | #ifndef VTKVIS_CMDPROC_H |
---|
| 9 | #define VTKVIS_CMDPROC_H |
---|
[2100] | 10 | |
---|
| 11 | #include <tcl.h> |
---|
| 12 | |
---|
[4059] | 13 | namespace VtkVis { |
---|
[2100] | 14 | |
---|
| 15 | /** |
---|
| 16 | * \brief Structure to specify a set of operations for a Tcl command. |
---|
| 17 | * |
---|
| 18 | * This is passed to the GetOpFromObj procedure to look |
---|
| 19 | * for a function pointer associated with the operation name. |
---|
| 20 | */ |
---|
[2573] | 21 | struct CmdSpec { |
---|
[2123] | 22 | const char *name; /**< Name of operation */ |
---|
| 23 | int minChars; /**< Minimum # characters to disambiguate */ |
---|
[2100] | 24 | Tcl_ObjCmdProc *proc; |
---|
[2123] | 25 | int minArgs; /**< Minimum # args required */ |
---|
| 26 | int maxArgs; /**< Maximum # args required */ |
---|
| 27 | const char *usage; /**< Usage message */ |
---|
[2573] | 28 | }; |
---|
[2100] | 29 | |
---|
[2573] | 30 | enum CmdSpecIndex { |
---|
[2123] | 31 | CMDSPEC_ARG0, /**< Op is the first argument. */ |
---|
| 32 | CMDSPEC_ARG1, /**< Op is the second argument. */ |
---|
| 33 | CMDSPEC_ARG2, /**< Op is the third argument. */ |
---|
| 34 | CMDSPEC_ARG3, /**< Op is the fourth argument. */ |
---|
| 35 | CMDSPEC_ARG4 /**< Op is the fifth argument. */ |
---|
[2573] | 36 | }; |
---|
[2100] | 37 | |
---|
| 38 | #define CMDSPEC_LINEAR_SEARCH 1 |
---|
| 39 | #define CMDSPEC_BINARY_SEARCH 0 |
---|
| 40 | |
---|
| 41 | extern Tcl_ObjCmdProc * |
---|
| 42 | GetOpFromObj(Tcl_Interp *interp, int nSpecs, |
---|
| 43 | CmdSpec *specs, int operPos, int objc, Tcl_Obj *const *objv, int flags); |
---|
| 44 | |
---|
[4059] | 45 | #define NumCmdSpecs(s) (sizeof(s) / sizeof(VtkVis::CmdSpec)) |
---|
[2100] | 46 | |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | #endif |
---|