Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.64
 
1.65
 
MAIN:plunky:20121031115454
 
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 */
<>85 -#define C_SPEC  001
 86 -#define C_EP    002
 87 -#define C_ID    004
 88 -#define C_I     (C_SPEC|C_ID)           
 89 -#define C_2     010             /* for yylex() tokenizing */
 90 -#define C_WSNL  020             /* ' ','\t','\r','\n' */
 91 -#define iswsnl(x) (spechr[x] & C_WSNL)
 92 -extern char spechr[];
  85+#define C_SPEC  0001            /* for fastscan() parsing */
  86+#define C_2     0002            /* for yylex() tokenizing */
  87+#define C_WSNL  0004            /* ' ','\t','\r','\n' */
  88+#define C_ID    0010            /* [_a-zA-Z0-9] */
  89+#define C_ID0   0020            /* [_a-zA-Z] */
  90+#define C_EP    0040            /* [epEP] */
  91+#define C_DIGIT 0100            /* [0-9] */
  92+#define C_HEX   0200            /* [0-9a-fA-F] */
9393 
<> 94+extern usch spechr[];
  95+
  96+#define iswsnl(x)       (spechr[x] & (C_WSNL))
  97+
<_9498 /* definition for include file info */
 9599 struct includ {
 96100         struct includ *next;
 97101         const usch *fname;      /* current fn, changed if #line found */
 98102         const usch *orgfn;      /* current fn, not changed */
 99103         int lineno;
 100104         int infil;
 101105         usch *curptr;
 102106         usch *maxread;
 103107         usch *ostr;
 104108         usch *buffer;
 105109         int idx;
 106110         void *incs;
 107111         const usch *fn;
 108112 #ifdef BUF_STACK
 109113         usch bbuf[BBUFSZ];
 110114 #else
 111115         usch *bbuf;
 112116 #endif
 113117 };
 114118 #define INCINC 0
 115119 #define SYSINC 1
 116120 
 117121 extern struct includ *ifiles;
 118122 
 119123 /* Symbol table entry  */
 120124 struct symtab {
 121125         const usch *namep;   
 122126         const usch *value;   
 123127         const usch *file;
 124128         int line;
 125129 };
 126130 
 127131 struct initar {
 128132         struct initar *next;
 129133         int type;
 130134         char *str;
 131135 };
 132136 
 133137 /*
 134138  * Struct used in parse tree evaluation.
 135139  * op is one of:
 136140  *      - number type (NUMBER, UNUMBER)
 137141  *      - zero (0) if divided by zero.
 138142  */
 139143 struct nd {
 140144         int op;
 141145         union {
 142146                 long long val;
 143147                 unsigned long long uval;
 144148         } n;
 145149 };
 146150 
 147151 #define nd_val n.val
 148152 #define nd_uval n.uval
 149153 
 150154 struct symtab *lookup(const usch *namep, int enterf);
 151155 usch *gotident(struct symtab *nl);
 152156 int submac(struct symtab *nl, int);
 153157 int kfind(struct symtab *nl);
 154158 int doexp(void);
 155159 int donex(void);
 156160 void ppdir(void);
 157161 
 158162 void define(void);
 159163 void include(void);
 160164 void include_next(void);
 161165 void line(void);
 162166 
 163167 int pushfile(const usch *fname, const usch *fn, int idx, void *incs);
 164168 void popfile(void);
 165169 void prtline(void);
 166170 int yylex(void);
 167171 int sloscan(void);
 168172 void cunput(int);
 169173 int curline(void);
 170174 char *curfile(void);
 171175 void setline(int);
 172176 void setfile(char *);
 173177 int yyparse(void);
 174178 void unpstr(const usch *);
 175179 usch *savstr(const usch *str);
 176180 void savch(int c);
 177181 void mainscan(void);
 178182 void putch(int);
 179183 void putstr(const usch *s);
 180184 void line(void);
 181185 usch *sheap(const char *fmt, ...);
 182186 void warning(const char *fmt, ...);
 183187 void error(const char *fmt, ...);
 184188 int cinput(void);
 185189 void getcmnt(void);
 186190 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-08-27 23:00 +0200