removed tab.c, use tabgen, and some fixes

This commit is contained in:
ceriel 1988-11-16 15:18:21 +00:00
parent 4b5e5a9764
commit 430dad523d
7 changed files with 34 additions and 50 deletions

View file

@ -5,7 +5,6 @@ Makefile
Parameters Parameters
body.c body.c
casestat.C casestat.C
char.c
char.tab char.tab
chk_expr.c chk_expr.c
chk_expr.h chk_expr.h
@ -39,7 +38,6 @@ make.tokcase
make.tokfile make.tokfile
misc.c misc.c
misc.h misc.h
next.c
node.H node.H
node.c node.c
options.c options.c
@ -50,7 +48,6 @@ required.h
scope.H scope.H
scope.c scope.c
statement.g statement.g
tab.c
tmpvar.C tmpvar.C
tokenname.c tokenname.c
tokenname.h tokenname.h

View file

@ -21,9 +21,9 @@ MALLOC = $(LIBDIR)/malloc.o
LFLAGS = $(PROFILE) LFLAGS = $(PROFILE)
LSRC = declar.c expression.c program.c statement.c tokenfile.c LSRC = declar.c expression.c program.c statement.c tokenfile.c
LOBJ = declar.o expression.o program.o statement.o tokenfile.o 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\ 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 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\ 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\ 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! # Keep the next entries up to date!
GENCFILES= Lpars.c declar.c expression.c program.c statement.c\ 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) SRC = Lpars.c $(CSRC) $(GENCFILES)
GENGFILES= tokenfile.g GENGFILES= tokenfile.g
GENHFILES= Lpars.h debugcst.h density.h errout.h idfsize.h inputtype.h\ 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 next.c: $(NEXTFILES) ./make.next
./make.next $(NEXTFILES) > next.c ./make.next $(NEXTFILES) > next.c
char.c: char.tab tab char.c: char.tab
tab -fchar.tab > char.c $(EMHOME)/bin/tabgen -fchar.tab > char.c
tab:
$(CC) tab.c -o tab
depend: depend:
sed '/^#AUTOAUTO/,$$d' Makefile > Makefile.new sed '/^#AUTOAUTO/,$$d' Makefile > Makefile.new
echo '#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO' >> Makefile.new echo '#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO' >> Makefile.new

View file

@ -4,11 +4,10 @@
% %
% CHARACTER CLASSES % CHARACTER CLASSES
% %
%C %iSTGARB
STGARB:\000-\200
STSKIP: \r\t STSKIP: \r\t
STNL:\012\013\014 STNL:\012\013\014
STSIMP:()*+,-/;=@[]^{} STSIMP:-()*+,/;=@[]^{}
STCOMP:.:<> STCOMP:.:<>
STIDF:a-zA-Z STIDF:a-zA-Z
STSTR:' STSTR:'

View file

@ -19,7 +19,7 @@ int fp_used;
CodeFil() CodeFil()
{ {
if( !options['L'] ) if ( !options['L'] )
C_fil_dlb((label) 1, (arith) 0); C_fil_dlb((label) 1, (arith) 0);
} }
@ -107,9 +107,9 @@ CodeBeginBlock(df)
offset = CodeGtoDescr(df->prc_vis->sc_scope); offset = CodeGtoDescr(df->prc_vis->sc_scope);
CodeFil(); CodeFil();
/* %%% initialiseren external files %%% */ /* initialize external files */
make_con(); call_ini(); /* %%%TYDELIJK%%% */ make_extfl();
call_ini();
break; break;
case D_PROCEDURE : case D_PROCEDURE :

View file

@ -70,7 +70,7 @@ struct def { /* list of definitions for a name */
/* link all definitions in a scope */ /* link all definitions in a scope */
struct idf *df_idf; /* link back to the name */ struct idf *df_idf; /* link back to the name */
struct scope *df_scope; /* scope in which this definition resides */ 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_PROCEDURE 0x00001 /* procedure */
#define D_FUNCTION 0x00002 /* function */ #define D_FUNCTION 0x00002 /* function */
#define D_TYPE 0x00004 /* a type */ #define D_TYPE 0x00004 /* a type */

View file

@ -54,11 +54,11 @@ EnterProgList(Idlist)
df->df_flags |= (D_PROGPAR | D_NOREG); df->df_flags |= (D_PROGPAR | D_NOREG);
if( !strcmp(input, idlist->nd_IDF->id_text) ) { if( !strcmp(input, idlist->nd_IDF->id_text) ) {
df->var_name = input; df->var_name = input;
set_inp(); /* %%% */ set_inp();
} }
else { else {
df->var_name = output; df->var_name = output;
set_outp(); /* %%% */ set_outp();
} }
} }
} }
@ -66,7 +66,7 @@ EnterProgList(Idlist)
if( df = define(idlist->nd_IDF, CurrentScope, if( df = define(idlist->nd_IDF, CurrentScope,
D_PARAMETER) ) { D_PARAMETER) ) {
df->df_type = error_type; df->df_type = error_type;
set_prog(df); /* %%% */ df->df_flags |= D_PROGPAR;
} }
} }

View file

@ -1,8 +1,5 @@
/* TYDELYK !!!!!! */
#include "debug.h" #include "debug.h"
#include <assert.h>
#include <em.h> #include <em.h>
#include "LLlex.h" #include "LLlex.h"
@ -11,10 +8,10 @@
#include "scope.h" #include "scope.h"
#include "type.h" #include "type.h"
arith cnt = 2; /* standaard input & output */ static int extflc; /* number of external files */
int inpflag = 0; /* std input gedefinieerd of niet */ static int inpflag = 0; /* input mentioned in heading ? */
int outpflag = 0; /* std output gedefinieerd of niet */ static int outpflag = 0; /* output mentioned in heading ? */
label con_label; static label extfl_label; /* label of array of file pointers */
set_inp() set_inp()
{ {
@ -26,46 +23,39 @@ set_outp()
outpflag = 1; outpflag = 1;
} }
set_prog(df) make_extfl()
struct def *df;
{
cnt++;
df->df_flags |= 0x40;
}
make_con()
{ {
register struct def *df; register struct def *df;
con_label = ++data_label; extfl_label = ++data_label;
C_df_dlb(con_label); C_df_dlb(extfl_label);
C_con_cst(cnt);
if( inpflag ) if( inpflag )
C_con_dnam("input", (arith) 0); C_con_dnam(input, (arith) 0);
else else
C_con_cst((arith) -1); C_con_ucon("0", pointer_size);
if( outpflag ) if( outpflag )
C_con_dnam("output", (arith) 0); C_con_dnam(output, (arith) 0);
else else
C_con_cst((arith) -1); C_con_ucon("0", pointer_size);
extflc = 2;
for( df = GlobalScope->sc_def; df; df = df->df_nextinscope ) 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); C_con_dnam(df->var_name, (arith) 0);
cnt--; extflc++;
} }
assert(cnt == 2);
} }
call_ini() call_ini()
{ {
C_lxl((arith) 0); C_lxl((arith) 0);
C_lae_dlb(con_label, (arith) 0); C_lae_dlb(extfl_label, (arith) 0);
C_zer(pointer_size); C_loc((arith) extflc);
C_lxa((arith) 0); C_lxa((arith) 0);
C_cal("_ini"); C_cal("_ini");
C_asp(4 * pointer_size); C_asp(3 * pointer_size + word_size);
} }