home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / kerberosIV / include / kparse.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-14  |  2.5 KB  |  94 lines

  1. /*
  2.  * $Source: /usr/src/kerberosIV/include/RCS/kparse.h,v $
  3.  * $Author: bostic $
  4.  * $Header: /usr/src/kerberosIV/include/RCS/kparse.h,v 4.7 91/02/15 02:54:18 bostic Exp $
  5.  *
  6.  * Copyright 1988 by the Massachusetts Institute of Technology.
  7.  *
  8.  * For copying and distribution information, please see the file
  9.  * <mit-copyright.h>.
  10.  *
  11.  * Include file for kparse routines.
  12.  */
  13.  
  14. #ifdef    ATHENA
  15. #include <mit-copyright.h>
  16. #endif
  17.  
  18. #ifndef KPARSE_DEFS
  19. #define KPARSE_DEFS
  20.  
  21. /*
  22.  * values returned by fGetParameterSet() 
  23.  */
  24.  
  25. #define PS_BAD_KEYWORD      -2    /* unknown or duplicate keyword */
  26. #define PS_SYNTAX      -1    /* syntax error */
  27. #define PS_OKAY           0    /* got a complete parameter set */
  28. #define PS_EOF           1    /* nothing more in the file */
  29.  
  30. /*
  31.  * values returned by fGetKeywordValue() 
  32.  */
  33.  
  34. #define KV_SYNTAX     -2    /* syntax error */
  35. #define KV_EOF         -1    /* nothing more in the file */
  36. #define KV_OKAY          0    /* got a keyword/value pair */
  37. #define KV_EOL          1    /* nothing more on this line */
  38.  
  39. /*
  40.  * values returned by fGetToken() 
  41.  */
  42.  
  43. #define GTOK_BAD_QSTRING -1    /* newline found in quoted string */
  44. #define GTOK_EOF      0    /* end of file encountered */
  45. #define GTOK_QSTRING      1    /* quoted string */
  46. #define GTOK_STRING      2    /* unquoted string */
  47. #define GTOK_NUMBER      3    /* one or more digits */
  48. #define GTOK_PUNK      4    /* punks are punctuation, newline,
  49.                  * etc. */
  50. #define GTOK_WHITE      5    /* one or more whitespace chars */
  51.  
  52. /*
  53.  * extended character classification macros 
  54.  */
  55.  
  56. #define ISOCTAL(CH)     ( (CH>='0')  && (CH<='7') )
  57. #define ISQUOTE(CH)     ( (CH=='"') || (CH=='\'') || (CH=='`') )
  58. #define ISWHITESPACE(C) ( (C==' ')   || (C=='\t') )
  59. #define ISLINEFEED(C)     ( (C=='\n')  || (C=='\r')  || (C=='\f') )
  60.  
  61. /*
  62.  * tokens consist of any printable charcacter except comma, equal, or
  63.  * whitespace 
  64.  */
  65.  
  66. #define ISTOKENCHAR(C) ((C>040) && (C<0177) && (C != ',') && (C != '='))
  67.  
  68. /*
  69.  * the parameter table defines the keywords that will be recognized by
  70.  * fGetParameterSet, and their default values if not specified. 
  71.  */
  72.  
  73. typedef struct {
  74.     char *keyword;
  75.     char *defvalue;
  76.     char *value;
  77. }       parmtable;
  78.  
  79. #define PARMCOUNT(P) (sizeof(P)/sizeof(P[0]))
  80.  
  81. extern int LineNbr;        /* current line # in parameter file */
  82.  
  83. extern char ErrorMsg[];        /*
  84.                  * meaningful only when KV_SYNTAX,
  85.                   * PS_SYNTAX,  or PS_BAD_KEYWORD is
  86.                  * returned by fGetKeywordValue or
  87.                  * fGetParameterSet
  88.                  */
  89.  
  90. extern char *strsave();        /* defined in this module */
  91. extern char *strutol();        /* defined in this module */
  92.  
  93. #endif /* KPARSE_DEFS */
  94.