removed the limitation on number of include directories
authorceriel <none@none>
Mon, 11 May 1987 14:30:12 +0000 (14:30 +0000)
committerceriel <none@none>
Mon, 11 May 1987 14:30:12 +0000 (14:30 +0000)
util/cpp/Makefile
util/cpp/Parameters
util/cpp/domacro.c
util/cpp/main.c
util/cpp/options.c
util/cpp/preprocess.c

index afd24a8..da7b156 100644 (file)
@@ -60,7 +60,7 @@ GSRC =        char.c symbol2str.c
 
 # .h files generated by `make hfiles'; PLEASE KEEP THIS UP-TO-DATE!
 GHSRC =        errout.h idfsize.h ifdepth.h lapbuf.h \
-       maxincl.h nparams.h numsize.h obufsize.h \
+       nparams.h numsize.h obufsize.h \
        parbufsize.h pathlength.h strsize.h textsize.h \
        botch_free.h debug.h inputtype.h dobits.h line_prefix.h
 
@@ -141,26 +141,112 @@ clean:
        rm -f $(LCSRC) $(OBJ) $(GENERATED) $(GSRC) $(GHSRC) chtab.o chtab cpp Out
 
 #AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO
-LLlex.o: LLlex.h Lpars.h bits.h charoffset.h class.h dobits.h file_info.h idf.h idfsize.h input.h inputtype.h numsize.h strsize.h
-LLmessage.o: LLlex.h Lpars.h file_info.h
+LLlex.o: LLlex.h
+LLlex.o: Lpars.h
+LLlex.o: bits.h
+LLlex.o: charoffset.h
+LLlex.o: class.h
+LLlex.o: dobits.h
+LLlex.o: file_info.h
+LLlex.o: idf.h
+LLlex.o: idfsize.h
+LLlex.o: input.h
+LLlex.o: inputtype.h
+LLlex.o: numsize.h
+LLlex.o: strsize.h
+LLmessage.o: LLlex.h
+LLmessage.o: Lpars.h
+LLmessage.o: file_info.h
 ch7bin.o: Lpars.h
 ch7mon.o: Lpars.h
-domacro.o: LLlex.h Lpars.h bits.h botch_free.h charoffset.h class.h debug.h dobits.h file_info.h idf.h idfsize.h ifdepth.h input.h inputtype.h interface.h macro.h nparams.h parbufsize.h textsize.h
-error.o: LLlex.h errout.h file_info.h
+domacro.o: LLlex.h
+domacro.o: Lpars.h
+domacro.o: bits.h
+domacro.o: botch_free.h
+domacro.o: charoffset.h
+domacro.o: class.h
+domacro.o: debug.h
+domacro.o: dobits.h
+domacro.o: file_info.h
+domacro.o: idf.h
+domacro.o: idfsize.h
+domacro.o: ifdepth.h
+domacro.o: input.h
+domacro.o: inputtype.h
+domacro.o: interface.h
+domacro.o: macro.h
+domacro.o: nparams.h
+domacro.o: parbufsize.h
+domacro.o: textsize.h
+error.o: LLlex.h
+error.o: errout.h
+error.o: file_info.h
 idf.o: idf.h
-init.o: charoffset.h class.h idf.h interface.h macro.h
-input.o: file_info.h input.h inputtype.h
-main.o: file_info.h idfsize.h
-options.o: charoffset.h class.h idf.h idfsize.h macro.h maxincl.h
-preprocess.o: LLlex.h bits.h charoffset.h class.h dobits.h file_info.h idf.h idfsize.h input.h inputtype.h line_prefix.h maxincl.h obufsize.h
-replace.o: LLlex.h charoffset.h class.h debug.h file_info.h idf.h input.h inputtype.h interface.h macro.h pathlength.h textsize.h
-scan.o: charoffset.h class.h idf.h input.h inputtype.h interface.h lapbuf.h macro.h nparams.h
-skip.o: LLlex.h charoffset.h class.h file_info.h input.h inputtype.h
-tokenname.o: LLlex.h Lpars.h file_info.h idf.h
+init.o: charoffset.h
+init.o: class.h
+init.o: idf.h
+init.o: interface.h
+init.o: macro.h
+input.o: file_info.h
+input.o: input.h
+input.o: inputtype.h
+main.o: file_info.h
+main.o: idfsize.h
+options.o: charoffset.h
+options.o: class.h
+options.o: idf.h
+options.o: idfsize.h
+options.o: macro.h
+preprocess.o: LLlex.h
+preprocess.o: bits.h
+preprocess.o: charoffset.h
+preprocess.o: class.h
+preprocess.o: dobits.h
+preprocess.o: file_info.h
+preprocess.o: idf.h
+preprocess.o: idfsize.h
+preprocess.o: input.h
+preprocess.o: inputtype.h
+preprocess.o: line_prefix.h
+preprocess.o: obufsize.h
+replace.o: LLlex.h
+replace.o: charoffset.h
+replace.o: class.h
+replace.o: debug.h
+replace.o: file_info.h
+replace.o: idf.h
+replace.o: input.h
+replace.o: inputtype.h
+replace.o: interface.h
+replace.o: macro.h
+replace.o: pathlength.h
+replace.o: textsize.h
+scan.o: charoffset.h
+scan.o: class.h
+scan.o: idf.h
+scan.o: input.h
+scan.o: inputtype.h
+scan.o: interface.h
+scan.o: lapbuf.h
+scan.o: macro.h
+scan.o: nparams.h
+skip.o: LLlex.h
+skip.o: charoffset.h
+skip.o: class.h
+skip.o: file_info.h
+skip.o: input.h
+skip.o: inputtype.h
+tokenname.o: LLlex.h
+tokenname.o: Lpars.h
+tokenname.o: file_info.h
+tokenname.o: idf.h
 next.o: debug.h
 expr.o: Lpars.h
 tokenfile.o: Lpars.h
