From a968ce843722d035b124cfdb140af41197c895c4 Mon Sep 17 00:00:00 2001 From: erikb Date: Mon, 15 Sep 1986 08:47:53 +0000 Subject: [PATCH] changed some large static data structures into STATIC --- lang/cem/cemcom/Makefile.erik | 8 ++++---- lang/cem/cemcom/Parameters | 3 +++ lang/cem/cemcom/dumpidf.c | 6 ++++-- lang/cem/cemcom/input.c | 16 +++++++++------- lang/cem/cemcom/replace.c | 5 +++-- 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/lang/cem/cemcom/Makefile.erik b/lang/cem/cemcom/Makefile.erik index 73d412c7e..7f8ea21f3 100644 --- a/lang/cem/cemcom/Makefile.erik +++ b/lang/cem/cemcom/Makefile.erik @@ -77,7 +77,7 @@ 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 nopp.h \ nparams.h numsize.h parbufsize.h pathlength.h predefine.h \ - strsize.h target_sizes.h textsize.h use_tmp.h spec_arith.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 \ @@ -217,15 +217,15 @@ cstoper.o: Lpars.h arith.h assert.h debug.h expr.h idf.h label.h nobitfield.h no arith.o: Lpars.h alloc.h arith.h botch_free.h expr.h field.h idf.h label.h mes.h nobitfield.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 idf.h label.h level.h mes.h nobitfield.h nopp.h sizes.h spec_arith.h specials.h stack.h stmt.h storage.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 nopp.h spec_arith.h stack.h struct.h type.h +dumpidf.o: Lpars.h arith.h debug.h def.h expr.h field.h idf.h label.h nobitfield.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 label.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 nopp.h sizes.h spec_arith.h type.h tokenname.o: LLlex.h Lpars.h arith.h idf.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 idf.h idfsize.h input.h nopp.h numsize.h sizes.h spec_arith.h strsize.h LLmessage.o: LLlex.h Lpars.h alloc.h arith.h idf.h nopp.h spec_arith.h -input.o: LLlex.h alloc.h arith.h assert.h debug.h idepth.h input.h inputtype.h interface.h nopp.h pathlength.h spec_arith.h +input.o: LLlex.h alloc.h arith.h assert.h debug.h idepth.h input.h inputtype.h interface.h nopp.h pathlength.h spec_arith.h static.h domacro.o: LLlex.h Lpars.h alloc.h arith.h assert.h botch_free.h class.h debug.h idf.h idfsize.h ifdepth.h input.h interface.h macro.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 idf.h input.h interface.h macro.h nopp.h pathlength.h spec_arith.h strsize.h +replace.o: LLlex.h alloc.h arith.h assert.h class.h debug.h idf.h input.h interface.h macro.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 predefine.h options.o: align.h arith.h class.h idf.h idfsize.h macro.h maxincl.h nobitfield.h nopp.h sizes.h spec_arith.h storage.h use_tmp.h scan.o: class.h idf.h input.h interface.h lapbuf.h macro.h nopp.h nparams.h diff --git a/lang/cem/cemcom/Parameters b/lang/cem/cemcom/Parameters index dab11db3c..5fff54b38 100644 --- a/lang/cem/cemcom/Parameters +++ b/lang/cem/cemcom/Parameters @@ -130,3 +130,6 @@ /* describes internal compiler arithmetics */ #undef SPECIAL_ARITHMETICS /* something different from native long */ + +!File: static.h +#define STATIC /* decl. spec. for large "static" arrays */ diff --git a/lang/cem/cemcom/dumpidf.c b/lang/cem/cemcom/dumpidf.c index a7bf5ac78..e6a67c142 100644 --- a/lang/cem/cemcom/dumpidf.c +++ b/lang/cem/cemcom/dumpidf.c @@ -16,6 +16,7 @@ #include "Lpars.h" #include "label.h" #include "expr.h" +#include "static.h" /* Some routines (symbol2str, token2str, type2str) which should have * yielded strings are written to yield a pointer to a transient piece @@ -284,15 +285,16 @@ type2str(tp) return buf; } +STATIC char trans_buf[MAXTRANS][300]; + char * /* the ultimate transient buffer supplier */ next_transient() { static int bnum; - static char buf[MAXTRANS][300]; if (++bnum == MAXTRANS) bnum = 0; - return buf[bnum]; + return trans_buf[bnum]; } print_expr(msg, expr) diff --git a/lang/cem/cemcom/input.c b/lang/cem/cemcom/input.c index daa4e96f3..0fa38e2d9 100644 --- a/lang/cem/cemcom/input.c +++ b/lang/cem/cemcom/input.c @@ -32,7 +32,7 @@ #include #include "nopp.h" -#include "inputtype.h" /* UF */ +#include "inputtype.h" #include "interface.h" #include "arith.h" #include "LLlex.h" @@ -40,10 +40,11 @@ #include "alloc.h" #ifndef NOPP -#include "idepth.h" /* UF */ -#include "debug.h" /* UF */ -#include "pathlength.h" /* UF */ +#include "idepth.h" +#include "debug.h" +#include "pathlength.h" #include "assert.h" +#include "static.h" #endif NOPP EXPORT char *ipp = 0; /* input pointer */ @@ -445,18 +446,19 @@ setwdir(wdir, fn) #ifndef NOPP /* mk_filename() concatenates a dir and filename. */ +STATIC char path[PATHLENGTH]; + PRIVATE char * mk_filename(dir, file) register char *dir, *file; { - static char newfn[PATHLENGTH]; - register char *dst = &newfn[0]; + register char *dst = &path[0]; if (!(dir[0] == '.' && dir[1] == '\0')) { while (*dst++ = *dir++); *(dst - 1) = '/'; } while (*dst++ = *file++); - return &newfn[0]; + return &path[0]; } #endif NOPP diff --git a/lang/cem/cemcom/replace.c b/lang/cem/cemcom/replace.c index 8738fa0ec..b19d41ba3 100644 --- a/lang/cem/cemcom/replace.c +++ b/lang/cem/cemcom/replace.c @@ -17,6 +17,7 @@ #include "class.h" #include "assert.h" #include "interface.h" +#include "static.h" char *strcpy(), *strcat(); char *long2str(); @@ -62,6 +63,8 @@ replace(idef) return 1; } +STATIC char FilNamBuf[PATHLENGTH]; + PRIVATE macro_func(idef) struct idf *idef; @@ -71,8 +74,6 @@ macro_func(idef) replacement texts must be evaluated at the time they are used. */ - static char FilNamBuf[PATHLENGTH]; - /* This switch is very blunt... */ switch (idef->id_text[2]) { case 'F' : /* __FILE__ */ -- 2.34.1