fixes to preprocessor part
authorceriel <none@none>
Fri, 7 Aug 1987 19:53:54 +0000 (19:53 +0000)
committerceriel <none@none>
Fri, 7 Aug 1987 19:53:54 +0000 (19:53 +0000)
lang/cem/cemcom/domacro.c
lang/cem/cemcom/input.c
lang/cem/cemcom/scan.c

index a1dbbc6..b788cbe 100644 (file)
@@ -31,7 +31,7 @@ IMPORT char *getwdir();
 PRIVATE char ifstack[IFDEPTH]; /* if-stack: the content of an entry is */
                                /* 1 if a corresponding ELSE has been   */
                                /* encountered.                         */
-PRIVATE int nestlevel = -1;    /* initially no nesting level.          */
+int nestlevel = -1;            /* initially no nesting level.          */
 
 PRIVATE struct idf *
 GetIdentifier()
index b0692b7..ff27923 100644 (file)
@@ -44,7 +44,7 @@ int   NoUnstack;
 AtEoIT()
 {
 #ifndef NOPP
-       if (NoUnstack) lexerror("unexpected EOF");
+       if (NoUnstack) lexwarning("unexpected EOF");
        DoUnstack();
 #endif NOPP
        return 0;
@@ -52,6 +52,12 @@ AtEoIT()
 
 AtEoIF()
 {
-       if (NoUnstack) lexerror("unexpected EOF");
+#ifndef NOPP
+       extern int nestlevel;
+
+       if (nestlevel != -1) lexwarning("missing #endif");
+       else
+#endif NOPP
+       if (NoUnstack) lexwarning("unexpected EOF");
        return 0;
 }
index 98f96e4..da83648 100644 (file)
@@ -67,10 +67,11 @@ getactuals(idef)
                */
                lexwarning("argument mismatch, %s", idef->id_text);
 
-               while (++nr_of_params < acnt) {
+               while (nr_of_params < acnt) {
                        /*      too few paraeters: remaining actuals are ""
                        */
                        actparams[nr_of_params] = "";
+                       nr_of_params++;
                }
        }
 
@@ -113,16 +114,19 @@ copyact(ch1, ch2, level)
 
                switch(ch)      {
 
+#ifdef __MATCHING_PAR__
                case ')':
                case '}':
                case ']':
                        lexerror("unbalanced parenthesis");
                        break;
+#endif __MATCHING_PAR__
 
                case '(':
                        copyact('(', ')', level+1);
                        break;
 
+#ifdef __MATCHING_PAR__
                case '{':
                        /*      example:
                                        #define declare(v, t)   t v
@@ -134,6 +138,7 @@ copyact(ch1, ch2, level)
                case '[':
                        copyact('[', ']', level+1);
                        break;
+#endif __MATCHING_PAR__
 
                case '\n':
                        while (LoadChar(ch), ch == '#') {