-expression.o: LLlex.h Lpars.h file_info.h
+expression.o: LLlex.h
+expression.o: Lpars.h
+expression.o: file_info.h
 Lpars.o: Lpars.h
-char.o: charoffset.h class.h
+char.o: charoffset.h
+char.o: class.h
 symbol2str.o: Lpars.h
index a67a0d0..35aa033 100644 (file)
 #define        IFDEPTH 256     /* maximum number of nested if-constructions    */
 
 
-!File: maxincl.h
-#define        MAXINCL 16      /* maximum number of #include directories       */
-
-
 !File: lapbuf.h
 #define        LAPBUF  4096    /* size of macro actual parameter buffer        */
 
index dd54944..344d46d 100644 (file)
@@ -25,7 +25,7 @@
 #include       "macro.h"
 #include       "bits.h"
 
-IMPORT char *inctable[];       /* list of include directories          */
+IMPORT char **inctable;                /* list of include directories          */
 IMPORT char *getwdir();
 PRIVATE char ifstack[IFDEPTH]; /* if-stack: the content of an entry is */
                                /* 1 if a corresponding ELSE has been   */
index 464de5c..cb927ef 100644 (file)
@@ -5,12 +5,12 @@
  */
 /* MAIN PROGRAM */
 
+#include <alloc.h>
 #include "file_info.h"
 #include "idfsize.h"
 
 extern char *symbol2str();
 extern char *getwdir();
-extern char *inctable[];
 extern int err_occurred;
 int idfsize = IDFSIZE;
 
@@ -18,6 +18,9 @@ int ifval;
 
 char *prog_name;
 
+extern char **inctable;
+extern int inc_max, inc_total;
+
 main(argc, argv)
        char *argv[];
 {
@@ -25,6 +28,12 @@ main(argc, argv)
        prog_name = argv[0];
 
        init_idf();
+
+       inctable = (char **) Malloc(10 * sizeof(char *));
+       inc_max = 10;
+       inc_total = 2;
+       inctable[0] = ".";
+       inctable[1] = "/usr/include";
        init_pp();      /* initialise the preprocessor macros   */
 
        /*      Note: source file "-" indicates that the source is supplied
index 63e8b47..6df0df3 100644 (file)
@@ -7,18 +7,15 @@
 
 #include       <alloc.h>
 #include       "idfsize.h"
-#include       "maxincl.h"
 #include       "class.h"
 #include       "macro.h"
 #include       "idf.h"
 
 char options[128];                     /* one for every char   */
 int inc_pos = 1;                       /* place where next -I goes */
-char *inctable[MAXINCL] = {            /* list for includes    */
-       ".",
-       "/usr/include",
-       0
-};
+int inc_max;
+int inc_total;
+char **inctable;
 
 extern int idfsize;
 int txt2int();
@@ -63,15 +60,26 @@ do_option(text)
        }
        case 'I' :      /* -Ipath : insert "path" into include list     */
                if (*text)      {
-                       register int i = inc_pos++;
+                       register int i;
                        register char *new = text;
+
+                       if (++inc_total > inc_max) {
+                               char **n = (char **)
+                                  Malloc((10 + inc_max) * sizeof(char *));
+
+                               for (i = 0; i < inc_max; i++) {
+                                       n[i] = inctable[i];
+                               }
+                               free((char *) inctable);
+                               inctable = n;
+                               inc_max += 10;
+                       }
                        
+                       i = inc_pos++;
                        while (new)     {
                                register char *tmp = inctable[i];
                                
                                inctable[i++] = new;
-                               if (i == MAXINCL)
-                                       fatal("too many -I options");
                                new = tmp;
                        }
                }
index 639b2a5..5a06b42 100644 (file)
@@ -7,7 +7,6 @@
 
 #include <system.h>
 #include "input.h"
-#include "maxincl.h"
 #include "obufsize.h"
 #include "LLlex.h"
 #include "class.h"