Corrected #error and #define
authorceriel <none@none>
Thu, 11 Apr 1991 10:52:52 +0000 (10:52 +0000)
committerceriel <none@none>
Thu, 11 Apr 1991 10:52:52 +0000 (10:52 +0000)
lang/cem/cemcom.ansi/domacro.c
lang/cem/cpp.ansi/domacro.c

index f42c17a..83e7d32 100644 (file)
@@ -476,15 +476,13 @@ do_undef(argidf)
 
 do_error()
 {
-       static char errbuf[512];
-       register char *bp = errbuf;
-       register int ch;
+       int len;
+       char *get_text();
+       char *bp = get_text((char **) 0, &len);
 
-       while ((ch = GetChar()) != '\n')
-               *bp++ = ch;
-       *bp = '\0';
-       UnGetChar();
-       lexerror("user error: %s", errbuf);
+       lexerror("user error: %s", bp);
+       free(bp);
+       LineNumber++;
 }
 
 int
@@ -652,6 +650,10 @@ get_text(formals, length)
                            if (c == '\\') add2repl(repl, GetChar());
                            c = GetChar();
                        } while (c != delim && c != EOI && class(c) != STNL);
+                       if (c == EOI || class(c) == STNL) {
+                               lexstrict("unclosed opening %c", delim);
+                               break;
+                       }
                        add2repl(repl, c);
                        c = GetChar();
                } else if (c == '/') {
index 0dcedd4..5e68753 100644 (file)
@@ -487,15 +487,13 @@ do_undef(argstr)
 
 do_error()
 {
-       static char errbuf[512];
-       register char *bp = errbuf;
-       register int ch;
+       int len;
+       char *get_text();
+       char *bp = get_text((char **) 0, &len);
 
-       while ((ch = GetChar()) != '\n')
-               *bp++ = ch;
-       *bp = '\0';
-       UnGetChar();
-       error("user error: %s", errbuf);
+       error("user error: %s", bp);
+       free(bp);
+       LineNumber++;
 }
 
 int
@@ -678,6 +676,10 @@ get_text(formals, length)
                                if (c == '\\') add2repl(repl, GetChar());
                                c = GetChar();
                        } while (c != delim && c != EOI && class(c) != STNL);
+                       if (c != delim) {
+                               strict("unclosed opening %c", delim);
+                               break;
+                       }
                        add2repl(repl, c);
                        c = GetChar();
                } else if (c == '/') {