1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | /* |
---|
3 | * Copyright (c) 2004-2013 HUBzero Foundation, LLC |
---|
4 | * |
---|
5 | */ |
---|
6 | /* |
---|
7 | *------------------------------------------------------------------------------- |
---|
8 | * |
---|
9 | * CmdSpec.h -- |
---|
10 | * |
---|
11 | * Generic function prototype of CmdOptions. |
---|
12 | * |
---|
13 | *------------------------------------------------------------------------------- |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef CMDSPEC_H |
---|
17 | #define CMDSPEC_H |
---|
18 | |
---|
19 | namespace Rappture { |
---|
20 | |
---|
21 | /* |
---|
22 | *------------------------------------------------------------------------------- |
---|
23 | * |
---|
24 | * CmdSpec -- |
---|
25 | * |
---|
26 | * Structure to specify a set of operations for a Tcl command. |
---|
27 | * This is passed to the Blt_GetOp procedure to look |
---|
28 | * for a function pointer associated with the operation name. |
---|
29 | * |
---|
30 | *------------------------------------------------------------------------------- |
---|
31 | */ |
---|
32 | typedef struct { |
---|
33 | const char *name; /* Name of operation */ |
---|
34 | int minChars; /* Minimum # characters to disambiguate */ |
---|
35 | Tcl_ObjCmdProc *proc; |
---|
36 | int minArgs; /* Minimum # args required */ |
---|
37 | int maxArgs; /* Maximum # args required */ |
---|
38 | const char *usage; /* Usage message */ |
---|
39 | } CmdSpec; |
---|
40 | |
---|
41 | typedef enum { |
---|
42 | CMDSPEC_ARG0, /* Op is the first argument. */ |
---|
43 | CMDSPEC_ARG1, /* Op is the second argument. */ |
---|
44 | CMDSPEC_ARG2, /* Op is the third argument. */ |
---|
45 | CMDSPEC_ARG3, /* Op is the fourth argument. */ |
---|
46 | CMDSPEC_ARG4 /* Op is the fifth argument. */ |
---|
47 | } CmdSpecIndex; |
---|
48 | |
---|
49 | #define CMDSPEC_LINEAR_SEARCH 1 |
---|
50 | #define CMDSPEC_BINARY_SEARCH 0 |
---|
51 | |
---|
52 | extern Tcl_ObjCmdProc * |
---|
53 | GetOpFromObj(Tcl_Interp *interp, int nSpecs, |
---|
54 | CmdSpec *specs, int operPos, int objc, Tcl_Obj *const *objv, int flags); |
---|
55 | |
---|
56 | #define NumCmdSpecs(s) (sizeof(s) / sizeof(Rappture::CmdSpec)) |
---|
57 | |
---|
58 | } |
---|
59 | |
---|
60 | #endif /* CMDSPEC_H */ |
---|