From 7a9d436a5620cbad87367e777de723101acdd492 Mon Sep 17 00:00:00 2001 From: ceriel Date: Fri, 6 Jun 1986 09:35:11 +0000 Subject: [PATCH] newer version --- lang/m2/comp/LLlex.c | 12 ++++++++++++ lang/m2/comp/main.c | 23 ++++++++++++----------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/lang/m2/comp/LLlex.c b/lang/m2/comp/LLlex.c index 1f87f78b5..5f4c8b437 100644 --- a/lang/m2/comp/LLlex.c +++ b/lang/m2/comp/LLlex.c @@ -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; diff --git a/lang/m2/comp/main.c b/lang/m2/comp/main.c index 54857dddf..79dc43e1a 100644 --- a/lang/m2/comp/main.c +++ b/lang/m2/comp/main.c @@ -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