Quick Search:

Mode

Context

Displaying the whole file. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.65
 
1.66
 
MAIN:plunky:20121107095159
 
cpp.h
_>11 /*      $Id$    */
 22 
 33 /*
 44  * Copyright (c) 2004,2010 Anders Magnusson (ragge@ludd.luth.se).
 55  * All rights reserved.
 66  *
 77  * Redistribution and use in source and binary forms, with or without
 88  * modification, are permitted provided that the following conditions
 99  * are met:
 1010  * 1. Redistributions of source code must retain the above copyright
 1111  *    notice, this list of conditions and the following disclaimer.
 1212  * 2. Redistributions in binary form must reproduce the above copyright
 1313  *    notice, this list of conditions and the following disclaimer in the
 1414  *    documentation and/or other materials provided with the distribution.
 1515  *
 1616  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 1717  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 1818  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 1919  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 2020  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 2121  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 2222  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 2323  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 2424  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 2525  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 2626  */
 2727 
 2828 #include <stdio.h>      /* for debug/printf */
 2929 
 3030 typedef unsigned char usch;
 3131 extern usch yytext[];
 3232 extern usch *stringbuf;
 3333 
 3434 extern  int     trulvl;
 3535 extern  int     flslvl;
 3636 extern  int     elflvl;
 3737 extern  int     elslvl;
 3838 extern  int     dflag;
 3939 extern  int     tflag, Cflag, Pflag;
 4040 extern  int     Mflag, dMflag, MPflag;
 4141 extern  usch    *Mfile, *MPfile;
 4242 extern  int     ofd;
 4343 extern  int     defining;
 4444 
 4545 /* args for lookup() */
 4646 #define FIND    0
 4747 #define ENTER   1
 4848 
 4949 /* buffer used internally */
 5050 #ifndef CPPBUF
 5151 #if defined(mach_pdp11)
 5252 #define CPPBUF  BUFSIZ
 5353 #define BUF_STACK
 5454 #elif defined(os_win32)
 5555 /* winxp seems to fail > 26608 bytes */
 5656 #define CPPBUF  16384
 5757 #else
 5858 #define CPPBUF  (65536*2)
 5959 #endif
 6060 #endif
 6161 
 6262 #define MAXARGS 128     /* Max # of args to a macro. Should be enough */
 6363 
 6464 #define NAMEMAX CPPBUF  /* currently pushbackbuffer */
 6565 #define BBUFSZ  (NAMEMAX+CPPBUF+1)
 6666 
 6767 #define GCCARG  0xfd    /* has gcc varargs that may be replaced with 0 */
 6868 #define VARG    0xfe    /* has varargs */
 6969 #define OBJCT   0xff
 7070 #define WARN    1       /* SOH, not legal char */
 7171 #define CONC    2       /* STX, not legal char */
 7272 #define SNUFF   3       /* ETX, not legal char */
 7373 #define EBLOCK  4       /* EOT, not legal char */
 7474 #define PHOLD   5       /* ENQ, not legal char */
 7575 
 7676 /* Used in macro expansion */
 7777 #define RECMAX  10000                   /* max # of recursive macros */
 7878 extern struct symtab *norep[RECMAX];
 7979 extern int norepptr;
 8080 extern unsigned short bptr[RECMAX];
 8181 extern int bidx;
 8282 #define MKB(l,h)        (l+((h)<<8))
 8383 
 8484 /* quick checks for some characters */
 8585 #define C_SPEC  0001            /* for fastscan() parsing */
 8686 #define C_2     0002            /* for yylex() tokenizing */
 8787 #define C_WSNL  0004            /* ' ','\t','\r','\n' */
 8888 #define C_ID    0010            /* [_a-zA-Z0-9] */
 8989 #define C_ID0   0020            /* [_a-zA-Z] */
 9090 #define C_EP    0040            /* [epEP] */
 9191 #define C_DIGIT 0100            /* [0-9] */
 9292 #define C_HEX   0200            /* [0-9a-fA-F] */
 9393 
 9494 extern usch spechr[];
 9595 
 9696 #define iswsnl(x)       (spechr[x] & (C_WSNL))
 9797 
 9898 /* definition for include file info */
 9999 struct includ {
 100100         struct includ *next;
 101101         const usch *fname;      /* current fn, changed if #line found */
 102102         const usch *orgfn;      /* current fn, not changed */
 103103         int lineno;
<> 104+        int escln;              /* escaped newlines, to be added */
<_104105         int infil;
 105106         usch *curptr;
 106107         usch *maxread;
 107108         usch *ostr;
 108109         usch *buffer;
 109110         int idx;
 110111         void *incs;
 111112         const usch *fn;
 112113 #ifdef BUF_STACK
 113114         usch bbuf[BBUFSZ];
 114115 #else
 115116         usch *bbuf;
 116117 #endif
 117118 };
 118119 #define INCINC 0
 119120 #define SYSINC 1
 120121 
 121122 extern struct includ *ifiles;
 122123 
 123124 /* Symbol table entry  */
 124125 struct symtab {
 125126         const usch *namep;   
 126127         const usch *value;   
 127128         const usch *file;
 128129         int line;
 129130 };
 130131 
 131132 struct initar {
 132133         struct initar *next;
 133134         int type;
 134135         char *str;
 135136 };
 136137 
 137138 /*
 138139  * Struct used in parse tree evaluation.
 139140  * op is one of:
 140141  *      - number type (NUMBER, UNUMBER)
 141142  *      - zero (0) if divided by zero.
 142143  */
 143144 struct nd {
 144145         int op;
 145146         union {
 146147                 long long val;
 147148                 unsigned long long uval;
 148149         } n;
 149150 };
 150151 
 151152 #define nd_val n.val
 152153 #define nd_uval n.uval
 153154 
 154155 struct symtab *lookup(const usch *namep, int enterf);
 155156 usch *gotident(struct symtab *nl);
 156157 int submac(struct symtab *nl, int);
 157158 int kfind(struct symtab *nl);
 158159 int doexp(void);
 159160 int donex(void);
 160161 void ppdir(void);
 161162 
 162163 void define(void);
 163164 void include(void);
 164165 void include_next(void);
 165166 void line(void);
 166167 
 167168 int pushfile(const usch *fname, const usch *fn, int idx, void *incs);
 168169 void popfile(void);
 169170 void prtline(void);
 170171 int yylex(void);
 171172 int sloscan(void);
 172173 void cunput(int);
 173174 int curline(void);
 174175 char *curfile(void);
 175176 void setline(int);
 176177 void setfile(char *);
 177178 int yyparse(void);
 178179 void unpstr(const usch *);
 179180 usch *savstr(const usch *str);
 180181 void savch(int c);
 181182 void mainscan(void);
 182183 void putch(int);
 183184 void putstr(const usch *s);
 184185 void line(void);
 185186 usch *sheap(const char *fmt, ...);
 186187 void warning(const char *fmt, ...);
 187188 void error(const char *fmt, ...);
 188189 int cinput(void);
 189190 void getcmnt(void);
 190191 void xwrite(int, const void *, unsigned int);
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-09-21 12:09 +0200