removed tab.c, use tabgen, and some fixes
authorceriel <none@none>
Wed, 16 Nov 1988 15:18:21 +0000 (15:18 +0000)
committerceriel <none@none>
Wed, 16 Nov 1988 15:18:21 +0000 (15:18 +0000)
lang/pc/comp/.distr
lang/pc/comp/Makefile
lang/pc/comp/char.tab
lang/pc/comp/code.c
lang/pc/comp/def.H
lang/pc/comp/enter.c
lang/pc/comp/progs.c

index 5cd8e76..8d8e036 100644 (file)
@@ -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
index e0a190b..656d9d6 100644 (file)
@@ -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
index 0e48510..c6ac2b9 100644 (file)
@@ -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:'
index 4b614f4..c69bd45 100644 (file)
@@ -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 :
index 078b96d..843fc7b 100644 (file)
@@ -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 */
index 2691a1e..c3d612c 100644 (file)
@@ -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;
                        }
                }
        
index 31f8230..0b7dfbd 100644 (file)
@@ -1,8 +1,5 @@
-/* TYDELYK !!!!!! */
-
 #include       "debug.h"
 
-#include       <assert.h>
 #include       <em.h>
 
 #include       "LLlex.h"
 #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);
 }