written by Robert Henry; add Berkeley specific header
[unix-history] / usr / src / usr.bin / error / input.c
index 5332f78..479be94 100644 (file)
@@ -1,4 +1,19 @@
-static char *sccsid = "@(#)input.c     1.9 (Berkeley) 84/05/08";
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)input.c    5.2 (Berkeley) %G%";
+#endif /* not lint */
+
 #include <stdio.h>
 #include <ctype.h>
 #include "error.h"
 #include <stdio.h>
 #include <ctype.h>
 #include "error.h"
@@ -22,6 +37,7 @@ Errorclass    f77();
 Errorclass     pi();
 Errorclass     ri();
 Errorclass     troff();
 Errorclass     pi();
 Errorclass     ri();
 Errorclass     troff();
+Errorclass     mod2();
 /*
  *     Eat all of the lines in the input file, attempting to categorize
  *     them by their various flavors
 /*
  *     Eat all of the lines in the input file, attempting to categorize
  *     them by their various flavors
@@ -57,6 +73,7 @@ eaterrors(r_errorc, r_errorv)
           || (( errorclass = f77() ) != C_UNKNOWN)
           || ((errorclass = pi() ) != C_UNKNOWN)
           || (( errorclass = ri() )!= C_UNKNOWN)
           || (( errorclass = f77() ) != C_UNKNOWN)
           || ((errorclass = pi() ) != C_UNKNOWN)
           || (( errorclass = ri() )!= C_UNKNOWN)
+          || (( errorclass = mod2() )!= C_UNKNOWN)
           || (( errorclass = troff() )!= C_UNKNOWN))
        ) ;
        else
           || (( errorclass = troff() )!= C_UNKNOWN))
        ) ;
        else
@@ -363,6 +380,7 @@ Errorclass lint3()
 char   *F77_fatal[3] = {"Compiler", "error", "line"};
 char   *F77_error[3] = {"Error", "on", "line"};
 char   *F77_warning[3] = {"Warning", "on", "line"};
 char   *F77_fatal[3] = {"Compiler", "error", "line"};
 char   *F77_error[3] = {"Error", "on", "line"};
 char   *F77_warning[3] = {"Warning", "on", "line"};
+char    *F77_no_ass[3] = {"Error.","No","assembly."};
 f77()
 {
        char    **nwordv;
 f77()
 {
        char    **nwordv;
@@ -374,7 +392,12 @@ f77()
         *              Compiler error line %d of %s: %s
         *              Error on line %d of %s: %s
         *              Warning on line %d of %s: %s
         *              Compiler error line %d of %s: %s
         *              Error on line %d of %s: %s
         *              Warning on line %d of %s: %s
+        *              Error.  No assembly.
         */
         */
+       if (wordc == 3 && wordvcmp(wordv+1, 3, F77_no_ass) == 0) {
+               wordc = 0;
+               return(C_SYNC);
+       }
        if (wordc < 6)
                return(C_UNKNOWN);
        if (    (lastchar(wordv[6]) == ':')
        if (wordc < 6)
                return(C_UNKNOWN);
        if (    (lastchar(wordv[6]) == ':')
@@ -477,3 +500,26 @@ Errorclass troff()
        }
        return(C_UNKNOWN);
 }
        }
        return(C_UNKNOWN);
 }
+Errorclass mod2()
+{
+       /*
+        *      for decwrl modula2 compiler (powell)
+        */
+       if (   (  (strcmp(wordv[1], "!!!") == 0)        /* early version */
+               ||(strcmp(wordv[1], "File") == 0))      /* later version */
+           && (lastchar(wordv[2]) == ',')      /* file name */
+           && (strcmp(wordv[3], "line") == 0)
+           && (isdigit(firstchar(wordv[4])))   /* line number */
+           && (lastchar(wordv[4]) == ':')      /* line number */
+       ){
+               clob_last(wordv[2], '\0');      /* drop last , on file name */
+               clob_last(wordv[4], '\0');      /* drop last : on line number */
+               wordv[3] = wordv[2];            /* file name on top of "line" */
+               wordv += 2;
+               wordc -= 2;
+               currentfilename = wordv[1];
+               language = INMOD2;
+               return(C_TRUE);
+       }
+       return(C_UNKNOWN);
+}