/***************************************************************************

   Program:
   File:       Parse.h

   Version:    V1.0
   Date:       11.07.90
   Function:   Include file for the command parser

   Copyright:  SciTech Software 1991
   Author:     Andrew C. R. Martin
   Address:    SciTech Software
               23, Stag Leys,
               Ashtead,
               Surrey,
               KT21 2TD.
   Phone:      +44 (0372) 275775
   EMail:      UUCP: cbmuk!cbmuka!scitec!amartin
               JANET: andrew@uk.ac.ox.biop
   Written while at:
               Laboratory of Mathematical Biology
               National Institue for Medical Research,
               The Ridgeway,
               Mill Hill,
               London,
               NW7 1AA

****************************************************************************

   This program is not in the public domain, but it may be freely copied
   and distributed for no charge providing this header is included.
   The code may be modified as required, but any modifications must be
   documented so that the person responsible can be identified. If someone
   else breaks this code, I don't want to be blamed for code that does not
   work! The code may not be sold commercially without prior permission from
   the author, although it may be given away free with commercial products,
   providing it is made clear that this program is free and that the source
   code is provided with the program.

****************************************************************************

   Description:
   ============
   Here are defined the MAKEKEY macro, STRING and NUMBER defines, the
   KeyWd structure and return values for the parser.

****************************************************************************

   Usage:
   ======

****************************************************************************

   Revision History:
   =================

***************************************************************************/

/* Defines used for the MAKEKEY macro */
#define STRING 1
#define NUMBER 0

/* Return values from parse() */
#define PARSE_ERRC    -1
#define PARSE_ERRP    -2
#define PARSE_COMMENT -3

/* Definition of the KeyWd structure in which we store keywords */
typedef struct
{
	char           *name;
	int             string,
	                nparam;
}               KeyWd;

/* Macro to create a keyword */
#define MAKEKEY(x,w,v,z) \
        (x).name = (char *)malloc((strlen(w)+2) * sizeof(char)); \
        strcpy((x).name,w); \
        (x).string = v; \
        (x).nparam = z

#ifdef __STDC__
#define	Prototype extern
#else
#define Prototype
#endif

/* parse.c */
Prototype char *KillLeadSpaces(char *string);
Prototype int   parse(char *comline, int nkeys, KeyWd * keywords, double *doubleparam, char **strparam);
Prototype int   match(char *comstring, char *string2, int *nletters);
Prototype int   GetString(char *command, char *strparam);
Prototype int   GetParam(char *command, double *value, int *nletters);
Prototype int   StringToUpper(char *string1, char *string2);
Prototype int   terminate(char *string);

#undef Prototype
