Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 11 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | 29 | ||
30 | 30 | ||
31 | 31 | ||
32 | Chopped a lot of RCS revision history |
32 | Chopped a lot of RCS revision history |
33 | * */ |
33 | * */ |
34 | #pragma once |
34 | |
35 | #include <stdio.h> |
- | |
36 | 35 | ||
37 | 36 | ||
38 | #if !defined _CMDPARSE |
37 | #if ! defined _CMDPARSE |
39 | #define _CMDPARSE |
38 | #define _CMDPARSE |
40 | 39 | ||
- | 40 | ||
41 | #if !defined ET_TCLARGS |
41 | #if ! defined ET_TCLARGS |
42 | #define TCLARGS |
42 | #define TCLARGS |
43 | #else |
43 | #else |
44 | #define TCLARGS ET_TCLARGS |
44 | #define TCLARGS ET_TCLARGS |
45 | #endif |
45 | #endif |
46 | 46 | ||
- | 47 | ||
47 | #define LINELEN 1024 |
48 | #define LINELEN 1024 |
48 | #define WORDSINLINE 50 |
49 | #define WORDSINLINE 50 |
49 | #define PATHLENGTH 200 |
50 | #define PATHLENGTH 200 |
50 | #define WORDWIDTH 100 |
51 | #define WORDWIDTH 100 |
51 | 52 | ||
52 | enum ReturnCodes |
- | |
53 | { |
- | |
54 | OKCMD, |
- | |
55 | FAILED, |
- | |
56 | NARGS, |
- | |
57 | UNKNOWNCMD, |
53 | enum ReturnCodes {OKCMD, FAILED, NARGS, UNKNOWNCMD, BADVARS, QUITCMD}; |
58 | BADVARS, |
- | |
59 | QUITCMD |
- | |
60 | }; |
- | |
61 | 54 | ||
62 | struct CommandStruct; |
55 | struct CommandStruct; |
63 | 56 | ||
- | 57 | ||
- | 58 | ||
- | 59 | ||
- | 60 | ||
64 | struct command |
61 | struct command |
65 | { |
62 | { |
66 | char *name; |
63 | char *name; |
67 | int NumChar; |
64 | int NumChar; |
68 | /* see above for macro defining this */ |
65 | /* see above for macro defining this */ |
69 | int (*function) (TCLARGS); |
66 | int (*function) (TCLARGS); |
70 | struct command *Menu; |
67 | struct command * Menu; |
71 | char *helpstr; |
68 | char *helpstr; |
72 | char *extras; |
69 | char *extras; |
73 | char *TCL_command; |
70 | char *TCL_command; |
74 | }; |
71 | }; |
- | 72 | ||
75 | 73 | ||
76 | typedef struct command CommandMenu[]; |
74 | typedef struct command CommandMenu[]; |
77 | 75 | ||
78 | #if defined USE_COMMANDSTRUCT |
76 | #if defined USE_COMMANDSTRUCT |
79 | struct CommandStruct |
77 | struct CommandStruct |
80 | { |
78 | { |
81 | char *Text; |
79 | char *Text; |
82 | char *Words[WORDSINLINE]; |
80 | char *Words[WORDSINLINE]; |
83 | int CurrentCommand; |
81 | int CurrentCommand; |
84 | int NumberCommands; |
82 | int NumberCommands; |
85 | int nArgs; |
83 | int nArgs; |
86 | char **Args; |
84 | char **Args; |
87 | }; |
85 | }; |
88 | #endif |
86 | #endif |
89 | - | ||
90 | /* is the TCL interface in GUI or command line mode ? */ |
87 | /* is the TCL interface in GUI or command line mode ? */ |
91 | typedef enum |
- | |
92 | { |
- | |
93 | Tcl_GUI, |
- | |
94 | Tcl_Cmd |
- | |
95 | } tcl_mode_t; |
- | |
96 | 88 | ||
97 | #if defined ET_TCLARGS |
89 | #if defined ET_TCLARGS |
98 | 90 | ||
- | 91 | typedef enum {Tcl_GUI,Tcl_Cmd} tcl_mode_t; |
|
99 | 92 | ||
100 | extern tcl_mode_t Tcl_Mode; |
93 | extern tcl_mode_t Tcl_Mode; |
- | 94 | ||
- | 95 | /* make this a global */ |
|
- | 96 | extern Tcl_Interp * Tcl_interp; |
|
101 | 97 | ||
102 | /* make this a global */ |
- | |
103 | extern Tcl_Interp *Tcl_interp; |
- | |
104 | 98 | ||
105 | #endif |
99 | #endif |
106 | 100 | ||
107 | /* debug level */ |
101 | /* debug level */ |
108 | extern long level; |
102 | extern long level; |
109 | 103 | ||
110 | extern int Execute (int argc, char *argv[], CommandMenu Dispatch); |
104 | extern int Execute (int argc,char * argv[], CommandMenu Dispatch); |
- | 105 | ||
- | 106 | extern int ExecuteString (char * commandstring , int nArgs, char * Args[]) ; |
|
- | 107 | ||
- | 108 | extern int ParseFile (FILE * CmdFile,int nArgs, char * Args[]); |
|
- | 109 | ||
- | 110 | extern int ExecuteCommand (FILE * CmdFile, |
|
- | 111 | int nArgs, |
|
- | 112 | char * Args[]); |
|
- | 113 | ||
111 | 114 | ||
112 | extern int ExecuteString (char *commandstring, int nArgs, char *Args[]); |
- | |
113 | 115 | ||
114 | extern int ParseFile (FILE *CmdFile, int nArgs, char *Args[]); |
- | |
115 | 116 | ||
116 | extern int ExecuteCommand (FILE *CmdFile, int nArgs, char *Args[]); |
- | |
117 | 117 | ||
118 | #endif |
118 | #endif |
- | 119 |