newer version

This commit is contained in:
ceriel 1986-06-06 09:35:11 +00:00
parent caf99ea472
commit 7a9d436a56
2 changed files with 24 additions and 11 deletions

View file

@ -29,6 +29,9 @@ struct token dot, aside;
struct type *toktype; struct type *toktype;
struct string string; struct string string;
int idfsize = IDFSIZE; int idfsize = IDFSIZE;
#ifdef DEBUG
extern int cntlines;
#endif
static static
SkipComment() SkipComment()
@ -43,6 +46,9 @@ SkipComment()
for (;;) { for (;;) {
if (class(ch) == STNL) { if (class(ch) == STNL) {
LineNumber++; LineNumber++;
#ifdef DEBUG
cntlines++;
#endif
} }
else else
if (ch == '(') { if (ch == '(') {
@ -79,6 +85,9 @@ GetString(upto)
if (class(ch) == STNL) { if (class(ch) == STNL) {
lexerror("newline in string"); lexerror("newline in string");
LineNumber++; LineNumber++;
#ifdef DEBUG
cntlines++;
#endif
break; break;
} }
if (ch == EOI) { if (ch == EOI) {
@ -129,6 +138,9 @@ again:
case STNL: case STNL:
LineNumber++; LineNumber++;
#ifdef DEBUG
cntlines++;
#endif
tk->tk_lineno++; tk->tk_lineno++;
goto again; goto again;

View file

@ -97,20 +97,17 @@ Compile(src, dst)
CompUnit(); CompUnit();
C_ms_src((arith) (LineNumber - 1), FileName); C_ms_src((arith) (LineNumber - 1), FileName);
close_scope(SC_REVERSE); close_scope(SC_REVERSE);
if (err_occurred) { if (!err_occurred) {
C_close(); WalkModule(Defined);
return 0; if (fp_used) {
} C_ms_flt();
WalkModule(Defined); }
if (fp_used) {
C_ms_flt();
} }
C_close(); C_close();
#ifdef DEBUG #ifdef DEBUG
if (options['m']) MemUse(); if (options['i']) Info();
#endif #endif
if (err_occurred) return 0; return ! err_occurred;
return 1;
} }
#ifdef DEBUG #ifdef DEBUG
@ -219,7 +216,10 @@ END SYSTEM.\n";
} }
#ifdef DEBUG #ifdef DEBUG
MemUse()
int cntlines;
Info()
{ {
extern int cnt_def, cnt_node, cnt_paramlist, cnt_type, extern int cnt_def, cnt_node, cnt_paramlist, cnt_type,
cnt_switch_hdr, cnt_case_entry, cnt_switch_hdr, cnt_case_entry,
@ -231,5 +231,6 @@ MemUse()
cnt_def, cnt_node, cnt_paramlist, cnt_type, cnt_def, cnt_node, cnt_paramlist, cnt_type,
cnt_switch_hdr, cnt_case_entry, cnt_switch_hdr, cnt_case_entry,
cnt_scope, cnt_scopelist, cnt_forwards, cnt_tmpvar); cnt_scope, cnt_scopelist, cnt_forwards, cnt_tmpvar);
print("\nNumber of lines read: %d\n", cntlines);
} }
#endif #endif