home *** CD-ROM | disk | FTP | other *** search
- Only in cpp.2: CHANGES
- diff -c cpp.1/Makefile cpp.2/Makefile
- *** cpp.1/Makefile Mon Apr 15 22:32:33 1991
- --- cpp.2/Makefile Sun Jul 7 05:59:43 1991
- ***************
- *** 18,25 ****
- #CPPFLAGS =
- #SRCS = cpp1.c cpp2.c cpp3.c cpp4.c cpp5.c cpp6.c
-
- CC = cc
- - CFLAGS = -O
- CPPFLAGS = -DCOOL
-
- .SUFFIXES: .c .o
- --- 18,29 ----
- #CPPFLAGS =
- #SRCS = cpp1.c cpp2.c cpp3.c cpp4.c cpp5.c cpp6.c
-
- + # Uncomment for Interactive Unix on PCs.
- + # MACHINE = -O -DM_INTERACTIVE
- + # LDFLAGS = -linet
- + CFLAGS = -O $(MACHINE)
- + # CFLAGS = -g $(MACHINE)
- CC = cc
- CPPFLAGS = -DCOOL
-
- .SUFFIXES: .c .o
- ***************
- *** 36,42 ****
- #
-
- cpp: $(OBJS)
- ! $(CC) -o cpp $(OBJS)
-
- #
- # ** Remove unneeded files
- --- 40,46 ----
- #
-
- cpp: $(OBJS)
- ! $(CC) -o cpp $(OBJS) $(LDFLAGS)
-
- #
- # ** Remove unneeded files
- ***************
- *** 43,49 ****
- #
-
- clean:
- ! rm *.o cpp
-
- #
- # ** Test cpp by preprocessing itself, compiling the result,
- --- 47,53 ----
- #
-
- clean:
- ! rm -f *.o cpp
-
- #
- # ** Test cpp by preprocessing itself, compiling the result,
- Only in cpp.2: Makeit.mk
- diff -c cpp.1/cpp.h cpp.2/cpp.h
- *** cpp.1/cpp.h Mon Apr 15 22:13:28 1991
- --- cpp.2/cpp.h Sun Jul 7 05:40:25 1991
- ***************
- *** 17,23 ****
- * In general, definitions in this file should not be changed.
- *
- * Change History:
- ! * 19-Jan-90 DKM Added support for MVS and EBCDIC character set
- */
-
- #include "cppdef.h"
- --- 17,24 ----
- * In general, definitions in this file should not be changed.
- *
- * Change History:
- ! * 19-Jan-90 DKM Added support for MVS and EBCDIC character set
- ! * 25-Jun-91 GPD Added support for Pyramid.
- */
-
- #include "cppdef.h"
- ***************
- *** 267,272 ****
- --- 268,274 ----
-
- extern int line; /* Current line number */
- extern int wrongline; /* Force #line to cc pass 1 */
- + extern int wrongfile; /* Force #line to cc pass 1 */
- extern char type[]; /* Character classifier */
- extern char *tokenbuf; /* Current input token */
- extern int tokenbsize; /* Current size allocated in tokenbuf
- ***************
- *** 284,293 ****
- --- 286,297 ----
- extern int cflag; /* -C option (keep comments) */
- extern int eflag; /* -E option (ignore errors) */
- extern int nflag; /* -N option (no pre-defines) */
- + extern int yflag; /* -Y option (alt stdincl) */
- extern int rec_recover; /* unwind recursive macros */
- extern char *preset[]; /* Standard predefined symbols */
- extern char *magic[]; /* Magic predefined symbols */
- extern FILEINFO *infile; /* Current input file */
- + extern char *altincl; /* Alternate std include dir */
- extern char work[NWORK + 1]; /* #define scratch */
- extern char *workp; /* Free space in work */
- extern int debug; /* Debug level */
- ***************
- *** 300,305 ****
- --- 304,313 ----
- extern char *savestring(); /* Stuff string in malloc mem. */
- extern char *strcpy();
- extern char *strcat();
- + #if pyr
- + #define strchr index
- + #define strrchr rindex
- + #endif
- extern char *strrchr();
- extern char *strchr();
-
- ***************
- *** 308,314 ****
- --- 316,324 ----
- #endif
-
- #if (HOST != SYS_OS2 && HOST != SYS_XENIX && HOST != SYS_MVS && HOST != SYS_AIX)
- + #if defined(sun) || (!defined(i386) && !defined(unix))
- extern char *sprintf(); /* Lint needs this */
- + #endif
- #endif
-
- typedef int (*internal_expander) ();
- Only in cpp.1: cpp.lzh
- diff -c cpp.1/cpp1.c cpp.2/cpp1.c
- *** cpp.1/cpp1.c Mon Apr 15 22:13:20 1991
- --- cpp.2/cpp1.c Sun Jul 7 06:28:37 1991
- ***************
- *** 97,102 ****
- --- 97,107 ----
- * 18-May-90 MBN Conditional compilation on COOL to get "clean" cpp
- * 21-May-90 MJF Added DECLARE_ONCE for CCC -X
- * 20-Aug-90 MJF Added typecase external function reference
- + * 16-Jun-91 GPD Added support for Sun -Y option
- + * Fix -N by putting initdefines() after dooptions()
- + * Added throw macro support to jump table
- + * 25-Jun-91 GPD Fixes to make ## operator expansion ANSI conformant.
- + * 07-Jul-91 GPD Fix #line nesting. Added wrongfile.
- */
-
- /*)BUILD
- ***************
- *** 394,399 ****
- --- 399,405 ----
- extern int generate(); /* macro looping mechanism */
- extern int compress(); /* compress out white space */
- extern int typecase(); /* typecase macro */
- + extern int throw(); /* throw macro */
-
- struct expander_pair internal_macros[] = {
- {"parmtype", parmtype},
- ***************
- *** 411,416 ****
- --- 417,423 ----
- {"generate", generate},
- {"compress", compress},
- {"typecase", typecase},
- + {"throw", throw},
- {NULL, NULL}};
-
- #endif
- ***************
- *** 421,426 ****
- --- 428,436 ----
- * wrongline is set in many places when the actual output
- * line is out of sync with the numbering, e.g,
- * when expanding a macro with an embedded newline.
- + * wrongfile is set when the reason for the output line being
- + * out of sync is because we have just left a nested
- + * include file.
- *
- * tokenbuf holds the last identifier scanned (which might
- * be a candidate for macro expansion).
- ***************
- *** 432,437 ****
- --- 442,448 ----
- */
- int line; /* Current line number */
- int wrongline; /* Force #line to compiler */
- + int wrongfile = FALSE; /* Force #line to compiler */
- char *tokenbuf; /* Buffer for current input token */
- int tokenbsize; /* Allocated size of tokenbuf, */
- /* not counting zero at end. */
- ***************
- *** 438,443 ****
- --- 449,456 ----
- int errors; /* cpp error counter */
- FILEINFO *infile = NULL; /* Current input file */
- int debug; /* TRUE if debugging now */
- + char *altincl = NULL; /* Alternate std include dir */
- + /* Set using -Y option */
- /*
- * This counter is incremented when a macro expansion is initiated.
- * If it exceeds a built-in value, the expansion stops -- this tests
- ***************
- *** 502,507 ****
- --- 515,521 ----
- int cflag = FALSE; /* -C option (keep comments) */
- int eflag = FALSE; /* -E option (never fail) */
- int nflag = 0; /* -N option (no predefines) */
- + int yflag = FALSE; /* -Y option (replace std incl) */
-
- /*
- * ifstack[] holds information about nested #if's. It is always
- ***************
- *** 560,567 ****
- #if HOST == SYS_VMS
- argc = getredirection(argc, argv); /* vms >file and <file */
- #endif
- - initdefines(); /* O.S. specific def's */
- i = dooptions(argc, argv); /* Command line -flags */
- switch (i) {
- case 3:
- /*
- --- 574,581 ----
- #if HOST == SYS_VMS
- argc = getredirection(argc, argv); /* vms >file and <file */
- #endif
- i = dooptions(argc, argv); /* Command line -flags */
- + initdefines(); /* O.S. specific def's */
- switch (i) {
- case 3:
- /*
- ***************
- *** 674,680 ****
- if (keepcomments) /* in this line. */
- putchar(c);
- if (c == '\n') /* If line's all blank, */
- ! if(keepcomments)
- putchar('\n');
- else
- ++counter; /* Do nothing now */
- --- 688,696 ----
- if (keepcomments) /* in this line. */
- putchar(c);
- if (c == '\n') /* If line's all blank, */
- ! if (wrongfile)
- ! counter = 0;
- ! else if (keepcomments)
- putchar('\n');
- else
- ++counter; /* Do nothing now */
- ***************
- *** 739,747 ****
- break;
-
-
- - case DIG: /* Output a number */
- case DOT: /* Dot may begin floats */
- scannumber(c, output);
- break;
-
- case QUO: /* char or string const */
- --- 755,780 ----
- break;
-
-
- case DOT: /* Dot may begin floats */
- + if (type[get()] != DIG)
- + {
- + unget();
- + output('.');
- + break; /* Not a float after all */
- + }
- + else
- + unget(); /* Fall through */
- +
- + case DIG: /* Output a number */
- scannumber(c, output);
- + c = get();
- + if (type[c] == LET || c == '.')
- + {
- + scanid(c); /* Don't expand id after num */
- + fputs(tokenbuf, stdout);
- + }
- + else
- + unget();
- break;
-
- case QUO: /* char or string const */
- diff -c cpp.1/cpp2.c cpp.2/cpp2.c
- *** cpp.1/cpp2.c Mon Apr 15 22:13:21 1991
- --- cpp.2/cpp2.c Sun Jul 7 06:33:22 1991
- ***************
- *** 30,35 ****
- --- 30,38 ----
- * 23-Apr-90 MJF Include file parsing ignore // or /* as comment
- * 01-May-90 MJF unrecognized #pragma needs to output newline
- * 18-May-90 MBN Conditional compilation for COOL to get "clean" cpp
- + * 25-Jun-91 GPD Remove #elif to make more portable.
- + * Added support for Interactive Unix.
- + * 01-Jul-91 GPD Fix search for include in local directory first.
- */
-
- #include <stdio.h>
- ***************
- *** 39,55 ****
-
- #if defined(vms)
- #include <types.h>
- ! #elif !defined(SYS_OSVS)
- #include <sys/types.h>
- #endif
-
- #if defined(vms)
- #include <file.h>
- ! #elif defined(SYS_OSVS)
- #include <fcntl.h>
- ! #elif !defined(DOS) && !defined(MSDOS)
- #include <sys/file.h>
- #endif
-
- #if defined(vms)
- /*
- --- 42,67 ----
-
- #if defined(vms)
- #include <types.h>
- ! #else
- ! #if !defined(SYS_OSVS)
- #include <sys/types.h>
- #endif
- + #endif
-
- #if defined(vms)
- #include <file.h>
- ! #else
- ! #if defined(SYS_OSVS)
- #include <fcntl.h>
- ! #else
- ! #if !defined(DOS) && !defined(MSDOS)
- ! #if defined(M_INTERACTIVE)
- ! #include <unistd.h>
- ! #endif
- #include <sys/file.h>
- #endif
- + #endif
- + #endif
-
- #if defined(vms)
- /*
- ***************
- *** 626,632 ****
- * Look in local directory first
- */
- if (!hasdirectory(filename, tmpname, TRUE)
- ! && hasdirectory(infile->filename, tmpname, TRUE))
- strcat(tmpname, filename);
- else {
- strcpy(tmpname, filename);
- --- 638,644 ----
- * Look in local directory first
- */
- if (!hasdirectory(filename, tmpname, TRUE)
- ! && hasdirectory(infile->filename, tmpname, FALSE))
- strcat(tmpname, filename);
- else {
- strcpy(tmpname, filename);
- diff -c cpp.1/cpp3.c cpp.2/cpp3.c
- *** cpp.1/cpp3.c Mon Apr 15 22:13:21 1991
- --- cpp.2/cpp3.c Sun Jul 7 05:57:26 1991
- ***************
- *** 22,27 ****
- --- 22,32 ----
- * 24-Sep-89 AFM OS2, XENIX and AIX support.
- * 19-Jan-90 DKM MVS support.
- * 18-May-90 MBN Conditional compilation for COOL to get "clean" cpp
- + * 16-Jun-91 GPD Added support for Sun -Y option
- + * Added support for Sun -undef option
- + * 01-Jul-91 GPD Add __COOL__ as a predefined symbol.
- + * 07-Jul-91 GPD Fix #line nesting. Force sharp() before processing
- + * new file if wrongline.
- */
-
-
- ***************
- *** 72,77 ****
- --- 77,84 ----
- if (debug)
- fprintf(stderr, "Reading from \"%s\"\n", filename);
- #endif
- + if (wrongline)
- + sharp();
- addfile(fp, filename);
- return (TRUE);
- }
- ***************
- *** 112,118 ****
- #endif
-
- #if (HOST == SYS_UNIX || HOST == SYS_XENIX || HOST == SYS_AIX)
- ! *incend++ = "/usr/include";
- #define MAXINCLUDE (NINCLUDE - 1 - IS_INCLUDE)
- #endif
-
- --- 119,128 ----
- #endif
-
- #if (HOST == SYS_UNIX || HOST == SYS_XENIX || HOST == SYS_AIX)
- ! if (yflag && altincl)
- ! *incend++ = altincl;
- ! else
- ! *incend++ = "/usr/include";
- #define MAXINCLUDE (NINCLUDE - 1 - IS_INCLUDE)
- #endif
-
- ***************
- *** 276,289 ****
- cwarn("-S, too many values, \"%s\" unused", ap);
- break;
-
- - case 'U': /* Undefine symbol */
- - #if (HOST != SYS_UNIX && HOST != SYS_XENIX && HOST != SYS_OS2 && HOST != SYS_MVS && HOST != SYS_AIX)
- - zap_uc(ap);
- - #endif
- - if (defendel(ap, TRUE) == NULL)
- - cwarn("\"%s\" wasn't defined", ap);
- - break;
- -
- case 'X': /* Debug */
- debug = (isdigit(*ap)) ? atoi(ap) : 1;
- #if DEBUG
- --- 286,291 ----
- ***************
- *** 294,299 ****
- --- 296,320 ----
- fprintf(stderr, "Debug set to %d\n", debug);
- break;
-
- + case 'Y':
- + altincl = ap;
- + yflag = TRUE;
- + break;
- +
- + case 'U': /* Undefine symbol */
- + #if (HOST != SYS_UNIX && HOST != SYS_XENIX && HOST != SYS_OS2 && HOST != SYS_MVS && HOST != SYS_AIX)
- + zap_uc(ap);
- + #endif
- + if (strcmp(ap-1,"undef") == 0)
- + {
- + if (nflag == 0)
- + nflag = 1;
- + break;
- + }
- + if (defendel(ap, TRUE) == NULL)
- + cwarn("\"%s\" wasn't defined", ap);
- + break;
- +
- default: /* What is this one? */
- cwarn("Unknown option \"%s\"", arg);
- fprintf(stderr, "The following options are valid:\n\
- ***************
- *** 387,392 ****
- --- 408,416 ----
- define_builtin("__LINE__", expand_line, "");
- define_builtin("__FILE__", expand_file, "");
- define_builtin("__STDC__", NULL, "1");
- + #ifdef COOL
- + define_builtin("__COOL__", NULL, "1");
- + #endif
- #if OK_DATE
- /*
- * Define __DATE__ as today's date.
- diff -c cpp.1/cpp4.c cpp.2/cpp4.c
- *** cpp.1/cpp4.c Mon Apr 15 22:13:21 1991
- --- cpp.2/cpp4.c Sun Jul 7 06:29:16 1991
- ***************
- *** 30,35 ****
- --- 30,36 ----
- * In doundef, don't complain if arg already not defined.
- * 20-Apr-90 MJF Changed redefining of defined variable to a warning
- * 18-May-90 MBN Conditional compilation for COOL to get "clean" cpp
- + * 25-Jun-91 GPD Fixes to make ## operator expansion ANSI conformant.
- */
-
- #include <stdio.h>
- ***************
- *** 141,147 ****
- continue;}
- while (workp > work && type[(unsigned char)workp[-1]] == SPA)
- --workp; /* Erase leading spaces */
- ! save(TOK_SEP); /* Stuff a delimiter */
- c = skipws(); /* Eat whitespace */
- continue;
- }
- --- 142,148 ----
- continue;}
- while (workp > work && type[(unsigned char)workp[-1]] == SPA)
- --workp; /* Erase leading spaces */
- ! /* save(TOK_SEP); */ /* Stuff a delimiter */
- c = skipws(); /* Eat whitespace */
- continue;
- }
- ***************
- *** 596,602 ****
- } /* if string_magic */
- } /* if valid parm */
- } /* if parm */
- ! else
- *defp++ = c;
- }
- }
- --- 597,603 ----
- } /* if string_magic */
- } /* if valid parm */
- } /* if parm */
- ! else if (c != DEF_MAGIC)
- *defp++ = c;
- }
- }
- diff -c cpp.1/cpp6.c cpp.2/cpp6.c
- *** cpp.1/cpp6.c Mon Apr 15 22:13:21 1991
- --- cpp.2/cpp6.c Sun Jul 7 05:58:34 1991
- ***************
- *** 37,42 ****
- --- 37,43 ----
- * 19-Jan-90 DKM Support for MVS and EBCDIC character set
- * 02-May-90 MJF Backslash<newline> not expanded in scanstring()
- * 02-May-90 MJF Added macro recursion fixes by Aditya in macroid()
- + * 07-Jul-91 GPD Fix #line nesting. Added wrongfile.
- */
-
- #include <stdio.h>
- ***************
- *** 820,825 ****
- --- 821,831 ----
- else { /* Else get from a file */
- if ((file->bptr = fgets(file->buffer, NBUFF, file->fp))
- != NULL) {
- + if (wrongfile == TRUE)
- + {
- + wrongfile = FALSE;
- + sharp();
- + }
- #if DEBUG
- if (debug > 1) { /* Dump it to stdout */
- printf("\n#line %d (%s), %s",
- ***************
- *** 838,844 ****
- * is skipping over blank lines and will do a
- * #line at its convenience.
- */
- ! wrongline = TRUE; /* Need a #line now */
- }
- }
- }
- --- 844,851 ----
- * is skipping over blank lines and will do a
- * #line at its convenience.
- */
- ! /* wrongline = TRUE; */ /* Need a #line now */
- ! wrongfile = TRUE;
- }
- }
- }
- diff -c cpp.1/cpp7.c cpp.2/cpp7.c
- *** cpp.1/cpp7.c Mon Apr 15 22:13:21 1991
- --- cpp.2/cpp7.c Sun Jul 7 04:47:34 1991
- ***************
- *** 22,27 ****
- --- 22,29 ----
- * 20-Oct-89 AFM OS2, XENIX and AIX port.
- * 19-Jan-90 DKM MVS support
- * 01-Sep-90 MJF External macros support for OS/2 by using temp file
- + * 25-Jun-91 GPD Remove #elif to make more portable.
- + * Added support for Interactive Unix.
- */
-
- #include <stdio.h>
- ***************
- *** 30,38 ****
-
- #if defined(vms)
- #include <types.h>
- ! #elif !defined(SYS_OSVS)
- #include <sys/types.h>
- #endif
-
- #if defined(_AIX)
- #include <sys/select.h>
- --- 32,42 ----
-
- #if defined(vms)
- #include <types.h>
- ! #else
- ! #if !defined(SYS_OSVS)
- #include <sys/types.h>
- #endif
- + #endif
-
- #if defined(_AIX)
- #include <sys/select.h>
- ***************
- *** 44,59 ****
- #include <string.h>
- #include <sys/fcntl.h>
- #include <sys/file.h>
- ! #elif defined(DOS) || defined(MSDOS)
- #include <string.h>
- #include <fcntl.h>
- ! #elif defined(SYS_OSVS)
- #include <string.h>
- #include <fcntl.h>
- ! #elif defined(vms)
- #include <file.h>
- #else
- #include <sys/file.h>
- #endif
-
- #if HOST == SYS_VMS
- --- 48,74 ----
- #include <string.h>
- #include <sys/fcntl.h>
- #include <sys/file.h>
- ! #else
- ! #if defined(DOS) || defined(MSDOS)
- #include <string.h>
- #include <fcntl.h>
- ! #else
- ! #if defined(SYS_OSVS)
- #include <string.h>
- #include <fcntl.h>
- ! #else
- ! #if defined(vms)
- #include <file.h>
- #else
- + #if defined(M_INTERACTIVE)
- + #include <unistd.h>
- + #include <sys/bsdtypes.h>
- + #include <sys/fcntl.h>
- + #endif
- #include <sys/file.h>
- + #endif
- + #endif
- + #endif
- #endif
-
- #if HOST == SYS_VMS
- diff -c cpp.1/cppdef.h cpp.2/cppdef.h
- *** cpp.1/cppdef.h Mon Apr 15 22:13:29 1991
- --- cpp.2/cppdef.h Tue Jun 25 04:55:02 1991
- ***************
- *** 26,33 ****
- * If this is not the case, you will have to do some editing here and there.
- *
- * Change History
- ! * 19-Jan-90 DKM Support for MVS and EBCDIC character set
- ! * 04-May-90 MJF Added predefined constant "sun"
- */
-
- #ifndef CPPDEFH
- --- 26,34 ----
- * If this is not the case, you will have to do some editing here and there.
- *
- * Change History
- ! * 19-Jan-90 DKM Support for MVS and EBCDIC character set
- ! * 04-May-90 MJF Added predefined constant "sun"
- ! * 16-Jun-91 GPD Fixed predefines for sun, pyr and i386 architectures
- */
-
- #ifndef CPPDEFH
- ***************
- *** 264,273 ****
- --- 265,283 ----
- #ifdef sparc
- #define MACHINE "sparc"
- #endif
- + #ifdef mc68020
- + #define MACHINE "mc68020", "mc68000"
- + #endif
- #ifdef sun
- #define TARGET_ARCH "sun"
- #endif
- + #ifdef pyr
- + #define MACHINE "pyr"
- #endif
- + #ifdef i386
- + #define MACHINE "i386"
- + #endif
- + #endif
-
- /*
- * defaults
- ***************
- *** 335,341 ****
- * (Or is it the other way around?) -- Warning: BIG_ENDIAN code is untested.
- */
- #ifndef BIG_ENDIAN
- ! #if HOST == SYS_MVS
- #define BIG_ENDIAN TRUE /* Is this right??? */
- #else
- #define BIG_ENDIAN FALSE
- --- 345,351 ----
- * (Or is it the other way around?) -- Warning: BIG_ENDIAN code is untested.
- */
- #ifndef BIG_ENDIAN
- ! #if (HOST == SYS_MVS) || defined(i386)
- #define BIG_ENDIAN TRUE /* Is this right??? */
- #else
- #define BIG_ENDIAN FALSE
- diff -c cpp.1/template.c cpp.2/template.c
- *** cpp.1/template.c Mon Apr 15 23:03:36 1991
- --- cpp.2/template.c Sun Jul 7 06:30:04 1991
- ***************
- *** 18,23 ****
- --- 18,24 ----
- * Updated: MJF 21-May-90 -- Added DECLARE_ONCE for CCC -X.
- * Updated: MJF 01-Mar-91 -- Added fix when expanding member functions
- * which return a template class
- + * Updated: GPD 25-Jun-91 -- Fix #line nesting. When template expansions done.
- *
- * Template, DECLARE and IMPLEMENT defmacro
- *
- ***************
- *** 115,120 ****
- --- 116,122 ----
- */
-
- #include "defmacio.h"
- + #include "cppdef.h"
-
- /* maximum number of template parameters */
- #define max_parms 32
- ***************
- *** 308,313 ****
- --- 310,317 ----
- return 1;
- }
- for(templ = th->head; templ != NULL; templ = templ->next) {
- + char lbuff[256];
- + FILEINFO* finfo = MacOutFile;
- switch (do_what) {
- case do_declare: if(templ->type == implement_template) continue; break;
- case do_implement: if(templ->type != implement_template) continue; break;
- ***************
- *** 317,322 ****
- --- 321,333 ----
- if (n-- > 0) continue;
- /* else fall through to implement template n */
- }
- + while (finfo && !finfo->fp)
- + finfo = finfo->parent;
- + if (finfo)
- + {
- + sprintf(lbuff,"\n#line %d \"%s\"\n", finfo->line, finfo->filename);
- + puts(lbuff);
- + }
- if (do_line) {
- char* bodyp = templ->body;
- int newline = 0;
- ***************
- *** 331,336 ****
- --- 342,349 ----
- if(!newline) putchar('\n');
- }
- macro_substitute(templ->body, nparms, templ->args, parms);
- + if (finfo)
- + puts(lbuff);
- }
- }
- if (do_what == do_implement_n && n >= 0) {
-
-