1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | /* |
---|
3 | * Copyright (C) 2004-2012 HUBzero Foundation, LLC |
---|
4 | * |
---|
5 | * Author: George A. Howlett <gah@purdue.edu> |
---|
6 | */ |
---|
7 | |
---|
8 | #ifndef VTKVIS_CMDPROC_H |
---|
9 | #define VTKVIS_CMDPROC_H |
---|
10 | |
---|
11 | #include <tcl.h> |
---|
12 | |
---|
13 | namespace VtkVis { |
---|
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 | */ |
---|
21 | struct CmdSpec { |
---|
22 | const char *name; /**< Name of operation */ |
---|
23 | int minChars; /**< Minimum # characters to disambiguate */ |
---|
24 | Tcl_ObjCmdProc *proc; |
---|
25 | int minArgs; /**< Minimum # args required */ |
---|
26 | int maxArgs; /**< Maximum # args required */ |
---|
27 | const char *usage; /**< Usage message */ |
---|
28 | }; |
---|
29 | |
---|
30 | enum CmdSpecIndex { |
---|
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. */ |
---|
36 | }; |
---|
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 | |
---|
45 | #define NumCmdSpecs(s) (sizeof(s) / sizeof(VtkVis::CmdSpec)) |
---|
46 | |
---|
47 | } |
---|
48 | |
---|
49 | #endif |
---|