From: ceriel Date: Sat, 24 Jan 1987 00:25:56 +0000 (+0000) Subject: now uses alloc module, bug fixes, -N option under USE_TMP, to not do so X-Git-Tag: release-5-5~4948 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=8116e3181f629b05ff3a11ad9be99db1d13347ce;p=ack.git now uses alloc module, bug fixes, -N option under USE_TMP, to not do so --- diff --git a/lang/cem/cemcom/LLlex.c b/lang/cem/cemcom/LLlex.c index 309b21bb7..f3a5771e3 100644 --- a/lang/cem/cemcom/LLlex.c +++ b/lang/cem/cemcom/LLlex.c @@ -1,6 +1,7 @@ /* $Header$ */ /* L E X I C A L A N A L Y Z E R */ +#include #include "nofloat.h" #include "idfsize.h" #include "numsize.h" @@ -8,7 +9,6 @@ #include "strsize.h" #include "nopp.h" #include "input.h" -#include "alloc.h" #include "arith.h" #include "def.h" #include "idf.h" diff --git a/lang/cem/cemcom/LLmessage.c b/lang/cem/cemcom/LLmessage.c index 2d4ac43b6..cefa9d56f 100644 --- a/lang/cem/cemcom/LLmessage.c +++ b/lang/cem/cemcom/LLmessage.c @@ -1,9 +1,9 @@ /* $Header$ */ /* PARSER ERROR ADMINISTRATION */ +#include #include "nofloat.h" #include "idf.h" -#include "alloc.h" #include "arith.h" #include "LLlex.h" #include "Lpars.h" @@ -12,9 +12,10 @@ extern char *symbol2str(); LLmessage(tk) { err_occurred = 1; - if (tk < 0) - fatal("parser administration overflow"); - if (tk) { + if (tk < 0) { + error("end of file expected"); + } + else if (tk) { error("%s missing", symbol2str(tk)); insert_token(tk); } diff --git a/lang/cem/cemcom/Makefile.erik b/lang/cem/cemcom/Makefile.erik index 0ba8e0f7a..c0eba725c 100644 --- a/lang/cem/cemcom/Makefile.erik +++ b/lang/cem/cemcom/Makefile.erik @@ -18,12 +18,14 @@ STRLIB = $(EMHOME)/modules/lib/libstring.a PRTLIB = $(EMHOME)/modules/lib/libprint.a EMMESLIB = $(EMHOME)/modules/lib/libem_mes.a INPLIB = $(EMHOME)/modules/lib/libinput.a +ALLOCLIB = $(EMHOME)/modules/lib/liballoc.a +MALLOC = $(EMHOME)/modules/lib/malloc.o #CH3LIB = $(EMHOME)/modules/lib/libch3.a CH3LIB = LIBS = $(INPLIB) $(CH3LIB) $(EMMESLIB) $(EMKLIB) \ - $(PRTLIB) $(STRLIB) $(SYSLIB) + $(PRTLIB) $(STRLIB) $(ALLOCLIB) $(MALLOC) $(SYSLIB) ELIBS = $(INPLIB) $(CH3LIB) $(EMMESLIB) $(EMELIB) \ - $(PRTLIB) $(STRLIB) $(SYSLIB) + $(PRTLIB) $(STRLIB) $(ALLOCLIB) $(MALLOC) $(SYSLIB) LIB_INCLUDES = -I$(EMHOME)/modules/h -I$(EMHOME)/modules/pkg EM_INCLUDES = -I$(EMHOME)/h SYSLLIB = $(EMHOME)/modules/lib/llib-lsys.ln @@ -34,9 +36,10 @@ PRTLLIB = $(EMHOME)/modules/lib/llib-lprint.ln EMMESLLIB = $(EMHOME)/modules/lib/llib-lmes.ln INPLLIB = $(EMHOME)/modules/lib/llib-linput.ln CH3LLIB = $(EMHOME)/modules/lib/llib-lch3.ln +ALLOCLLIB = $(EMHOME)/modules/lib/llib-alloc.ln LINTLIBS = #LINTLIBS = $(CH3LLIB) $(INPLLIB) $(EMMESLLIB) $(EMKLLIB) \ -# $(PRTLLIB) $(STRLLIB) $(SYSLLIB) +# $(PRTLLIB) $(STRLLIB) $(SYSLLIB) $(ALLOCLLIB) # Where to install the compiler and its driver CEMCOM = $(DESTINATION)/cemcom @@ -58,16 +61,17 @@ CFLAGS = $(CDEFS) $(COPTIONS) -O# we cannot pass the COPTIONS to lint! # Grammar files and their objects LSRC = tokenfile.g declar.g statement.g expression.g program.g +GLCSRC = tokenfile.c declar.c statement.c expression.c program.c LOBJ = tokenfile.o declar.o statement.o expression.o program.o Lpars.o # Objects of hand-written C files COBJ = main.o idf.o declarator.o decspecs.o struct.o \ expr.o ch7.o ch7bin.o cstoper.o arith.o \ - alloc.o asm.o code.o dumpidf.o error.o field.o\ + asm.o code.o dumpidf.o error.o field.o\ tokenname.o LLlex.o LLmessage.o \ input.o domacro.o replace.o init.o options.o \ scan.o skip.o stack.o type.o ch7mon.o label.o eval.o \ - switch.o storage.o ival.o conversion.o \ + switch.o ival.o conversion.o \ blocks.o dataflow.o # Objects of other generated C files @@ -81,13 +85,13 @@ GSRC = char.c symbol2str.c next.c \ # .h files generated by `make hfiles'; PLEASE KEEP THIS UP-TO-DATE! GHSRC = botch_free.h dataflow.h debug.h density.h errout.h \ idepth.h idfsize.h ifdepth.h inputtype.h inumlength.h lapbuf.h \ - maxincl.h myalloc.h nobitfield.h nofloat.h nopp.h \ + maxincl.h nobitfield.h nofloat.h nopp.h \ nparams.h numsize.h parbufsize.h pathlength.h \ strsize.h target_sizes.h textsize.h use_tmp.h spec_arith.h static.h # Other generated files, for 'make clean' only GENERATED = tab tokenfile.g Lpars.h LLfiles LL.output lint.out \ - print Xref lxref hfiles cfiles + print Xref lxref hfiles cfiles $(GLCSRC) # include files containing ALLOCDEF specifications NEXTFILES = code.str declar.str decspecs.str def.str expr.str field.str \ @@ -211,47 +215,45 @@ sim: cfiles $(SIM) $(SIMFLAGS) `sources $(COBJ)` $(GSRC) $(LSRC) #AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO -main.o: LLlex.h Lpars.h alloc.h arith.h debug.h declar.h file_info.h idf.h input.h inputtype.h level.h maxincl.h myalloc.h nobitfield.h nofloat.h nopp.h spec_arith.h specials.h target_sizes.h tokenname.h type.h use_tmp.h -idf.o: LLlex.h Lpars.h align.h alloc.h arith.h assert.h botch_free.h debug.h declar.h decspecs.h def.h file_info.h idf.h idfsize.h label.h level.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h specials.h stack.h storage.h struct.h type.h -declarator.o: Lpars.h alloc.h arith.h botch_free.h declar.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h storage.h type.h +main.o: LLlex.h Lpars.h arith.h debug.h declar.h file_info.h idf.h input.h inputtype.h level.h maxincl.h nobitfield.h nofloat.h nopp.h spec_arith.h specials.h target_sizes.h tokenname.h type.h use_tmp.h +idf.o: LLlex.h Lpars.h align.h arith.h assert.h botch_free.h debug.h declar.h decspecs.h def.h file_info.h idf.h idfsize.h label.h level.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h specials.h stack.h struct.h type.h +declarator.o: Lpars.h arith.h botch_free.h declar.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h type.h decspecs.o: Lpars.h arith.h decspecs.h def.h level.h nobitfield.h nofloat.h spec_arith.h type.h -struct.o: LLlex.h Lpars.h align.h arith.h assert.h botch_free.h debug.h def.h field.h file_info.h idf.h level.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h stack.h storage.h struct.h type.h -expr.o: LLlex.h Lpars.h alloc.h arith.h botch_free.h declar.h decspecs.h def.h expr.h file_info.h idf.h label.h level.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h storage.h type.h +struct.o: LLlex.h Lpars.h align.h arith.h assert.h botch_free.h debug.h def.h field.h file_info.h idf.h level.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h stack.h struct.h type.h +expr.o: LLlex.h Lpars.h arith.h botch_free.h declar.h decspecs.h def.h expr.h file_info.h idf.h label.h level.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h type.h ch7.o: Lpars.h arith.h assert.h debug.h def.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h struct.h type.h -ch7bin.o: Lpars.h arith.h botch_free.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h storage.h struct.h type.h +ch7bin.o: Lpars.h arith.h botch_free.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h struct.h type.h cstoper.o: Lpars.h arith.h assert.h debug.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h target_sizes.h type.h -arith.o: Lpars.h alloc.h arith.h botch_free.h expr.h field.h idf.h label.h mes.h nobitfield.h nofloat.h nopp.h spec_arith.h storage.h type.h -alloc.o: alloc.h assert.h debug.h myalloc.h -code.o: LLlex.h Lpars.h alloc.h arith.h assert.h atw.h botch_free.h code.h dataflow.h debug.h declar.h decspecs.h def.h expr.h file_info.h idf.h label.h level.h mes.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h specials.h stack.h stmt.h storage.h type.h use_tmp.h +arith.o: Lpars.h arith.h botch_free.h expr.h field.h idf.h label.h mes.h nobitfield.h nofloat.h nopp.h spec_arith.h type.h +code.o: LLlex.h Lpars.h arith.h assert.h atw.h botch_free.h code.h dataflow.h debug.h declar.h decspecs.h def.h expr.h file_info.h idf.h label.h level.h mes.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h specials.h stack.h stmt.h type.h use_tmp.h dumpidf.o: Lpars.h arith.h debug.h def.h expr.h field.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h stack.h static.h struct.h type.h error.o: LLlex.h arith.h debug.h errout.h expr.h file_info.h label.h nofloat.h nopp.h spec_arith.h tokenname.h use_tmp.h field.o: Lpars.h arith.h assert.h code.h debug.h expr.h field.h idf.h label.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h type.h tokenname.o: LLlex.h Lpars.h arith.h file_info.h idf.h nofloat.h nopp.h spec_arith.h tokenname.h -LLlex.o: LLlex.h Lpars.h alloc.h arith.h assert.h class.h debug.h def.h file_info.h idf.h idfsize.h input.h nofloat.h nopp.h numsize.h sizes.h spec_arith.h strsize.h -LLmessage.o: LLlex.h Lpars.h alloc.h arith.h file_info.h idf.h nofloat.h nopp.h spec_arith.h +LLlex.o: LLlex.h Lpars.h arith.h assert.h class.h debug.h def.h file_info.h idf.h idfsize.h input.h nofloat.h nopp.h numsize.h sizes.h spec_arith.h strsize.h +LLmessage.o: LLlex.h Lpars.h arith.h file_info.h idf.h nofloat.h nopp.h spec_arith.h input.o: file_info.h input.h inputtype.h nopp.h -domacro.o: LLlex.h Lpars.h alloc.h arith.h assert.h botch_free.h class.h debug.h file_info.h idf.h idfsize.h ifdepth.h input.h interface.h macro.h nofloat.h nopp.h nparams.h parbufsize.h spec_arith.h storage.h textsize.h -replace.o: LLlex.h alloc.h arith.h assert.h class.h debug.h file_info.h idf.h input.h interface.h macro.h nofloat.h nopp.h pathlength.h spec_arith.h static.h strsize.h -init.o: alloc.h class.h idf.h interface.h macro.h nopp.h -options.o: align.h arith.h class.h idf.h idfsize.h macro.h maxincl.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h storage.h use_tmp.h +domacro.o: LLlex.h Lpars.h arith.h assert.h botch_free.h class.h debug.h file_info.h idf.h idfsize.h ifdepth.h input.h interface.h macro.h nofloat.h nopp.h nparams.h parbufsize.h spec_arith.h textsize.h +replace.o: LLlex.h arith.h assert.h class.h debug.h file_info.h idf.h input.h interface.h macro.h nofloat.h nopp.h pathlength.h spec_arith.h static.h strsize.h +init.o: class.h idf.h interface.h macro.h nopp.h +options.o: align.h arith.h botch_free.h class.h idf.h idfsize.h macro.h maxincl.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h use_tmp.h scan.o: class.h idf.h input.h interface.h lapbuf.h macro.h nopp.h nparams.h skip.o: LLlex.h arith.h class.h file_info.h input.h interface.h nofloat.h nopp.h spec_arith.h -stack.o: Lpars.h alloc.h arith.h botch_free.h debug.h def.h idf.h level.h mes.h nobitfield.h nofloat.h nopp.h spec_arith.h stack.h storage.h struct.h type.h use_tmp.h -type.o: Lpars.h align.h alloc.h arith.h def.h idf.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h storage.h type.h -ch7mon.o: Lpars.h arith.h botch_free.h def.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h storage.h type.h +stack.o: Lpars.h arith.h botch_free.h debug.h def.h idf.h level.h mes.h nobitfield.h nofloat.h nopp.h spec_arith.h stack.h struct.h type.h use_tmp.h +type.o: Lpars.h align.h arith.h botch_free.h def.h idf.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h type.h +ch7mon.o: Lpars.h arith.h botch_free.h def.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h type.h label.o: Lpars.h arith.h def.h idf.h label.h level.h nobitfield.h nofloat.h nopp.h spec_arith.h type.h eval.o: Lpars.h align.h arith.h assert.h atw.h code.h dataflow.h debug.h def.h expr.h idf.h label.h level.h mes.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h stack.h type.h -switch.o: Lpars.h arith.h assert.h botch_free.h code.h debug.h density.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h storage.h switch.h type.h -storage.o: alloc.h assert.h botch_free.h debug.h storage.h +switch.o: Lpars.h arith.h assert.h botch_free.h code.h debug.h density.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h switch.h type.h ival.o: Lpars.h align.h arith.h assert.h class.h debug.h def.h expr.h field.h idf.h label.h level.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h struct.h type.h conversion.o: Lpars.h arith.h nobitfield.h nofloat.h sizes.h spec_arith.h type.h blocks.o: arith.h atw.h label.h nofloat.h sizes.h spec_arith.h stack.h dataflow.o: dataflow.h tokenfile.o: Lpars.h -declar.o: LLlex.h Lpars.h arith.h debug.h declar.h decspecs.h def.h expr.h field.h file_info.h idf.h label.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h storage.h struct.h type.h -statement.o: LLlex.h Lpars.h arith.h botch_free.h code.h debug.h def.h expr.h file_info.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h stack.h storage.h type.h +declar.o: LLlex.h Lpars.h arith.h debug.h declar.h decspecs.h def.h expr.h field.h file_info.h idf.h label.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h struct.h type.h +statement.o: LLlex.h Lpars.h arith.h botch_free.h code.h debug.h def.h expr.h file_info.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h stack.h type.h expression.o: LLlex.h Lpars.h arith.h expr.h file_info.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h type.h -program.o: LLlex.h Lpars.h alloc.h arith.h code.h declar.h decspecs.h def.h expr.h file_info.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h type.h +program.o: LLlex.h Lpars.h arith.h code.h declar.h decspecs.h def.h expr.h file_info.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h type.h Lpars.o: Lpars.h char.o: class.h symbol2str.o: Lpars.h diff --git a/lang/cem/cemcom/Parameters b/lang/cem/cemcom/Parameters index 5466fb21a..9e1cf5470 100644 --- a/lang/cem/cemcom/Parameters +++ b/lang/cem/cemcom/Parameters @@ -1,9 +1,3 @@ -!File: myalloc.h -#define OWNALLOC 1 /* use own superfast allocation */ -#define ALLOCSIZ 4096 /* allocate pieces of 4K */ -#define ALIGNSIZE 8 /* needed for alloc.c */ - - !File: pathlength.h #define PATHLENGTH 1024 /* max. length of path to file */ @@ -35,7 +29,7 @@ !File: maxincl.h -#define MAXINCL 8 /* maximum number of #include directories */ +#define MAXINCL 12 /* maximum number of #include directories */ !File: density.h diff --git a/lang/cem/cemcom/arith.c b/lang/cem/cemcom/arith.c index d628ad495..62cfae762 100644 --- a/lang/cem/cemcom/arith.c +++ b/lang/cem/cemcom/arith.c @@ -7,17 +7,16 @@ semantics of C is a mess. */ -#include "nofloat.h" #include "botch_free.h" +#include +#include "nofloat.h" #include "nobitfield.h" -#include "alloc.h" #include "idf.h" #include "arith.h" #include "type.h" #include "label.h" #include "expr.h" #include "Lpars.h" -#include "storage.h" #include "field.h" #include "mes.h" @@ -202,7 +201,6 @@ arith2arith(tp, oper, expr) */ register struct expr *new = new_expr(); - clear((char *)new, sizeof(struct expr)); new->ex_file = expr->ex_file; new->ex_line = expr->ex_line; new->ex_type = tp; diff --git a/lang/cem/cemcom/ch7bin.c b/lang/cem/cemcom/ch7bin.c index 7f9ff0841..aaddacc65 100644 --- a/lang/cem/cemcom/ch7bin.c +++ b/lang/cem/cemcom/ch7bin.c @@ -1,8 +1,9 @@ /* $Header$ */ /* SEMANTIC ANALYSIS (CHAPTER 7RM) -- BINARY OPERATORS */ -#include "nofloat.h" #include "botch_free.h" +#include +#include "nofloat.h" #include "idf.h" #include "arith.h" #include "type.h" @@ -10,7 +11,6 @@ #include "label.h" #include "expr.h" #include "Lpars.h" -#include "storage.h" extern char options[]; extern char *symbol2str(); diff --git a/lang/cem/cemcom/ch7mon.c b/lang/cem/cemcom/ch7mon.c index e42ef4fe9..1bc3090fd 100644 --- a/lang/cem/cemcom/ch7mon.c +++ b/lang/cem/cemcom/ch7mon.c @@ -1,15 +1,15 @@ /* $Header$ */ /* SEMANTIC ANALYSIS (CHAPTER 7RM) -- MONADIC OPERATORS */ +#include "botch_free.h" +#include #include "nofloat.h" #include "nobitfield.h" -#include "botch_free.h" #include "Lpars.h" #include "arith.h" #include "type.h" #include "label.h" #include "expr.h" -#include "storage.h" #include "idf.h" #include "def.h" diff --git a/lang/cem/cemcom/code.c b/lang/cem/cemcom/code.c index 688a338a6..18b7a1f4b 100644 --- a/lang/cem/cemcom/code.c +++ b/lang/cem/cemcom/code.c @@ -1,18 +1,18 @@ /* $Header$ */ /* C O D E - G E N E R A T I N G R O U T I N E S */ -#include "nofloat.h" #include +#include "botch_free.h" +#include +#include "nofloat.h" #include "dataflow.h" #include "use_tmp.h" -#include "botch_free.h" #include "arith.h" #include "type.h" #include "idf.h" #include "label.h" #include "code.h" #include "stmt.h" -#include "alloc.h" #include "def.h" #include "expr.h" #include "sizes.h" @@ -24,7 +24,6 @@ #include "mes.h" #include "LLlex.h" #include "specials.h" -#include "storage.h" #include "atw.h" #include "assert.h" @@ -47,9 +46,10 @@ init_code(dst_file) C_init(word_size, pointer_size); /* initialise EM module */ if (C_open(dst_file) == 0) fatal("cannot write to %s\n", dst_file); -#ifndef USE_TMP - famous_first_words(); +#ifdef USE_TMP + if (options['N']) #endif USE_TMP + famous_first_words(); } famous_first_words() @@ -171,7 +171,9 @@ begin_proc(name, def) /* to be called when entering a procedure */ arith size; register struct type *tp = def->df_type; -#ifndef USE_TMP +#ifdef USE_TMP + if (options['N']) code_scope(name,def); +#else USE_TMP code_scope(name, def); #endif USE_TMP #ifdef DATAFLOW @@ -326,9 +328,10 @@ code_declaration(idf, expr, lvl, sc) ) def->df_alloc = ALLOC_SEEN; if (expr) { /* code only if initialized */ -#ifndef USE_TMP +#ifdef USE_TMP + if (options['N']) +#endif USE_TMP code_scope(text, def); -#endif USE_TMP def->df_alloc = ALLOC_DONE; C_df_dnam(text); do_ival(&(def->df_type), expr); @@ -364,9 +367,10 @@ code_declaration(idf, expr, lvl, sc) case GLOBAL: case IMPLICIT: /* we are sure there is no expression */ -#ifndef USE_TMP - code_scope(text, def); +#ifdef USE_TMP + if (options['N']) #endif USE_TMP + code_scope(text, def); break; case AUTO: case REGISTER: @@ -433,9 +437,10 @@ bss(idf) */ arith size = idf->id_def->df_type->tp_size; -#ifndef USE_TMP - code_scope(idf->id_text, idf->id_def); +#ifdef USE_TMP + if (options['N']) #endif USE_TMP + code_scope(idf->id_text, idf->id_def); /* Since bss() is only called if df_alloc is non-zero, and since df_alloc is only non-zero if size >= 0, we have: */ diff --git a/lang/cem/cemcom/code.str b/lang/cem/cemcom/code.str index b2ca234de..2f22cd5c5 100644 --- a/lang/cem/cemcom/code.str +++ b/lang/cem/cemcom/code.str @@ -8,7 +8,7 @@ struct string_cst { /* storing string constants */ label sc_dlb; }; -/* ALLOCDEF "string_cst" */ +/* ALLOCDEF "string_cst" 10 */ #define LVAL 0 #define RVAL 1 diff --git a/lang/cem/cemcom/declar.g b/lang/cem/cemcom/declar.g index 71f8202a8..b2f795b42 100644 --- a/lang/cem/cemcom/declar.g +++ b/lang/cem/cemcom/declar.g @@ -2,6 +2,7 @@ /* DECLARATION SYNTAX PARSER */ { +#include #include "nobitfield.h" #include "debug.h" #include "arith.h" @@ -16,7 +17,6 @@ #include "label.h" #include "expr.h" #include "sizes.h" -#include "storage.h" extern char options[]; } diff --git a/lang/cem/cemcom/declar.str b/lang/cem/cemcom/declar.str index c9c197ac3..fc802225e 100644 --- a/lang/cem/cemcom/declar.str +++ b/lang/cem/cemcom/declar.str @@ -13,7 +13,7 @@ struct declarator { struct formal *dc_formal; /* params for function */ }; -/* ALLOCDEF "declarator" */ +/* ALLOCDEF "declarator" 50 */ struct formal { /* list of formals */ @@ -21,7 +21,7 @@ struct formal { /* list of formals */ struct idf *fm_idf; }; -/* ALLOCDEF "formal" */ +/* ALLOCDEF "formal" 5 */ #define NO_PARAMS ((struct formal *) 0) @@ -31,7 +31,7 @@ struct decl_unary { arith du_count; /* for ARRAYs only */ }; -/* ALLOCDEF "decl_unary" */ +/* ALLOCDEF "decl_unary" 10 */ extern struct type *declare_type(); extern struct declarator null_declarator; diff --git a/lang/cem/cemcom/declarator.c b/lang/cem/cemcom/declarator.c index f1a1eb2e3..934f1b3f3 100644 --- a/lang/cem/cemcom/declarator.c +++ b/lang/cem/cemcom/declarator.c @@ -2,12 +2,11 @@ /* D E C L A R A T O R M A N I P U L A T I O N */ #include "botch_free.h" -#include "alloc.h" +#include #include "arith.h" #include "type.h" #include "Lpars.h" #include "declar.h" -#include "storage.h" #include "idf.h" #include "label.h" #include "expr.h" @@ -43,7 +42,6 @@ add_decl_unary(dc, fund, count, fm) */ register struct decl_unary *new = new_decl_unary(); - clear((char *)new, sizeof(struct decl_unary)); new->next = dc->dc_decl_unary; new->du_fund = fund; new->du_count = count; diff --git a/lang/cem/cemcom/decspecs.str b/lang/cem/cemcom/decspecs.str index 817646134..f5229cac9 100644 --- a/lang/cem/cemcom/decspecs.str +++ b/lang/cem/cemcom/decspecs.str @@ -10,6 +10,6 @@ struct decspecs { int ds_unsigned; /* 0 or 1 */ }; -/* ALLOCDEF "decspecs" */ +/* ALLOCDEF "decspecs" 50 */ extern struct decspecs null_decspecs; diff --git a/lang/cem/cemcom/def.str b/lang/cem/cemcom/def.str index 14b07dea8..0ac5df198 100644 --- a/lang/cem/cemcom/def.str +++ b/lang/cem/cemcom/def.str @@ -26,4 +26,4 @@ struct def { /* for ordinary tags */ #define REG_DEFAULT 1 /* register candidate, not declared as such */ #define REG_BONUS 10 /* register candidate, declared as such */ -/* ALLOCDEF "def" */ +/* ALLOCDEF "def" 50 */ diff --git a/lang/cem/cemcom/domacro.c b/lang/cem/cemcom/domacro.c index cb8173f78..abf248193 100644 --- a/lang/cem/cemcom/domacro.c +++ b/lang/cem/cemcom/domacro.c @@ -18,10 +18,9 @@ #include "textsize.h" #include "idfsize.h" #include "assert.h" -#include "alloc.h" +#include #include "class.h" #include "macro.h" -#include "storage.h" IMPORT char *inctable[]; /* list of include directories */ IMPORT char *getwdir(); diff --git a/lang/cem/cemcom/expr.c b/lang/cem/cemcom/expr.c index cdfaa5a5a..5d27d6a4c 100644 --- a/lang/cem/cemcom/expr.c +++ b/lang/cem/cemcom/expr.c @@ -3,7 +3,7 @@ #include "nofloat.h" #include "botch_free.h" -#include "alloc.h" +#include #include "idf.h" #include "arith.h" #include "def.h" @@ -14,7 +14,6 @@ #include "Lpars.h" #include "decspecs.h" #include "declar.h" -#include "storage.h" #include "sizes.h" #include "level.h" @@ -122,7 +121,6 @@ dot2expr(expp) pointer to which is stored in *expp. */ *expp = new_expr(); - clear((char *)*expp, sizeof(struct expr)); (*expp)->ex_file = dot.tk_file; (*expp)->ex_line = dot.tk_line; switch (DOT) { @@ -248,7 +246,6 @@ intexpr(ivalue, fund) */ register struct expr *expr = new_expr(); - clear((char *)expr, sizeof(struct expr)); expr->ex_file = dot.tk_file; expr->ex_line = dot.tk_line; fill_int_expr(expr, ivalue, fund); @@ -308,7 +305,6 @@ new_oper(tp, e1, oper, e2) register struct expr *expr = new_expr(); register struct oper *op; - clear((char *)expr, sizeof(struct expr)); if (e2) { register struct expr *e = e2; diff --git a/lang/cem/cemcom/expr.str b/lang/cem/cemcom/expr.str index 47d0f07c9..5739cc23c 100644 --- a/lang/cem/cemcom/expr.str +++ b/lang/cem/cemcom/expr.str @@ -101,6 +101,6 @@ struct expr { extern struct expr *intexpr(), *new_oper(); -/* ALLOCDEF "expr" */ +/* ALLOCDEF "expr" 50 */ #define ISCOMMA(e) ((e)->ex_class == Oper && (e)->OP_OPER == INITCOMMA) diff --git a/lang/cem/cemcom/field.str b/lang/cem/cemcom/field.str index 79830abc6..cdb82a13a 100644 --- a/lang/cem/cemcom/field.str +++ b/lang/cem/cemcom/field.str @@ -9,4 +9,4 @@ struct field { /* for field specifiers */ struct sdef *fd_sdef; /* upward pointer */ }; -/* ALLOCDEF "field" */ +/* ALLOCDEF "field" 50 */ diff --git a/lang/cem/cemcom/idf.c b/lang/cem/cemcom/idf.c index 9baace1f3..252587d82 100644 --- a/lang/cem/cemcom/idf.c +++ b/lang/cem/cemcom/idf.c @@ -6,7 +6,7 @@ #include "idfsize.h" #include "botch_free.h" #include "nopp.h" -#include "alloc.h" +#include #include "arith.h" #include "align.h" #include "LLlex.h" @@ -23,7 +23,6 @@ #include "Lpars.h" #include "assert.h" #include "specials.h" /* registration of special identifiers */ -#include "storage.h" int idfsize = IDFSIZE; extern char options[]; @@ -73,7 +72,6 @@ idf_hashed(tg, size, hc) } /* a new struct idf must be inserted at the hook */ notch = new_idf(); - clear((char *)notch, sizeof(struct idf)); notch->next = *hook; *hook = notch; /* hooked in */ notch->id_text = Salloc(tg, size); @@ -303,7 +301,6 @@ declare_idf(ds, dc, lvl) else { /* fill in the def block */ register struct def *newdef = new_def(); - clear((char *)newdef, sizeof(struct def)); newdef->next = def; newdef->df_level = lvl; newdef->df_type = type; diff --git a/lang/cem/cemcom/idf.str b/lang/cem/cemcom/idf.str index abba9f6b2..9896c7240 100644 --- a/lang/cem/cemcom/idf.str +++ b/lang/cem/cemcom/idf.str @@ -37,7 +37,7 @@ struct idf { int id_special; /* special action needed at occurrence */ }; -/* ALLOCDEF "idf" */ +/* ALLOCDEF "idf" 50 */ extern struct idf *str2idf(), *idf_hashed(); diff --git a/lang/cem/cemcom/init.c b/lang/cem/cemcom/init.c index 20c120e25..ab4628413 100644 --- a/lang/cem/cemcom/init.c +++ b/lang/cem/cemcom/init.c @@ -5,7 +5,7 @@ #ifndef NOPP #include -#include "alloc.h" +#include #include "class.h" #include "macro.h" #include "idf.h" diff --git a/lang/cem/cemcom/macro.str b/lang/cem/cemcom/macro.str index ef3243278..2772b4d06 100644 --- a/lang/cem/cemcom/macro.str +++ b/lang/cem/cemcom/macro.str @@ -27,7 +27,7 @@ struct macro { char mc_flag; /* marking this macro */ }; -/* ALLOCDEF "macro" */ +/* ALLOCDEF "macro" 20 */ /* `token' numbers of keywords of command-line processor */ diff --git a/lang/cem/cemcom/main.c b/lang/cem/cemcom/main.c index 28d67c2b7..4a97f5e3a 100644 --- a/lang/cem/cemcom/main.c +++ b/lang/cem/cemcom/main.c @@ -6,7 +6,6 @@ #include "nopp.h" #include "target_sizes.h" #include "debug.h" -#include "myalloc.h" #include "use_tmp.h" #include "maxincl.h" #include "inputtype.h" @@ -19,7 +18,7 @@ #include "tokenname.h" #include "Lpars.h" #include "LLlex.h" -#include "alloc.h" +#include #include "specials.h" extern struct tokenname tkidf[], tkother[]; @@ -79,10 +78,6 @@ main(argc, argv) /* parse and interpret the command line options */ prog_name = argv[0]; -#ifdef OWNALLOC - init_mem(); -#endif OWNALLOC - init_hmask(); #ifndef NOPP @@ -106,12 +101,6 @@ main(argc, argv) } compile(argc - 1, &argv[1]); -#ifdef OWNALLOC -#ifdef DEBUG - mem_stat(); -#endif DEBUG -#endif OWNALLOC - #ifdef DEBUG hash_stat(); #endif DEBUG @@ -164,9 +153,11 @@ compile(argc, argv) source = strcmp(argv[0], "-") ? argv[0] : 0; #ifdef USE_TMP - strcpy(tmpf, tmpfdir); - strcat(tmpf, tmpfname); - tmpfile = mktemp(tmpf); + if (! options['N']) { + strcpy(tmpf, tmpfdir); + strcat(tmpf, tmpfname); + tmpfile = mktemp(tmpf); + } #endif USE_TMP if (destination && strcmp(destination, "-") == 0) @@ -189,7 +180,11 @@ compile(argc, argv) #endif NOPP #ifdef USE_TMP - init_code(tmpfile); + if (!options['N']) { + init_code(tmpfile); + } + else + init_code(destination); #else USE_TMP init_code(destination); #endif USE_TMP @@ -199,9 +194,11 @@ compile(argc, argv) end_code(); #ifdef USE_TMP - prepend_scopes(destination); - AppendFile(tmpfile, destination); - sys_remove(tmpfile); + if (! options['N']) { + prepend_scopes(destination); + AppendFile(tmpfile, destination); + sys_remove(tmpfile); + } #endif USE_TMP #ifdef DEBUG diff --git a/lang/cem/cemcom/make.allocd b/lang/cem/cemcom/make.allocd index d692801e0..08492fad1 100755 --- a/lang/cem/cemcom/make.allocd +++ b/lang/cem/cemcom/make.allocd @@ -1,8 +1,8 @@ -sed ' -s:^.*ALLOCDEF.*"\(.*\)".*$:\ +sed -e ' +s:^.*[ ]ALLOCDEF[ ].*"\(.*\)"[ ]*\([0-9][0-9]*\).*$:\ /* allocation definitions of struct \1 */\ +extern char *st_alloc();\ extern struct \1 *h_\1;\ -#define new_\1() ((struct \1 *) \\\ - st_alloc((char **)\&h_\1, sizeof(struct \1)))\ -#define free_\1(p) st_free(p, h_\1, sizeof(struct \1))\ +#define new_\1() ((struct \1 *) st_alloc((char **)\&h_\1, sizeof(struct \1), \2))\ +#define free_\1(p) st_free(p, \&h_\1, sizeof(struct \1))\ :' diff --git a/lang/cem/cemcom/options.c b/lang/cem/cemcom/options.c index cebf13e12..67f82cf6e 100644 --- a/lang/cem/cemcom/options.c +++ b/lang/cem/cemcom/options.c @@ -1,6 +1,8 @@ /* $Header$ */ /* U S E R O P T I O N - H A N D L I N G */ +#include "botch_free.h" +#include #include "nofloat.h" #include "nopp.h" #include "idfsize.h" @@ -12,7 +14,6 @@ #include "arith.h" #include "sizes.h" #include "align.h" -#include "storage.h" #include "use_tmp.h" #ifndef NOPP @@ -126,6 +127,14 @@ do_option(text) fatal("maximum identifier length is %d", IDFSIZE); break; + case 'N' : +#ifdef USE_TMP + options['N'] = 1; +#else USE_TMP + warning("-N option ignored"); +#endif USE_TMP + break; + case 'P' : /* run preprocessor stand-alone, without #'s */ #ifndef NOPP options['E'] = 1; diff --git a/lang/cem/cemcom/program.g b/lang/cem/cemcom/program.g index 91b460279..c818df55b 100644 --- a/lang/cem/cemcom/program.g +++ b/lang/cem/cemcom/program.g @@ -42,7 +42,6 @@ { #include "nopp.h" -#include "alloc.h" #include "arith.h" #include "LLlex.h" #include "idf.h" diff --git a/lang/cem/cemcom/replace.c b/lang/cem/cemcom/replace.c index 7f99c8797..cc0c49d79 100644 --- a/lang/cem/cemcom/replace.c +++ b/lang/cem/cemcom/replace.c @@ -7,7 +7,7 @@ #include "debug.h" /* UF */ #include "pathlength.h" /* UF */ #include "strsize.h" /* UF */ -#include "alloc.h" +#include #include "idf.h" #include "input.h" #include "macro.h" diff --git a/lang/cem/cemcom/stack.c b/lang/cem/cemcom/stack.c index 237fdf2e7..206a8f764 100644 --- a/lang/cem/cemcom/stack.c +++ b/lang/cem/cemcom/stack.c @@ -6,9 +6,8 @@ #include #include #include "debug.h" -#include "use_tmp.h" #include "botch_free.h" -#include "alloc.h" +#include #include "Lpars.h" #include "arith.h" #include "stack.h" @@ -16,7 +15,6 @@ #include "idf.h" #include "def.h" #include "struct.h" -#include "storage.h" #include "level.h" #include "mes.h" @@ -43,7 +41,6 @@ stack_level() { */ register struct stack_level *stl = new_stack_level(); - clear((char *)stl, sizeof(struct stack_level)); local_level->sl_next = stl; stl->sl_previous = local_level; stl->sl_level = ++level; @@ -60,7 +57,6 @@ stack_idf(idf, stl) */ register struct stack_entry *se = new_stack_entry(); - clear((char *)se, sizeof(struct stack_entry)); /* link it into the stack level */ se->next = stl->sl_entry; se->se_idf = idf; diff --git a/lang/cem/cemcom/stack.str b/lang/cem/cemcom/stack.str index b2776ea4d..fa7de66e6 100644 --- a/lang/cem/cemcom/stack.str +++ b/lang/cem/cemcom/stack.str @@ -16,14 +16,14 @@ struct stack_level { int sl_level; }; -/* ALLOCDEF "stack_level" */ +/* ALLOCDEF "stack_level" 5 */ struct stack_entry { struct stack_entry *next; struct idf *se_idf; }; -/* ALLOCDEF "stack_entry" */ +/* ALLOCDEF "stack_entry" 5 */ extern struct stack_level *local_level; extern struct stack_level *stack_level_of(); diff --git a/lang/cem/cemcom/statement.g b/lang/cem/cemcom/statement.g index 466bec8b5..2d3793205 100644 --- a/lang/cem/cemcom/statement.g +++ b/lang/cem/cemcom/statement.g @@ -14,7 +14,6 @@ #include "label.h" #include "expr.h" #include "code.h" -#include "storage.h" #include "stack.h" #include "def.h" diff --git a/lang/cem/cemcom/stmt.str b/lang/cem/cemcom/stmt.str index 7a79df973..82c02e143 100644 --- a/lang/cem/cemcom/stmt.str +++ b/lang/cem/cemcom/stmt.str @@ -7,4 +7,4 @@ struct stmt_block { label st_continue; }; -/* ALLOCDEF "stmt_block" */ +/* ALLOCDEF "stmt_block" 5 */ diff --git a/lang/cem/cemcom/struct.c b/lang/cem/cemcom/struct.c index 2728738e8..37471cb3f 100644 --- a/lang/cem/cemcom/struct.c +++ b/lang/cem/cemcom/struct.c @@ -4,6 +4,7 @@ #include "nobitfield.h" #include "debug.h" #include "botch_free.h" +#include #include "arith.h" #include "stack.h" #include "idf.h" @@ -15,7 +16,6 @@ #include "Lpars.h" #include "align.h" #include "level.h" -#include "storage.h" #include "assert.h" #include "sizes.h" @@ -308,7 +308,6 @@ idf2sdef(idf, tp) if (!is_anon_idf(idf)) error("unknown selector %s", idf->id_text); *sdefp = sdef = new_sdef(); - clear((char *)sdef, sizeof(struct sdef)); sdef->sd_idf = idf; sdef->sd_stype = sdef->sd_type = error_type; return sdef; diff --git a/lang/cem/cemcom/struct.str b/lang/cem/cemcom/struct.str index 9c3c51f15..150e09896 100644 --- a/lang/cem/cemcom/struct.str +++ b/lang/cem/cemcom/struct.str @@ -11,7 +11,7 @@ struct sdef { /* for selectors */ arith sd_offset; }; -/* ALLOCDEF "sdef" */ +/* ALLOCDEF "sdef" 50 */ struct tag { /* for struct-, union- and enum tags */ struct tag *next; @@ -21,6 +21,6 @@ struct tag { /* for struct-, union- and enum tags */ }; -/* ALLOCDEF "tag" */ +/* ALLOCDEF "tag" 50 */ struct sdef *idf2sdef(); diff --git a/lang/cem/cemcom/switch.c b/lang/cem/cemcom/switch.c index 759b97dc0..b3f853056 100644 --- a/lang/cem/cemcom/switch.c +++ b/lang/cem/cemcom/switch.c @@ -5,6 +5,7 @@ #include #include "debug.h" #include "botch_free.h" +#include #include "density.h" #include "Lpars.h" #include "idf.h" @@ -12,7 +13,6 @@ #include "arith.h" #include "switch.h" #include "code.h" -#include "storage.h" #include "assert.h" #include "expr.h" #include "type.h" diff --git a/lang/cem/cemcom/switch.str b/lang/cem/cemcom/switch.str index 9f95fc0fb..ffce9b978 100644 --- a/lang/cem/cemcom/switch.str +++ b/lang/cem/cemcom/switch.str @@ -13,7 +13,7 @@ struct switch_hdr { struct case_entry *sh_entries; }; -/* ALLOCDEF "switch_hdr" */ +/* ALLOCDEF "switch_hdr" 2 */ struct case_entry { struct case_entry *next; @@ -21,4 +21,4 @@ struct case_entry { arith ce_value; }; -/* ALLOCDEF "case_entry" */ +/* ALLOCDEF "case_entry" 40 */ diff --git a/lang/cem/cemcom/type.c b/lang/cem/cemcom/type.c index 6243395e9..5461d19cc 100644 --- a/lang/cem/cemcom/type.c +++ b/lang/cem/cemcom/type.c @@ -3,7 +3,8 @@ #include "nofloat.h" #include "nobitfield.h" -#include "alloc.h" +#include "botch_free.h" +#include #include "Lpars.h" #include "arith.h" #include "type.h" @@ -11,7 +12,6 @@ #include "def.h" #include "sizes.h" #include "align.h" -#include "storage.h" struct type *function_of(), *array_of(); #ifndef NOBITFIELD @@ -44,7 +44,6 @@ create_type(fund) */ register struct type *ntp = new_type(); - clear((char *)ntp, sizeof(struct type)); ntp->tp_fund = fund; ntp->tp_size = (arith)-1; diff --git a/lang/cem/cemcom/type.str b/lang/cem/cemcom/type.str index 13fad9db7..278023510 100644 --- a/lang/cem/cemcom/type.str +++ b/lang/cem/cemcom/type.str @@ -44,4 +44,4 @@ extern struct type *pa_type; /* type.c */ extern arith size_of_type(), align(); -/* ALLOCDEF "type" */ +/* ALLOCDEF "type" 50 */