home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d598 / parse.lha / Parse / src.lha / parse.h < prev   
Text File  |  1992-01-30  |  3KB  |  81 lines

  1. /***************************************************************************
  2.  
  3.    Program:    
  4.    File:       Parse.h
  5.    
  6.    Version:    V1.0
  7.    Date:       11.07.90
  8.    Function:   Include file for the command parser
  9.    
  10.    Copyright:  SciTech Software 1991
  11.    Author:     Andrew C. R. Martin
  12.    Address:    SciTech Software
  13.                23, Stag Leys,
  14.                Ashtead,
  15.                Surrey,
  16.                KT21 2TD.
  17.    Phone:      +44 (0372) 275775
  18.    EMail:      UUCP: cbmuk!cbmuka!scitec!amartin
  19.                JANET: andrew@uk.ac.ox.biop
  20.    Written while at:
  21.                Laboratory of Mathematical Biology
  22.                National Institue for Medical Research,
  23.                The Ridgeway,
  24.                Mill Hill,
  25.                London,
  26.                NW7 1AA
  27.                
  28. ****************************************************************************
  29.  
  30.    This program is not in the public domain, but it may be freely copied
  31.    and distributed for no charge providing this header is included.
  32.    The code may be modified as required, but any modifications must be
  33.    documented so that the person responsible can be identified. If someone
  34.    else breaks this code, I don't want to be blamed for code that does not
  35.    work! The code may not be sold commercially without prior permission from
  36.    the author, although it may be given away free with commercial products,
  37.    providing it is made clear that this program is free and that the source
  38.    code is provided with the program.
  39.  
  40. ****************************************************************************
  41.  
  42.    Description:
  43.    ============
  44.    Here are defined the MAKEKEY macro, STRING and NUMBER defines, the
  45.    KeyWd structure and return values for the parser.
  46.  
  47. ****************************************************************************
  48.  
  49.    Usage:
  50.    ======
  51.  
  52. ****************************************************************************
  53.  
  54.    Revision History:
  55.    =================
  56.  
  57. ***************************************************************************/
  58.  
  59. /* Defines used for the MAKEKEY macro */
  60. #define STRING 1
  61. #define NUMBER 0
  62.  
  63. /* Return values from parse() */
  64. #define PARSE_ERRC    -1
  65. #define PARSE_ERRP    -2
  66. #define PARSE_COMMENT -3
  67.  
  68. /* Definition of the KeyWd structure in which we store keywords */
  69. typedef struct
  70. {
  71.    char  *name;
  72.    int   string, nparam;
  73. }  KeyWd;
  74.  
  75. /* Macro to create a keyword */
  76. #define MAKEKEY(x,w,v,z) \
  77.         (x).name = (char *)malloc((strlen(w)+2) * sizeof(char)); \
  78.         strcpy((x).name,w); \
  79.         (x).string = v; \
  80.         (x).nparam = z
  81.