
/* $Id: cmdparse.h,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $

   Header file: cmdparse.h

   $Log: cmdparse.h,v $
   Revision 1.1.1.1  2003/11/04 23:34:56  mjames
   Imported into local repositrory

   Revision 1.6  2001/10/31 22:20:01  mjames
   Tidying up problematical comments caused by CVS
   'intelligent' comment guessing

   Revision 1.5  2001/06/06 12:10:24  mjames
   Move from HPUX

   Revision 1.4  2001/02/06 22:41:15  mjames
   Added correct argument passing for 'read file comp_suffix arg0 arg1 arg2 ...

   Revision 1.3  2001/01/04 21:26:55  mjames
   Modifications to add in the TCL style
   argument list to all of the functions
   .

   Revision 1.2  2001/01/02 07:53:52  mjames
   Made changes to allow for interface with TCL/Tk

   Revision 1.1.1.1  2000/10/19 21:58:35  mjames
   Mike put it here



Chopped a lot of RCS revision history
 *  */
#pragma once
#include <stdio.h>
 
 
#if !defined _CMDPARSE
#define _CMDPARSE

#if !defined ET_TCLARGS
#define TCLARGS
#else
#define TCLARGS ET_TCLARGS
#endif

#define LINELEN 1024
#define WORDSINLINE 50
#define PATHLENGTH 200
#define WORDWIDTH 100

enum ReturnCodes
{
        OKCMD,
        FAILED,
        NARGS,
        UNKNOWNCMD,
        BADVARS,
        QUITCMD
};

struct CommandStruct;

struct command
{
        char *name;
        int NumChar;
        /* see above for macro defining this */
        int (*function) (TCLARGS);
        struct command *Menu;
        char *helpstr;
        char *extras;
        char *TCL_command;
};

typedef struct command CommandMenu[];

#if defined USE_COMMANDSTRUCT
struct CommandStruct
{
        char *Text;
        char *Words[WORDSINLINE];
        int CurrentCommand;
        int NumberCommands;
        int nArgs;
        char **Args;
};
#endif

/* is the TCL interface in GUI or command line mode ? */
typedef enum
{
        Tcl_GUI,
        Tcl_Cmd
} tcl_mode_t;

#if defined ET_TCLARGS


extern tcl_mode_t Tcl_Mode;

/* make this a global */
extern Tcl_Interp *Tcl_interp;

#endif

/* debug level */
extern long level;

extern int Execute (int argc, char *argv[], CommandMenu Dispatch);

extern int ExecuteString (char *commandstring, int nArgs, char *Args[]);

extern int ParseFile (FILE *CmdFile, int nArgs, char *Args[]);

extern int ExecuteCommand (FILE *CmdFile, int nArgs, char *Args[]);

#endif
