From 430dad523d61ae5a0666b14b4937be979b5a8647 Mon Sep 17 00:00:00 2001 From: ceriel Date: Wed, 16 Nov 1988 15:18:21 +0000 Subject: [PATCH] removed tab.c, use tabgen, and some fixes --- lang/pc/comp/.distr | 3 --- lang/pc/comp/Makefile | 12 +++++------ lang/pc/comp/char.tab | 5 ++--- lang/pc/comp/code.c | 8 ++++---- lang/pc/comp/def.H | 2 +- lang/pc/comp/enter.c | 6 +++--- lang/pc/comp/progs.c | 48 +++++++++++++++++-------------------------- 7 files changed, 34 insertions(+), 50 deletions(-) diff --git a/lang/pc/comp/.distr b/lang/pc/comp/.distr index 5cd8e7635..8d8e03622 100644 --- a/lang/pc/comp/.distr +++ b/lang/pc/comp/.distr @@ -5,7 +5,6 @@ Makefile Parameters body.c casestat.C -char.c char.tab chk_expr.c chk_expr.h @@ -39,7 +38,6 @@ make.tokcase make.tokfile misc.c misc.h -next.c node.H node.c options.c @@ -50,7 +48,6 @@ required.h scope.H scope.c statement.g -tab.c tmpvar.C tokenname.c tokenname.h diff --git a/lang/pc/comp/Makefile b/lang/pc/comp/Makefile index e0a190b7f..656d9d699 100644 --- a/lang/pc/comp/Makefile +++ b/lang/pc/comp/Makefile @@ -21,9 +21,9 @@ MALLOC = $(LIBDIR)/malloc.o LFLAGS = $(PROFILE) LSRC = declar.c expression.c program.c statement.c tokenfile.c LOBJ = declar.o expression.o program.o statement.o tokenfile.o -CSRC = LLlex.c LLmessage.c body.c char.c chk_expr.c code.c\ +CSRC = LLlex.c LLmessage.c body.c chk_expr.c code.c\ cstoper.c def.c desig.c enter.c error.c idf.c input.c label.c\ - lookup.c main.c misc.c next.c node.c options.c readwrite.c\ + lookup.c main.c misc.c node.c options.c readwrite.c\ scope.c symbol2str.c tokenname.c type.c typequiv.c progs.c COBJ = LLlex.o LLmessage.o body.o casestat.o char.o chk_expr.o code.o\ cstoper.o def.o desig.o enter.o error.o idf.o input.o label.o\ @@ -33,7 +33,7 @@ OBJ = Lpars.o $(COBJ) $(LOBJ) # Keep the next entries up to date! GENCFILES= Lpars.c declar.c expression.c program.c statement.c\ - tokenfile.c symbol2str.c casestat.c tmpvar.c + tokenfile.c symbol2str.c casestat.c tmpvar.c char.c next.c SRC = Lpars.c $(CSRC) $(GENCFILES) GENGFILES= tokenfile.g GENHFILES= Lpars.h debugcst.h density.h errout.h idfsize.h inputtype.h\ @@ -95,11 +95,9 @@ tmpvar.c: make.allocd next.c: $(NEXTFILES) ./make.next ./make.next $(NEXTFILES) > next.c -char.c: char.tab tab - tab -fchar.tab > char.c +char.c: char.tab + $(EMHOME)/bin/tabgen -fchar.tab > char.c -tab: - $(CC) tab.c -o tab depend: sed '/^#AUTOAUTO/,$$d' Makefile > Makefile.new echo '#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO' >> Makefile.new diff --git a/lang/pc/comp/char.tab b/lang/pc/comp/char.tab index 0e485107b..c6ac2b994 100644 --- a/lang/pc/comp/char.tab +++ b/lang/pc/comp/char.tab @@ -4,11 +4,10 @@ % % CHARACTER CLASSES % -%C -STGARB:\000-\200 +%iSTGARB STSKIP: \r\t STNL:\012\013\014 -STSIMP:()*+,-/;=@[]^{} +STSIMP:-()*+,/;=@[]^{} STCOMP:.:<> STIDF:a-zA-Z STSTR:' diff --git a/lang/pc/comp/code.c b/lang/pc/comp/code.c index 4b614f49a..c69bd4514 100644 --- a/lang/pc/comp/code.c +++ b/lang/pc/comp/code.c @@ -19,7 +19,7 @@ int fp_used; CodeFil() { - if( !options['L'] ) + if ( !options['L'] ) C_fil_dlb((label) 1, (arith) 0); } @@ -107,9 +107,9 @@ CodeBeginBlock(df) offset = CodeGtoDescr(df->prc_vis->sc_scope); CodeFil(); - /* %%% initialiseren external files %%% */ - make_con(); call_ini(); /* %%%TYDELIJK%%% */ - + /* initialize external files */ + make_extfl(); + call_ini(); break; case D_PROCEDURE : diff --git a/lang/pc/comp/def.H b/lang/pc/comp/def.H index 078b96de8..843fc7b56 100644 --- a/lang/pc/comp/def.H +++ b/lang/pc/comp/def.H @@ -70,7 +70,7 @@ struct def { /* list of definitions for a name */ /* link all definitions in a scope */ struct idf *df_idf; /* link back to the name */ struct scope *df_scope; /* scope in which this definition resides */ - unsigned int df_kind; /* the kind of this definition: */ + long df_kind; /* the kind of this definition: */ #define D_PROCEDURE 0x00001 /* procedure */ #define D_FUNCTION 0x00002 /* function */ #define D_TYPE 0x00004 /* a type */ diff --git a/lang/pc/comp/enter.c b/lang/pc/comp/enter.c index 2691a1ebd..c3d612c0c 100644 --- a/lang/pc/comp/enter.c +++ b/lang/pc/comp/enter.c @@ -54,11 +54,11 @@ EnterProgList(Idlist) df->df_flags |= (D_PROGPAR | D_NOREG); if( !strcmp(input, idlist->nd_IDF->id_text) ) { df->var_name = input; - set_inp(); /* %%% */ + set_inp(); } else { df->var_name = output; - set_outp(); /* %%% */ + set_outp(); } } } @@ -66,7 +66,7 @@ EnterProgList(Idlist) if( df = define(idlist->nd_IDF, CurrentScope, D_PARAMETER) ) { df->df_type = error_type; - set_prog(df); /* %%% */ + df->df_flags |= D_PROGPAR; } } diff --git a/lang/pc/comp/progs.c b/lang/pc/comp/progs.c index 31f8230f6..0b7dfbdc6 100644 --- a/lang/pc/comp/progs.c +++ b/lang/pc/comp/progs.c @@ -1,8 +1,5 @@ -/* TYDELYK !!!!!! */ - #include "debug.h" -#include #include #include "LLlex.h" @@ -11,10 +8,10 @@ #include "scope.h" #include "type.h" -arith cnt = 2; /* standaard input & output */ -int inpflag = 0; /* std input gedefinieerd of niet */ -int outpflag = 0; /* std output gedefinieerd of niet */ -label con_label; +static int extflc; /* number of external files */ +static int inpflag = 0; /* input mentioned in heading ? */ +static int outpflag = 0; /* output mentioned in heading ? */ +static label extfl_label; /* label of array of file pointers */ set_inp() { @@ -26,46 +23,39 @@ set_outp() outpflag = 1; } -set_prog(df) - struct def *df; -{ - cnt++; - df->df_flags |= 0x40; -} - -make_con() +make_extfl() { register struct def *df; - con_label = ++data_label; - C_df_dlb(con_label); - C_con_cst(cnt); + extfl_label = ++data_label; + C_df_dlb(extfl_label); if( inpflag ) - C_con_dnam("input", (arith) 0); + C_con_dnam(input, (arith) 0); else - C_con_cst((arith) -1); + C_con_ucon("0", pointer_size); if( outpflag ) - C_con_dnam("output", (arith) 0); + C_con_dnam(output, (arith) 0); else - C_con_cst((arith) -1); + C_con_ucon("0", pointer_size); + + extflc = 2; for( df = GlobalScope->sc_def; df; df = df->df_nextinscope ) - if( df->df_flags & 0x40 ) { + if( (df->df_flags & D_PROGPAR) && + df->var_name != input && df->var_name != output) { C_con_dnam(df->var_name, (arith) 0); - cnt--; + extflc++; } - - assert(cnt == 2); } call_ini() { C_lxl((arith) 0); - C_lae_dlb(con_label, (arith) 0); - C_zer(pointer_size); + C_lae_dlb(extfl_label, (arith) 0); + C_loc((arith) extflc); C_lxa((arith) 0); C_cal("_ini"); - C_asp(4 * pointer_size); + C_asp(3 * pointer_size + word_size); } -- 2.34.1