source: trunk/third/cns/src/include/kparse.h @ 8789

Revision 8789, 1.9 KB checked in by ghudson, 28 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r8788, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * Copyright 1988 by the Massachusetts Institute of Technology.
3 *
4 * For copying and distribution information, please see the file
5 * <mit-copyright.h>.
6 *
7 * Include file for kparse routines.
8 */
9
10#include "mit-copyright.h"
11
12#ifndef KPARSE_DEFS
13#define KPARSE_DEFS
14
15/*
16 * values returned by fGetParameterSet()
17 */
18
19#define PS_BAD_KEYWORD    -2    /* unknown or duplicate keyword */
20#define PS_SYNTAX         -1    /* syntax error */
21#define PS_OKAY            0    /* got a complete parameter set */
22#define PS_EOF             1    /* nothing more in the file */
23
24/*
25 * values returned by fGetKeywordValue()
26 */
27
28#define KV_SYNTAX        -2     /* syntax error */
29#define KV_EOF           -1     /* nothing more in the file */
30#define KV_OKAY           0     /* got a keyword/value pair */
31#define KV_EOL            1     /* nothing more on this line */
32
33/*
34 * values returned by fGetToken()
35 */
36
37#define GTOK_BAD_QSTRING -1     /* newline found in quoted string */
38#define GTOK_EOF          0     /* end of file encountered */
39#define GTOK_QSTRING      1     /* quoted string */
40#define GTOK_STRING       2     /* unquoted string */
41#define GTOK_NUMBER       3     /* one or more digits */
42#define GTOK_PUNK         4     /* punks are punctuation, newline,
43                                 * etc. */
44#define GTOK_WHITE        5     /* one or more whitespace chars */
45
46/*
47 * extended character classification macros
48 */
49
50#define ISOCTAL(CH)     ( (CH>='0')  && (CH<='7') )
51#define ISQUOTE(CH)     ( (CH=='\"') || (CH=='\'') || (CH=='`') )
52#define ISWHITESPACE(C) ( (C==' ')   || (C=='\t') )
53#define ISLINEFEED(C)   ( (C=='\n')  || (C=='\r')  || (C=='\f') )
54
55/*
56 * tokens consist of any printable charcacter except comma, equal, or
57 * whitespace
58 */
59
60#define ISTOKENCHAR(C) ((C>040) && (C<0177) && (C != ',') && (C != '='))
61
62/*
63 * the parameter table defines the keywords that will be recognized by
64 * fGetParameterSet, and their default values if not specified.
65 */
66
67typedef struct {
68    char *keyword;
69    char *defvalue;
70    char *value;
71}       parmtable;
72
73#define PARMCOUNT(P) (sizeof(P)/sizeof(P[0]))
74
75#endif /* KPARSE_DEFS */
Note: See TracBrowser for help on using the repository browser.