From e63c244cb22bf48ca1d2695784a072269d19ea96 Mon Sep 17 00:00:00 2001 From: Robert de Bath Date: Fri, 9 May 1997 19:36:29 +0200 Subject: Import Dev86src-0.12.0.tar.gz --- bcc/Makefile | 15 +++++++++------ bcc/align.h | 7 +++---- bcc/assign.c | 7 +++---- bcc/bcc-cc1.c | 3 +-- bcc/bcc.c | 8 ++++++-- bcc/bcc.h | 28 ++++++++++++++++++++++++++++ bcc/byteord.h | 4 ++-- bcc/codefrag.c | 3 +-- bcc/const.h | 17 +++++++++-------- bcc/debug.c | 4 +--- bcc/declare.c | 5 ++--- bcc/express.c | 3 +-- bcc/exptree.c | 10 +++++----- bcc/floatop.c | 3 +-- bcc/function.c | 3 +-- bcc/gencode.c | 3 +-- bcc/genloads.c | 3 +-- bcc/glogcode.c | 3 +-- bcc/hardop.c | 9 ++++----- bcc/input.c | 3 +-- bcc/label.c | 3 +-- bcc/loadexp.c | 3 +-- bcc/longop.c | 3 +-- bcc/output.c | 3 +-- bcc/preproc.c | 3 +-- bcc/preserve.c | 3 +-- bcc/proto.h | 31 ------------------------------- bcc/scan.c | 3 +-- bcc/softop.c | 3 +-- bcc/state.c | 3 +-- bcc/sysproto.h | 27 +++++++++++++++++++++++++++ bcc/table.c | 5 ++--- bcc/type.c | 3 +-- bcc/types.h | 2 -- 34 files changed, 120 insertions(+), 116 deletions(-) create mode 100644 bcc/bcc.h create mode 100644 bcc/sysproto.h (limited to 'bcc') diff --git a/bcc/Makefile b/bcc/Makefile index 512c013..8812c38 100644 --- a/bcc/Makefile +++ b/bcc/Makefile @@ -25,16 +25,16 @@ install: all install -m 755 bcc-cc1 $(LIBDIR)/bcc-cc1 bcc: bcc.c - $(CC) -ansi $(CFLAGS) $(BCCDEFS) $(LDFLAGS) bcc.c -o $@ + $(CC) $(ANSI) $(CFLAGS) $(BCCDEFS) $(LDFLAGS) bcc.c -o $@ ncc: bcc.c - $(CC) -ansi $(CFLAGS) -DL_TREE -DDEFARCH=0 $(LDFLAGS) bcc.c -o $@ + $(CC) $(ANSI) $(CFLAGS) -DL_TREE -DDEFARCH=0 $(LDFLAGS) bcc.c -o $@ bcc09: bcc.c - $(CC) -ansi $(CFLAGS) -DMC6809 $(BCCDEFS) $(LDFLAGS) bcc.c -o $@ + $(CC) $(ANSI) $(CFLAGS) -DMC6809 $(BCCDEFS) $(LDFLAGS) bcc.c -o $@ ccc: bcc.c - $(CC) -ansi $(CFLAGS) -DCCC $(BCCDEFS) $(LDFLAGS) bcc.c -o $@ + $(CC) $(ANSI) $(CFLAGS) -DCCC $(BCCDEFS) $(LDFLAGS) bcc.c -o $@ bcc-cc1: $(OBJS) $(CC) $(LDFLAGS) $(OBJS) -o bcc-cc1 @@ -43,5 +43,8 @@ clean realclean: rm -f bcc bcc-cc1 ncc bcc09 ccc bcc.o $(OBJS) -$(OBJS): align.h byteord.h condcode.h const.h gencode.h input.h label.h os.h \ - output.h parse.h proto.h reg.h sc.h scan.h sizes.h table.h type.h types.h +$(OBJS): bcc.h align.h const.h types.h \ + byteord.h condcode.h gencode.h \ + input.h label.h os.h output.h \ + parse.h proto.h reg.h sc.h scan.h \ + sizes.h table.h type.h diff --git a/bcc/align.h b/bcc/align.h index 3c8971b..2fce75d 100644 --- a/bcc/align.h +++ b/bcc/align.h @@ -5,11 +5,10 @@ #ifndef S_ALIGNMENT # define align(x) (x) #else -# ifdef UNPORTABLE_ALIGNMENT -typedef unsigned pointerint_t; -# define align(x) (((pointerint_t) (x) + (S_ALIGNMENT-1)) & ~(S_ALIGNMENT-1)) +# if defined(__STDC__) && defined(_POSIX_SOURCE) +# define align(x) (((ssize_t) (x) + (S_ALIGNMENT-1)) & ~(S_ALIGNMENT-1)) # else -# define align(x) ((char *) (x) + (- (int) (x) & (S_ALIGNMENT-1))) +# define align(x) ((char *) (x) + (- (char) (x) & (S_ALIGNMENT-1))) # endif #endif diff --git a/bcc/assign.c b/bcc/assign.c index ebbc1fc..977d23e 100644 --- a/bcc/assign.c +++ b/bcc/assign.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "byteord.h" #include "gencode.h" #include "reg.h" @@ -236,7 +235,7 @@ struct symstruct *target; if (long_big_endian) #endif #if DYNAMIC_LONG_ORDER || LONG_BIG_ENDIAN -# if BIG_ENDIAN +# if INT_BIG_ENDIAN target->offset.offi += oldsize - ctypesize; # else { @@ -249,7 +248,7 @@ struct symstruct *target; else #endif #if DYNAMIC_LONG_ORDER || LONG_BIG_ENDIAN == 0 -# if BIG_ENDIAN +# if INT_BIG_ENDIAN target->offset.offi += ctypesize; # else ; diff --git a/bcc/bcc-cc1.c b/bcc/bcc-cc1.c index d6fece3..6f545be 100644 --- a/bcc/bcc-cc1.c +++ b/bcc/bcc-cc1.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" PUBLIC int main(argc, argv) int argc; diff --git a/bcc/bcc.c b/bcc/bcc.c index 9f7474d..4dc16b1 100644 --- a/bcc/bcc.c +++ b/bcc/bcc.c @@ -45,7 +45,7 @@ #define EXESUF #endif -#ifdef __minix +#if defined(__minix) || defined(_AIX) #define realpath(x,y) 0 #endif @@ -531,10 +531,14 @@ char **argv; addarg(&cppargs, "-D__linux__"); addarg(&ldargs, "-N"); /* Make OMAGIC */ break; + case 0: + break; + default: + fatal("Fatal error: illegal -M option given"); } #endif -if( !aswarn ) + if( !aswarn ) addarg(&asargs, "-w"); if( patch_exe ) addarg(&ldargs, "-s"); diff --git a/bcc/bcc.h b/bcc/bcc.h new file mode 100644 index 0000000..275c100 --- /dev/null +++ b/bcc/bcc.h @@ -0,0 +1,28 @@ +/* Copyright (C) 1997 Robert de Bath + * This file is part of the Linux-8086 Development environment and is + * distributed under the GNU General Public License. */ + +/* Ansi C has certain guarentees ... except under MSdross :-( */ + +#ifdef __STDC__ +#ifndef MSDOS +#include +#include +#include +#include +#endif + +#define P(x) x + +#else +#define P(x) () +#endif + +#include "const.h" +#include "types.h" +#include "proto.h" + +#if !defined(__STDC__) || defined(MSDOS) +#include "sysproto.h" +#endif + diff --git a/bcc/byteord.h b/bcc/byteord.h index e7b19e0..00cfd42 100644 --- a/bcc/byteord.h +++ b/bcc/byteord.h @@ -3,11 +3,11 @@ /* Copyright (C) 1992 Bruce Evans */ #ifdef I8088 -# define BIG_ENDIAN 0 +# define INT_BIG_ENDIAN 0 # define LONG_BIG_ENDIAN 1 /* longs are back to front for Xenix */ #endif #ifdef MC6809 -# define BIG_ENDIAN 1 /* byte order in words is high-low */ +# define INT_BIG_ENDIAN 1 /* byte order in words is high-low */ # define LONG_BIG_ENDIAN 1 /* byte order in longs is high-low */ #endif diff --git a/bcc/codefrag.c b/bcc/codefrag.c index 5d3aa82..750c837 100644 --- a/bcc/codefrag.c +++ b/bcc/codefrag.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "byteord.h" #include "condcode.h" #include "gencode.h" diff --git a/bcc/const.h b/bcc/const.h index f8fd692..cd1f16e 100644 --- a/bcc/const.h +++ b/bcc/const.h @@ -17,9 +17,13 @@ #endif +#ifdef __AS386_16__ +#define VERY_SMALL_MEMORY +#endif + #define SELFTYPECHECK /* check calculated type = runtime type */ -#ifndef __AS386_16__ +#ifndef VERY_SMALL_MEMORY #define DEBUG /* generate compiler-debugging code */ #endif @@ -29,7 +33,7 @@ * since assembler has only 1 data seg */ # define DYNAMIC_LONG_ORDER 1 /* long word order spec. at compile time */ -#ifdef __AS386_16__ +#ifdef VERY_SMALL_MEMORY /* Humm, now this is nasty :-) */ #define float no_hope @@ -61,12 +65,9 @@ typedef long no_hope; /* switches for source machine dependencies */ -#ifndef SOS_EDOS -# define S_ALIGNMENT (sizeof(int)) /* source memory alignment, power of 2 */ -#endif - -#ifndef SOS_MSDOS /* need portable alignment for large model */ -# define UNPORTABLE_ALIGNMENT +/* Unportable alignment needed for specific compilers */ +#ifndef VERY_SMALL_MEMORY +# define S_ALIGNMENT (sizeof(long)) /* A little safer */ #endif /* local style */ diff --git a/bcc/debug.c b/bcc/debug.c index 26f7bf8..9e97ae7 100644 --- a/bcc/debug.c +++ b/bcc/debug.c @@ -2,11 +2,9 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" +#include "bcc.h" #ifdef DEBUG - -#include "types.h" #include "gencode.h" #include "reg.h" #include "sc.h" diff --git a/bcc/declare.c b/bcc/declare.c index accd663..1c9b43a 100644 --- a/bcc/declare.c +++ b/bcc/declare.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "align.h" #include "byteord.h" #include "gencode.h" @@ -644,7 +643,7 @@ PRIVATE void declfunc() arg1size = itypesize; argsp = softsp -= arg1size; } -#if BIG_ENDIAN +#if INT_BIG_ENDIAN if (argsize < itypesize) argsp += itypesize - argsize; symptr->offset.offi = argsp; diff --git a/bcc/express.c b/bcc/express.c index e6ee64c..22d5bed 100644 --- a/bcc/express.c +++ b/bcc/express.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "gencode.h" #include "parse.h" #include "reg.h" diff --git a/bcc/exptree.c b/bcc/exptree.c index 6b24eff..1a079e7 100644 --- a/bcc/exptree.c +++ b/bcc/exptree.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "byteord.h" #include "gencode.h" #include "parse.h" @@ -13,7 +12,7 @@ #include "sizes.h" #include "type.h" -#ifdef __AS386_16__ +#ifdef VERY_SMALL_MEMORY #define ETREESIZE 300 #else #define ETREESIZE 1200 @@ -375,6 +374,7 @@ struct nodestruct *p2; if (lscalar & RSCALAR && !(rscalar & RSCALAR)) { double val; + /* XXX: Gcc warns about ansi vs k&r problem with this */ static double MAXULONG = (double)0xFFFFFFFFL +1; val = *target->offset.offd; @@ -425,7 +425,7 @@ struct nodestruct *p2; if (long_big_endian) #endif #if DYNAMIC_LONG_ORDER || LONG_BIG_ENDIAN -# if BIG_ENDIAN +# if INT_BIG_ENDIAN target->offset.offi += targszdelta; # else { @@ -438,7 +438,7 @@ struct nodestruct *p2; else #endif #if DYNAMIC_LONG_ORDER || LONG_BIG_ENDIAN == 0 -# if BIG_ENDIAN +# if INT_BIG_ENDIAN { if (rscalar & CHAR) target->offset.offi += ctypesize; diff --git a/bcc/floatop.c b/bcc/floatop.c index fb9c54d..38b0e52 100644 --- a/bcc/floatop.c +++ b/bcc/floatop.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "gencode.h" #include "reg.h" #include "sc.h" diff --git a/bcc/function.c b/bcc/function.c index 7beaa14..5d30a40 100644 --- a/bcc/function.c +++ b/bcc/function.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "align.h" #include "byteord.h" #include "gencode.h" diff --git a/bcc/gencode.c b/bcc/gencode.c index 2f7ce5f..a16ff74 100644 --- a/bcc/gencode.c +++ b/bcc/gencode.c @@ -5,8 +5,7 @@ #define islvalop(op) \ (((op) >= ASSIGNOP && (op) <= SUBABOP) || (op) == PTRADDABOP) -#include "const.h" -#include "types.h" +#include "bcc.h" #include "align.h" #include "condcode.h" #include "reg.h" diff --git a/bcc/genloads.c b/bcc/genloads.c index 9c77032..26933f8 100644 --- a/bcc/genloads.c +++ b/bcc/genloads.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "byteord.h" #include "condcode.h" #include "gencode.h" diff --git a/bcc/glogcode.c b/bcc/glogcode.c index 2f39080..7aac27c 100644 --- a/bcc/glogcode.c +++ b/bcc/glogcode.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "condcode.h" #include "gencode.h" #include "reg.h" diff --git a/bcc/hardop.c b/bcc/hardop.c index 51f9616..c6adb87 100644 --- a/bcc/hardop.c +++ b/bcc/hardop.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "byteord.h" #include "condcode.h" #include "gencode.h" @@ -380,11 +379,11 @@ struct symstruct *target; indcount = source->indcount; # endif outopsep(); -# if BIG_ENDIAN == 0 +# if INT_BIG_ENDIAN == 0 ++source->offset.offi; # endif outadr(source); -# if BIG_ENDIAN == 0 +# if INT_BIG_ENDIAN == 0 --source->offset.offi; # endif # if MAXINDIRECT > 1 @@ -396,7 +395,7 @@ struct symstruct *target; } outregname(BREG); outopsep(); -# if BIG_ENDIAN +# if INT_BIG_ENDIAN ++source->offset.offi; # endif outadr(source); diff --git a/bcc/input.c b/bcc/input.c index f905416..1adedda 100644 --- a/bcc/input.c +++ b/bcc/input.c @@ -5,8 +5,7 @@ #define ARBITRARY_BACKSLASH_NEWLINES_NOT #define INSERT_BACKSLASH_NEWLINES_NOT -#include "const.h" -#include "types.h" +#include "bcc.h" #include "gencode.h" #include "output.h" #include "os.h" diff --git a/bcc/label.c b/bcc/label.c index 394a47c..635a5bd 100644 --- a/bcc/label.c +++ b/bcc/label.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "condcode.h" #include "gencode.h" #include "label.h" diff --git a/bcc/loadexp.c b/bcc/loadexp.c index 632c2ad..6ecb82f 100644 --- a/bcc/loadexp.c +++ b/bcc/loadexp.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "byteord.h" #include "gencode.h" #include "parse.h" diff --git a/bcc/longop.c b/bcc/longop.c index f678e11..412ac25 100644 --- a/bcc/longop.c +++ b/bcc/longop.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "byteord.h" #include "gencode.h" #include "reg.h" diff --git a/bcc/output.c b/bcc/output.c index fb7f1bf..6bc4d04 100644 --- a/bcc/output.c +++ b/bcc/output.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "input.h" #include "os.h" #include "sizes.h" diff --git a/bcc/preproc.c b/bcc/preproc.c index b9aed0e..37ca1d5 100644 --- a/bcc/preproc.c +++ b/bcc/preproc.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "input.h" #include "os.h" #include "output.h" diff --git a/bcc/preserve.c b/bcc/preserve.c index 74b0f34..17ded07 100644 --- a/bcc/preserve.c +++ b/bcc/preserve.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "gencode.h" #include "reg.h" #include "type.h" diff --git a/bcc/proto.h b/bcc/proto.h index e45cf0e..b3e7151 100644 --- a/bcc/proto.h +++ b/bcc/proto.h @@ -2,12 +2,6 @@ /* Copyright (C) 1992 Bruce Evans */ -#ifdef __STDC__ -#define P(x) x -#else -#define P(x) () -#endif - /* assign.c */ void assign P((struct symstruct *source, struct symstruct *target)); void cast P((struct typestruct *type, struct symstruct *target)); @@ -371,28 +365,3 @@ struct typestruct *promote P((struct typestruct *type)); struct typestruct *tounsigned P((struct typestruct *type)); void typeinit P((void)); -/* library - fcntl.h */ -int creat P((const char *_path, int _mode)); -int open P((const char *_path, int _oflag, ...)); - -/* library - stdlib.h */ -double atof P((const char *_str)); -void exit P((int _status)); - -/* library - string.h */ -void *memcpy P((void *_t, const void *_s, unsigned _length)); -void *memset P((void *_s, int _c, unsigned _nbytes)); -char *strcat P((char *_target, const char *_source)); -char *strchr P((const char *_s, int _ch)); -int strcmp P((const char *_s1, const char *_s2)); -char *strcpy P((char *_target, const char *_source)); -unsigned strlen P((const char *_s)); -char *strncpy P((char *_target, const char *_source, unsigned _maxlength)); -char *strrchr P((const char *_s, int _ch)); - -/* library - unistd.h */ -int close P((int _fd)); -int isatty P((int _fd)); -long lseek P((int _fd, long _offset, int _whence)); -int read P((int _fd, char *_buf, unsigned _nbytes)); -int write P((int _fd, char *_buf, unsigned _nbytes)); diff --git a/bcc/scan.c b/bcc/scan.c index 2254e4a..3aad1a2 100644 --- a/bcc/scan.c +++ b/bcc/scan.c @@ -4,8 +4,7 @@ #define GCH1() do { if (SYMOFCHAR(ch = *++lineptr) == SPECIALCHAR) specialchar(); } while (0) -#include "const.h" -#include "types.h" +#include "bcc.h" #include "input.h" #include "os.h" #include "output.h" diff --git a/bcc/softop.c b/bcc/softop.c index 369ad96..6f2dbce 100644 --- a/bcc/softop.c +++ b/bcc/softop.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "gencode.h" #include "reg.h" #include "scan.h" diff --git a/bcc/state.c b/bcc/state.c index 1d0dd04..7a1faef 100644 --- a/bcc/state.c +++ b/bcc/state.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "align.h" #include "condcode.h" #include "gencode.h" diff --git a/bcc/sysproto.h b/bcc/sysproto.h new file mode 100644 index 0000000..b1d19fb --- /dev/null +++ b/bcc/sysproto.h @@ -0,0 +1,27 @@ + +/* library - fcntl.h */ +int creat P((const char *_path, int _mode)); +int open P((const char *_path, int _oflag, ...)); + +/* library - stdlib.h */ +double atof P((const char *_str)); +void exit P((int _status)); + +/* library - string.h */ +void *memcpy P((void *_t, const void *_s, unsigned _length)); +void *memset P((void *_s, int _c, unsigned _nbytes)); +char *strcat P((char *_target, const char *_source)); +char *strchr P((const char *_s, int _ch)); +int strcmp P((const char *_s1, const char *_s2)); +char *strcpy P((char *_target, const char *_source)); +unsigned strlen P((const char *_s)); +char *strncpy P((char *_target, const char *_source, unsigned _maxlength)); +char *strrchr P((const char *_s, int _ch)); + +/* library - unistd.h */ +int close P((int _fd)); +int isatty P((int _fd)); +long lseek P((int _fd, long _offset, int _whence)); +int read P((int _fd, char *_buf, unsigned _nbytes)); +int write P((int _fd, char *_buf, unsigned _nbytes)); + diff --git a/bcc/table.c b/bcc/table.c index 7f4a1ac..19e1528 100644 --- a/bcc/table.c +++ b/bcc/table.c @@ -6,8 +6,7 @@ * usually be set to some level different from OFFKLUDGELEVEL. */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "align.h" #include "gencode.h" #include "os.h" @@ -25,7 +24,7 @@ #define GOLDEN 157 /* GOLDEN/HASHTABSIZE approx golden ratio */ #define HASHTABSIZE 256 #define MARKER ((unsigned) 0x18C396A5L) /* lint everywhere it is used */ -#ifdef __AS386_16__ +#ifdef VERY_SMALL_MEMORY #define MAXEXPR 125 #else #define MAXEXPR 500 diff --git a/bcc/type.c b/bcc/type.c index 7e40f93..fe66b33 100644 --- a/bcc/type.c +++ b/bcc/type.c @@ -2,8 +2,7 @@ /* Copyright (C) 1992 Bruce Evans */ -#include "const.h" -#include "types.h" +#include "bcc.h" #include "align.h" #include "gencode.h" /* s.b. switches.h */ #include "sc.h" diff --git a/bcc/types.h b/bcc/types.h index 755b8b1..79ff836 100644 --- a/bcc/types.h +++ b/bcc/types.h @@ -202,5 +202,3 @@ struct typelist #define NULLNODE ((struct nodestruct *) NULL) #define NULLTYPE ((struct typestruct *) NULL) - -#include "proto.h" -- cgit v1.2.1