Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.9
 
1.10
 
MAIN:ragge:20060805102429
 
token.c
_>3434 
 3535 #include "cpp.h"
 3636 
<> 37+#ifndef ragge
3738 /* definition for include file info */
 3839 struct includ {
 3940         struct includ *next;
     
 !
4647         usch *buffer;
 4748         usch bbuf[NAMEMAX+CPPBUF+1];
 4849 } *ifiles;
<> 50+#endif
4951 
 5052 usch *yyp, *yystr, yybuf[CPPBUF];
 5153 
     
 !
113115         return input();
 114116 }
 115117 
<> 118+#ifdef ragge
  119+/*
  120+ * Get next character from input stream.  If the input buffer is empty,
  121+ * try to fill it up. If end of stream, return -1.
  122+ */
  123+static int
  124+inpch(struct includ *ic)
  125+{
  126+        int len;
  127+
  128+        if (ic->curptr < ic->maxread)
  129+                return *ic->curptr++;
  130+
  131+        if ((len = read(ic->infil, ic->buffer, CPPBUF)) < 0)
  132+                error("read error on file %s", ic->fname);
  133+        if (len == 0)
  134+                return -1;
  135+        ic->curptr = ic->buffer;
  136+        ic->maxread = ic->buffer + len;
  137+        return inpch(ic);
  138+}
  139+/*
  140+ * Get next character from the current input stream.
  141+ * Also handles phase 1 and 2 in section 5.1.1.2 "Translation phases"
  142+ * in the C99 standard (trigraphs and \\n).
  143+ * Only newlines that are removed here are accounted for, and when found
  144+ * return GOTNL to tell that a \n must be printed out (to avoid line breaks
  145+ * in strings etc).
  146+ */
  147+int
  148+inch(struct includ *ic)
  149+{
  150+        int c;
  151+
  152+        if (ic->curptr < ic->maxread)
  153+                c = *ic->curptr++;
  154+        else
  155+                c = inpch(ic);
  156+
  157+        if (c != '\\' && c != '?')
  158+                return c; /* common case */
  159+        /* first check for trigraphs */
  160+        if (c == '?') {
  161+                if ((c = inpch(ic)) != '?') {
  162+                        unch(ic, c);
  163+                        return '?';
  164+                }
  165+                switch (c = input()) {
  166+                case '=': c = '#'; break;
  167+                case '(': c = '['; break;
  168+                case ')': c = ']'; break;
  169+                case '<': c = '{'; break;
  170+                case '>': c = '}'; break;
  171+                case '/': c = '\\'; break;
  172+                case '\'': c = '^'; break;
  173+                case '!': c = '|'; break;
  174+                case '-': c = '~'; break;
  175+                default:
  176+                        unch(ic, c);
  177+                        unch(ic, '?');
  178+                        return '?';
  179+                }
  180+        }
  181+        /* search for \\n */
  182+        if (c == '\\') {
  183+                if ((c = inpch(ic)) != '\n') {
  184+                        unch(ic, c);
  185+                        return '\\';
  186+                }
  187+                ic->lineno++;
  188+                c = GOTNL;
  189+        }
  190+        return c;
  191+}
  192+
  193+void
  194+unch(struct includ *ic, int c)
  195+{
  196+        *--ic->curptr = c;
  197+}
  198+
  199+void
  200+outch(int c)
  201+{
  202+        putc(c, obuf);
  203+}
  204+
  205+#endif
  206+
116207 static void
 117208 unput(int c)
 118209 {
     
 !
430521         ic->maxread = ic->curptr;
 431522         unput('\n');
 432523 
<> 524+#ifdef ragge
  525+        scanover(ic);
  526+#else
433527         mainscan();
<> 528+#endif
<_434529 
 435530         if (trulvl != otrulvl || flslvl != oflslvl)
 436531                 error("unterminated conditional");
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-30 02:11 +0200