OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [lcc/] [cpp/] [cpp.h.ORIG] - Blame information for rev 292

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 hellwig
/* $Id: cpp.h,v 1.6 2001/06/04 22:42:04 drh Exp $ */
2
#include 
3
#define INS     32768           /* input buffer */
4
#define OBS     4096            /* outbut buffer */
5
#define NARG    32              /* Max number arguments to a macro */
6
#define NINCLUDE 32             /* Max number of include directories (-I) */
7
#define NIF     32              /* depth of nesting of #if */
8
#ifndef EOF
9
#define EOF     (-1)
10
#endif
11
#ifndef NULL
12
#define NULL    0
13
#endif
14
 
15
#ifndef __alpha
16
typedef unsigned char uchar;
17
#endif
18
 
19
enum toktype { END, UNCLASS, NAME, NUMBER, STRING, CCON, NL, WS, DSHARP,
20
                EQ, NEQ, LEQ, GEQ, LSH, RSH, LAND, LOR, PPLUS, MMINUS,
21
                ARROW, SBRA, SKET, LP, RP, DOT, AND, STAR, PLUS, MINUS,
22
                TILDE, NOT, SLASH, PCT, LT, GT, CIRC, OR, QUEST,
23
                COLON, ASGN, COMMA, SHARP, SEMIC, CBRA, CKET,
24
                ASPLUS, ASMINUS, ASSTAR, ASSLASH, ASPCT, ASCIRC, ASLSH,
25
                ASRSH, ASOR, ASAND, ELLIPS,
26
                DSHARP1, NAME1, DEFINED, UMINUS };
27
 
28
enum kwtype { KIF, KIFDEF, KIFNDEF, KELIF, KELSE, KENDIF, KINCLUDE, KDEFINE,
29
                KUNDEF, KLINE, KERROR, KPRAGMA, KDEFINED,
30
                KLINENO, KFILE, KDATE, KTIME, KSTDC, KEVAL };
31
 
32
#define ISDEFINED       01      /* has #defined value */
33
#define ISKW            02      /* is PP keyword */
34
#define ISUNCHANGE      04      /* can't be #defined in PP */
35
#define ISMAC           010     /* builtin macro, e.g. __LINE__ */
36
 
37
#define EOB     0xFE            /* sentinel for end of input buffer */
38
#define EOFC    0xFD            /* sentinel for end of input file */
39
#define XPWS    1               /* token flag: white space to assure token sep. */
40
 
41
typedef struct token {
42
        unsigned char   type;
43
        unsigned char   flag;
44
        unsigned short  hideset;
45
        unsigned int    wslen;
46
        unsigned int    len;
47
        uchar   *t;
48
} Token;
49
 
50
typedef struct tokenrow {
51
        Token   *tp;            /* current one to scan */
52
        Token   *bp;            /* base (allocated value) */
53
        Token   *lp;            /* last+1 token used */
54
        int     max;            /* number allocated */
55
} Tokenrow;
56
 
57
typedef struct source {
58
        char    *filename;      /* name of file of the source */
59
        int     line;           /* current line number */
60
        int     lineinc;        /* adjustment for \\n lines */
61
        uchar   *inb;           /* input buffer */
62
        uchar   *inp;           /* input pointer */
63
        uchar   *inl;           /* end of input */
64
        FILE*   fd;             /* input source */
65
        int     ifdepth;        /* conditional nesting in include */
66
        struct  source *next;   /* stack for #include */
67
} Source;
68
 
69
typedef struct nlist {
70
        struct nlist *next;
71
        uchar   *name;
72
        int     len;
73
        Tokenrow *vp;           /* value as macro */
74
        Tokenrow *ap;           /* list of argument names, if any */
75
        char    val;            /* value as preprocessor name */
76
        char    flag;           /* is defined, is pp name */
77
} Nlist;
78
 
79
typedef struct  includelist {
80
        char    deleted;
81
        char    always;
82
        char    *file;
83
} Includelist;
84
 
85
#define new(t)  (t *)domalloc(sizeof(t))
86
#define quicklook(a,b)  (namebit[(a)&077] & (1<<((b)&037)))
87
#define quickset(a,b)   namebit[(a)&077] |= (1<<((b)&037))
88
extern  unsigned long namebit[077+1];
89
 
90
enum errtype { WARNING, ERROR, FATAL };
91
 
92
void    expandlex(void);
93
void    fixlex(void);
94
void    setup(int, char **);
95
int     gettokens(Tokenrow *, int);
96
int     comparetokens(Tokenrow *, Tokenrow *);
97
Source  *setsource(char *, FILE *, char *);
98
void    unsetsource(void);
99
void    puttokens(Tokenrow *);
100
void    process(Tokenrow *);
101
void    *domalloc(int);
102
void    dofree(void *);
103
void    error(enum errtype, char *, ...);
104
void    flushout(void);
105
int     fillbuf(Source *);
106
int     trigraph(Source *);
107
int     foldline(Source *);
108
Nlist   *lookup(Token *, int);
109
void    control(Tokenrow *);
110
void    dodefine(Tokenrow *);
111
void    doadefine(Tokenrow *, int);
112
void    doinclude(Tokenrow *);
113
void    doif(Tokenrow *, enum kwtype);
114
void    expand(Tokenrow *, Nlist *);
115
void    builtin(Tokenrow *, int);
116
int     gatherargs(Tokenrow *, Tokenrow **, int *);
117
void    substargs(Nlist *, Tokenrow *, Tokenrow **);
118
void    expandrow(Tokenrow *, char *);
119
void    maketokenrow(int, Tokenrow *);
120
Tokenrow *copytokenrow(Tokenrow *, Tokenrow *);
121
Token   *growtokenrow(Tokenrow *);
122
Tokenrow *normtokenrow(Tokenrow *);
123
void    adjustrow(Tokenrow *, int);
124
void    movetokenrow(Tokenrow *, Tokenrow *);
125
void    insertrow(Tokenrow *, int, Tokenrow *);
126
void    peektokens(Tokenrow *, char *);
127
void    doconcat(Tokenrow *);
128
Tokenrow *stringify(Tokenrow *);
129
int     lookuparg(Nlist *, Token *);
130
long    eval(Tokenrow *, int);
131
void    genline(void);
132
void    setempty(Tokenrow *);
133
void    makespace(Tokenrow *);
134
char    *outnum(char *, int);
135
int     digit(int);
136
uchar   *newstring(uchar *, int, int);
137
int     checkhideset(int, Nlist *);
138
void    prhideset(int);
139
int     newhideset(int, Nlist *);
140
int     unionhideset(int, int);
141
void    iniths(void);
142
void    setobjname(char *);
143
#define rowlen(tokrow)  ((tokrow)->lp - (tokrow)->bp)
144
 
145
extern  char *outp;
146
extern  Token   nltoken;
147
extern  Source *cursource;
148
extern  char *curtime;
149
extern  int incdepth;
150
extern  int ifdepth;
151
extern  int ifsatisfied[NIF];
152
extern  int Mflag;
153
extern  int skipping;
154
extern  int verbose;
155
extern  int Cplusplus;
156
extern  Nlist *kwdefined;
157
extern  Includelist includelist[NINCLUDE];
158
extern  char wd[];

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.