newer version
authorceriel <none@none>
Fri, 6 Jun 1986 09:35:11 +0000 (09:35 +0000)
committerceriel <none@none>
Fri, 6 Jun 1986 09:35:11 +0000 (09:35 +0000)
lang/m2/comp/LLlex.c
lang/m2/comp/main.c

index 1f87f78..5f4c8b4 100644 (file)
@@ -29,6 +29,9 @@ struct token dot, aside;
 struct type *toktype;
 struct string string;
 int idfsize = IDFSIZE;
+#ifdef DEBUG
+extern int     cntlines;
+#endif
 
 static
 SkipComment()
@@ -43,6 +46,9 @@ SkipComment()
        for (;;) {
                if (class(ch) == STNL) {
                        LineNumber++;
+#ifdef DEBUG
+                       cntlines++;
+#endif
                }
                else
                if (ch == '(') {
@@ -79,6 +85,9 @@ GetString(upto)
                if (class(ch) == STNL)  {
                        lexerror("newline in string");
                        LineNumber++;
+#ifdef DEBUG
+                       cntlines++;
+#endif
                        break;
                }
                if (ch == EOI) {
@@ -129,6 +138,9 @@ again:
 
        case STNL:
                LineNumber++;
+#ifdef DEBUG
+               cntlines++;
+#endif
                tk->tk_lineno++;
                goto again;
 
index 54857dd..79dc43e 100644 (file)
@@ -97,20 +97,17 @@ Compile(src, dst)
        CompUnit();
        C_ms_src((arith) (LineNumber - 1), FileName);
        close_scope(SC_REVERSE);
-       if (err_occurred) {
-               C_close();
-               return 0;
-       }
-       WalkModule(Defined);
-       if (fp_used) {
-               C_ms_flt();
+       if (!err_occurred) {
+               WalkModule(Defined);
+               if (fp_used) {
+                       C_ms_flt();
+               }
        }
        C_close();
 #ifdef DEBUG
-       if (options['m']) MemUse();
+       if (options['i']) Info();
 #endif
-       if (err_occurred) return 0;
-       return 1;
+       return ! err_occurred;
 }
 
 #ifdef DEBUG
@@ -219,7 +216,10 @@ END SYSTEM.\n";
 }
 
 #ifdef DEBUG
-MemUse()
+
+int    cntlines;
+
+Info()
 {
        extern int cnt_def, cnt_node, cnt_paramlist, cnt_type,
                   cnt_switch_hdr, cnt_case_entry, 
@@ -231,5 +231,6 @@ MemUse()
 cnt_def, cnt_node, cnt_paramlist, cnt_type,
 cnt_switch_hdr, cnt_case_entry, 
 cnt_scope, cnt_scopelist, cnt_forwards, cnt_tmpvar);
+print("\nNumber of lines read: %d\n", cntlines);
 }
 #endif