Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | mjames | 1 | /* $Id: cmdparse.h,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $ |
| 2 | |||
| 3 | Header file: cmdparse.h |
||
| 4 | |||
| 5 | $Log: cmdparse.h,v $ |
||
| 6 | Revision 1.1.1.1 2003/11/04 23:34:56 mjames |
||
| 7 | Imported into local repositrory |
||
| 8 | |||
| 9 | Revision 1.6 2001/10/31 22:20:01 mjames |
||
| 10 | Tidying up problematical comments caused by CVS |
||
| 11 | 'intelligent' comment guessing |
||
| 12 | |||
| 13 | Revision 1.5 2001/06/06 12:10:24 mjames |
||
| 14 | Move from HPUX |
||
| 15 | |||
| 16 | Revision 1.4 2001/02/06 22:41:15 mjames |
||
| 17 | Added correct argument passing for 'read file comp_suffix arg0 arg1 arg2 ... |
||
| 18 | |||
| 19 | Revision 1.3 2001/01/04 21:26:55 mjames |
||
| 20 | Modifications to add in the TCL style |
||
| 21 | argument list to all of the functions |
||
| 22 | . |
||
| 23 | |||
| 24 | Revision 1.2 2001/01/02 07:53:52 mjames |
||
| 25 | Made changes to allow for interface with TCL/Tk |
||
| 26 | |||
| 27 | Revision 1.1.1.1 2000/10/19 21:58:35 mjames |
||
| 28 | Mike put it here |
||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | Chopped a lot of RCS revision history |
||
| 33 | * */ |
||
| 34 | #pragma once |
||
| 35 | #include <stdio.h> |
||
| 36 | |||
| 37 | |||
| 38 | #if !defined _CMDPARSE |
||
| 39 | #define _CMDPARSE |
||
| 40 | |||
| 41 | #if !defined ET_TCLARGS |
||
| 42 | #define TCLARGS |
||
| 43 | #else |
||
| 44 | #define TCLARGS ET_TCLARGS |
||
| 45 | #endif |
||
| 46 | |||
| 47 | #define LINELEN 1024 |
||
| 48 | #define WORDSINLINE 50 |
||
| 49 | #define PATHLENGTH 200 |
||
| 50 | #define WORDWIDTH 100 |
||
| 51 | |||
| 52 | enum ReturnCodes |
||
| 53 | { |
||
| 54 | OKCMD, |
||
| 55 | FAILED, |
||
| 56 | NARGS, |
||
| 57 | UNKNOWNCMD, |
||
| 58 | BADVARS, |
||
| 59 | QUITCMD |
||
| 60 | }; |
||
| 61 | |||
| 62 | struct CommandStruct; |
||
| 63 | |||
| 64 | struct command |
||
| 65 | { |
||
| 66 | char *name; |
||
| 67 | int NumChar; |
||
| 68 | /* see above for macro defining this */ |
||
| 69 | int (*function) (TCLARGS); |
||
| 70 | struct command *Menu; |
||
| 71 | char *helpstr; |
||
| 72 | char *extras; |
||
| 73 | char *TCL_command; |
||
| 74 | }; |
||
| 75 | |||
| 76 | typedef struct command CommandMenu[]; |
||
| 77 | |||
| 78 | #if defined USE_COMMANDSTRUCT |
||
| 79 | struct CommandStruct |
||
| 80 | { |
||
| 81 | char *Text; |
||
| 82 | char *Words[WORDSINLINE]; |
||
| 83 | int CurrentCommand; |
||
| 84 | int NumberCommands; |
||
| 85 | int nArgs; |
||
| 86 | char **Args; |
||
| 87 | }; |
||
| 88 | #endif |
||
| 89 | |||
| 90 | /* 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 | |||
| 97 | #if defined ET_TCLARGS |
||
| 98 | |||
| 99 | |||
| 100 | extern tcl_mode_t Tcl_Mode; |
||
| 101 | |||
| 102 | /* make this a global */ |
||
| 103 | extern Tcl_Interp *Tcl_interp; |
||
| 104 | |||
| 105 | #endif |
||
| 106 | |||
| 107 | /* debug level */ |
||
| 108 | extern long level; |
||
| 109 | |||
| 110 | extern int Execute (int argc, char *argv[], CommandMenu Dispatch); |
||
| 111 | |||
| 112 | extern int ExecuteString (char *commandstring, int nArgs, char *Args[]); |
||
| 113 | |||
| 114 | extern int ParseFile (FILE *CmdFile, int nArgs, char *Args[]); |
||
| 115 | |||
| 116 | extern int ExecuteCommand (FILE *CmdFile, int nArgs, char *Args[]); |
||
| 117 | |||
| 118 | #endif |