summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>2003-09-20 19:44:36 +0200
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:48:49 +0200
commit22950ba3df3a0b739786243679d69cd4094e8b20 (patch)
tree942907e918e556d340dcbcb8ffdc0f7d020a275e
parent5613ba3c0749fa494d35c4dc36b57c5b4e6edb55 (diff)
downloaddev86-22950ba3df3a0b739786243679d69cd4094e8b20.tar.gz
Import Dev86src-0.16.13.tar.gzv0.16.13
-rw-r--r--Changes8
-rw-r--r--Contributors5
-rw-r--r--Makefile2
-rw-r--r--Mk_dist4
-rw-r--r--ar/Makefile8
-rw-r--r--ar/alloca.c61
-rw-r--r--ar/ar.c4
-rw-r--r--as/Makefile9
-rw-r--r--as/as.c1
-rw-r--r--bcc/Makefile10
-rw-r--r--bcc/bcc.c30
-rw-r--r--bootblocks/boot_win.c33
-rw-r--r--bootblocks/monitor.c3
-rw-r--r--copt/Makefile4
-rwxr-xr-xcpp/cbin6204 -> 0 bytes
-rw-r--r--cpp/c.c88
-rw-r--r--cpp/cygwin.c99
-rw-r--r--cpp/main.c4
-rw-r--r--cpp/q.c26
-rw-r--r--ifdef.c4
-rw-r--r--ld/Makefile12
-rw-r--r--ld/bindef.h2
-rw-r--r--ld/io.c1
-rw-r--r--ld/writebin.c6
-rw-r--r--libc/Makefile4
-rw-r--r--libc/misc/strtol.c6
-rw-r--r--libc/string/string.c5
-rw-r--r--makefile.in77
-rw-r--r--unproto/Makefile4
-rw-r--r--unproto/unproto.c4
30 files changed, 316 insertions, 208 deletions
diff --git a/Changes b/Changes
index ba73fba..88a23d8 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,13 @@
For version 0.16.*.
+> More changes so it compiles better on 'other' machines.
+ Removed some GNU-Make'isms in the top header file.
+
+> Some changes for cygwin, it isn't quite as nasty as compiling for minix
+ but it doesn't miss by much!
+
+> Compiling for the 'tcc' complier, nice and easy.
+
> Hitting bcc.c again, bcc-cpp now the default.
> Some bugfixes for DEC Alpha -- 64 bit longs!
diff --git a/Contributors b/Contributors
index ad6c92c..bc37b0b 100644
--- a/Contributors
+++ b/Contributors
@@ -11,10 +11,7 @@ The files are available at linux.mit.edu with the source and yesterday's
patch file available via http://cix.co.uk/~mayday/
We're all available through the Linux-8086 mailing list at:
- linux-8086@vger.rutgers.edu
-
-send a blank message to <majordomo@vger.rutgers.edu> for help on joining
-the list.
+ linux-8086@vger.kernel.org
Rob.
diff --git a/Makefile b/Makefile
index 175bfb2..429ce8e 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
# This file is part of the Linux-8086 Development environment and is
# distributed under the GNU General Public License.
-VERSION=0.16.12
+VERSION=0.16.13
TARGETS= \
clean bcc unproto copt as86 ld86 elksemu \
diff --git a/Mk_dist b/Mk_dist
index 86218e8..542bcc1 100644
--- a/Mk_dist
+++ b/Mk_dist
@@ -175,14 +175,14 @@ echo Creating as86 source archive.
ln -s ${TMPSRC}/as as86-$VERSION
cp -p ${TMPSRC}/man/as86.1 as86-$VERSION/as86.1
cp -p ${TMPSRC}/COPYING as86-$VERSION/COPYING
-echo VERSION=$VERSION > as86-$VERSION/Version
+echo '#define VERSION "'"$VERSION"'"' > as86-$VERSION/version.h
tar cf ${ARCDIR}/as86-$VERSION.tar `find as86-$VERSION/* -prune -type f`
gzip -f9 ${ARCDIR}/as86-*.tar
echo Creating bin86 source archive.
make -s -C ${TMPSRC}/bin86 VERSION=${VERSION} grab
ln -s ${TMPSRC}/bin86 bin86-$VERSION
-echo VERSION=$VERSION > bin86-$VERSION/ld/Version
+echo '#define VERSION "'"$VERSION"'"' > bin86-$VERSION/ld/version.h
tar chf ${ARCDIR}/bin86-$VERSION.tar bin86-$VERSION
make -s -C ${TMPSRC}/bin86 ungrab
gzip -f9 ${ARCDIR}/bin86-*.tar
diff --git a/ar/Makefile b/ar/Makefile
index 792a77a..490a1f6 100644
--- a/ar/Makefile
+++ b/ar/Makefile
@@ -6,12 +6,12 @@ LIBDIR =/usr/bin
CFLAGS =-O
LDFLAGS =
DEFS =
-OBJS= ar.o
+OBJS= ar.o alloca.o
all: ar86
ar86: $(OBJS)
- $(CC) $(LDFLAGS) $^ -o $@
+ $(CC) $(LDFLAGS) $(OBJS) -o $@
install: ar86
install -d $(LIBDIR)
@@ -23,12 +23,12 @@ clean realclean clobber:
$(OBJS): ar.h rel_aout.h
ar.h:
- [ -f ar.h ] || \
+ test -f ar.h || \
{ rm -f ar.h ; ln -s ../libc/include/ar.h . ; } || \
ln ../libc/include/ar.h .
rel_aout.h:
- [ -f rel_aout.h ] || \
+ test -f rel_aout.h || \
{ rm -f rel_aout.h ; ln -s ../ld/rel_aout.h . ; } || \
ln ../ld/rel_aout.h .
diff --git a/ar/alloca.c b/ar/alloca.c
new file mode 100644
index 0000000..880c100
--- /dev/null
+++ b/ar/alloca.c
@@ -0,0 +1,61 @@
+
+#ifdef __STDC__
+#include <stdlib.h>
+#else
+#include <memory.h>
+#include <string.h>
+#endif
+
+#ifdef __TINYC__
+typedef union mem_cell
+{
+ union mem_cell *next; /* A pointer to the next mem */
+ unsigned int size; /* An int >= sizeof pointer */
+ char *depth; /* For the alloca hack */
+}
+mem;
+
+#define m_size(p) ((p) [0].size) /* For malloc */
+#define m_next(p) ((p) [1].next) /* For malloc and alloca */
+#define m_deep(p) ((p) [0].depth) /* For alloca */
+
+static mem *alloca_stack = 0;
+
+void *
+alloca(size)
+size_t size;
+{
+ auto char probe; /* Probes stack depth: */
+ register mem *hp;
+
+ /*
+ * Reclaim garbage, defined as all alloca'd storage that was allocated
+ * from deeper in the stack than currently.
+ */
+
+ for (hp = alloca_stack; hp != 0;)
+ if (m_deep(hp) < &probe)
+ {
+ register mem *np = m_next(hp);
+ free((void *) hp); /* Collect garbage. */
+ hp = np; /* -> next header. */
+ }
+ else
+ break; /* Rest are not deeper. */
+
+ alloca_stack = hp; /* -> last valid storage. */
+ if (size == 0)
+ return 0; /* No allocation required. */
+
+ hp = (mem *) malloc(sizeof(mem)*2 + size);
+ if (hp == 0)
+ return hp;
+
+ m_next(hp) = alloca_stack;
+ m_deep(hp) = &probe;
+ alloca_stack = hp;
+
+ /* User storage begins just after header. */
+ return (void *) (hp + 2);
+}
+#endif
diff --git a/ar/ar.c b/ar/ar.c
index 28cf6e4..1753293 100644
--- a/ar/ar.c
+++ b/ar/ar.c
@@ -29,6 +29,7 @@
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/errno.h>
#include "ar.h"
#include "rel_aout.h"
@@ -43,6 +44,7 @@ extern int sys_nerr;
#define HAVE_RENAME
#undef HAVE_FSYNC
#endif
+#define HAVE_TRAILING_SLASH_IN_NAME
extern int errno;
@@ -53,8 +55,6 @@ extern int errno;
#else
# if defined(sparc) || defined(HAVE_ALLOCA_H)
# include <alloca.h>
-# else
-char *alloca ();
# endif
#endif
diff --git a/as/Makefile b/as/Makefile
index 5873f14..dec98d1 100644
--- a/as/Makefile
+++ b/as/Makefile
@@ -1,8 +1,4 @@
-ifeq ($(VERSION),)
-include Version
-endif
-
CFLAGS=-O
LDFLAGS=-s
LIBDIR=/usr/bin
@@ -20,7 +16,7 @@ as86: $(OBJS)
as86_encap: as86_encap.sh
sed -e "s:%%LIBDIR%%:$(LIBDIR):" -e "s:%%BINDIR%%:$(BINDIR):" \
- < $^ > tmp
+ < as86_encap.sh > tmp
@mv -f tmp $@
chmod +x $@
@@ -35,7 +31,7 @@ clean realclean clobber:
rm -f *.o as86 as86_encap
.c.o:
- $(CC) -DVERSION='"$(VERSION)"' $(CFLAGS) -c $<
+ $(CC) $(CFLAGS) -c $<
as.o: const.h type.h byteord.h macro.h file.h flag.h globvar.h
assemble.o: const.h type.h address.h globvar.h opcode.h scan.h
@@ -53,4 +49,3 @@ pops.o: const.h type.h address.h flag.h globvar.h opcode.h scan.h
readsrc.o: const.h type.h flag.h file.h globvar.h macro.h scan.h source.h
scan.o: const.h type.h globvar.h scan.h
table.o: const.h type.h globvar.h opcode.h scan.h
-
diff --git a/as/as.c b/as/as.c
index 1d58be4..d592b0b 100644
--- a/as/as.c
+++ b/as/as.c
@@ -15,6 +15,7 @@
#include "file.h"
#include "flag.h"
#include "globvar.h"
+#include "version.h"
PUBLIC char hexdigit[] = "0123456789ABCDEF"; /* XXX - ld uses lower case */
diff --git a/bcc/Makefile b/bcc/Makefile
index 93b122c..8c2c19b 100644
--- a/bcc/Makefile
+++ b/bcc/Makefile
@@ -12,7 +12,7 @@ BINDIR =$(PREFIX)/bin
LIBDIR =$(LIBPRE)/lib/bcc
BCCDEFS =-DLOCALPREFIX=$(LIBPRE) -DBINDIR=$(BINDIR) -DDEFARCH=0
-BCFLAGS=$(ANSI) $(CFLAGS) $(LDFLAGS) -DVERSION='"$(VERSION)"'
+BCFLAGS=$(ANSI) $(CFLAGS) $(LDFLAGS)
OBJS = bcc-cc1.o codefrag.o debug.o declare.o express.o exptree.o floatop.o \
function.o gencode.o genloads.o glogcode.o hardop.o input.o label.o \
@@ -28,16 +28,16 @@ install: all
install -m 755 bcc-cc1 $(LIBDIR)/bcc-cc1
bcc: bcc.c
- $(CC) $(BCFLAGS) $(BCCDEFS) $^ -o $@
+ $(CC) $(BCFLAGS) $(BCCDEFS) bcc.c -o $@
ncc: bcc.c
- $(CC) $(BCFLAGS) -DL_TREE -DDEFARCH=0 $^ -o $@
+ $(CC) $(BCFLAGS) -DL_TREE -DDEFARCH=0 bcc.c -o $@
bcc09: bcc.c
- $(CC) $(BCFLAGS) -DMC6809 $(BCCDEFS) $^ -o $@
+ $(CC) $(BCFLAGS) -DMC6809 $(BCCDEFS) bcc.c -o $@
ccc: bcc.c
- $(CC) $(BCFLAGS) -DCCC $(BCCDEFS) $^ -o $@
+ $(CC) $(BCFLAGS) -DCCC $(BCCDEFS) bcc.c -o $@
bcc-cc1: $(OBJS)
$(CC) $(BCCARCH) $(LDFLAGS) $(OBJS) -o bcc-cc1
diff --git a/bcc/bcc.c b/bcc/bcc.c
index 81adda2..9b053e5 100644
--- a/bcc/bcc.c
+++ b/bcc/bcc.c
@@ -32,6 +32,7 @@
#include <sys/wait.h>
#include <signal.h>
#endif
+#include "version.h"
#ifdef MSDOS
#define LOCALPREFIX /linux86
@@ -307,8 +308,8 @@ struct file_list * file;
!do_unproto &&
do_compile);
- if (combined_cpp && !do_optim && !do_as ) last_stage =1;
- if (!combined_cpp && !do_unproto && !do_compile ) last_stage =1;
+ if (combined_cpp && !do_optim && !do_as ) last_stage =1;
+ if (!combined_cpp && !do_compile ) last_stage =1;
newfilename(file, last_stage, (combined_cpp?'s':'i'), (opt_arch<5));
@@ -455,10 +456,10 @@ run_link()
default: command.cmd = LD; break;
}
command_reset();
- if (executable_name == 0) executable_name = "a.out";
-
- command_opt("-o");
- command_opt(executable_name);
+ if (executable_name) {
+ command_opt("-o");
+ command_opt(executable_name);
+ }
if (opt_arch < 2)
command_opt("-y");
@@ -742,6 +743,20 @@ char ** argv;
for(ar=1; ar<argc; ) if (argv[ar][0] != '-')
{
+#ifdef __CYGWIN__
+ if ( executable_name == 0 ) {
+ char * p = strrchr(argv[ar], '.');
+ if (p && p == argv[ar] + strlen(argv[ar]) - 2)
+ {
+ /* This will actually create a COM file, but windows doesn't
+ * care and cygwin will only do PATH searches for EXE files.
+ */
+ *p=0;
+ executable_name = catstr(argv[ar], ".exe");
+ *p = '.';
+ }
+ }
+#endif
append_file(argv[ar++], 0);
file_count++;
}
@@ -937,6 +952,9 @@ char ** argv;
#ifdef MSDOS
if (opt_M==0) opt_M = 'd';
#endif
+#ifdef __CYGWIN__
+ if (opt_M==0) opt_M = 'd';
+#endif
if (opt_M==0) opt_M = (opt_arch==1 ?'l':'n');
switch(opt_M)
{
diff --git a/bootblocks/boot_win.c b/bootblocks/boot_win.c
index 6dafdd8..5ee7180 100644
--- a/bootblocks/boot_win.c
+++ b/bootblocks/boot_win.c
@@ -34,6 +34,7 @@ fatal(str)
main()
{
int i, rv;
+ int floppy_only = 0;
reset_screen();
cprintf("...\n");
@@ -46,20 +47,25 @@ main()
if (rv != 0 || bs_buf[510] != 0x55 || bs_buf[511] != (char)0xAA) {
cprintf("Hard disk not bootable.\n");
- boot_floppy();
+ floppy_only = 1;
}
- for(rv=-1, i=0x1BE; i<0x1FE; i+= 16) {
- if (bs_buf[i] == (char)0x80)
- rv = 0;
- }
+ if (!floppy_only) {
+ for(rv=-1, i=0x1BE; i<0x1FE; i+= 16) {
+ if (bs_buf[i] == (char)0x80)
+ rv = 0;
+ }
- if (rv) {
- cprintf("Hard disk has no active partition.\n");
- boot_floppy();
+ if (rv) {
+ cprintf("Hard disk has no active partition.\n");
+ floppy_only = 1;
+ }
}
- cprintf("Press return to skip hard disk boot: ");
+ if (floppy_only)
+ cprintf("Press return to wipe MBR: ");
+ else
+ cprintf("Press return to skip hard disk boot: ");
__set_es(0x40);
for(i=0; ; i++) {
@@ -67,14 +73,17 @@ main()
while (tv == __deek_es(0x6c))
if (kbhit()) {
getch();
- cprintf(" Skipping HD.\n");
+ cprintf("\n");
goto break_break;
}
if (i%10 == 0) cprintf(".");
if (i>= 18*5) {
- cprintf(" Booting HD.\n");
- boot_hd();
+ cprintf(" Booting.\n");
+ if(floppy_only)
+ boot_floppy();
+ else
+ boot_hd();
}
}
break_break:;
diff --git a/bootblocks/monitor.c b/bootblocks/monitor.c
index d139cf6..8e24cff 100644
--- a/bootblocks/monitor.c
+++ b/bootblocks/monitor.c
@@ -1,5 +1,6 @@
#include "monitor.h"
+#include "version.h"
char command_buf[256];
@@ -143,9 +144,7 @@ void init_prog()
#else
printf(" boot monitor");
#endif
-#ifdef VERSION
printf(", Version %s", VERSION);
-#endif
printf(".\n");
cpu_check();
diff --git a/copt/Makefile b/copt/Makefile
index ae886fb..f727f77 100644
--- a/copt/Makefile
+++ b/copt/Makefile
@@ -1,9 +1,7 @@
copt: copt.c
- $(CC) $(ANSI) $(CFLAGS) $(LDFLAGS) -o $@ $<
+ $(CC) $(ANSI) $(CFLAGS) $(LDFLAGS) -o $@ copt.c
realclean clean:
rm -f *.o copt
-
-# $(CC) $(ANSI) $(CFLAGS) $(LDFLAGS) -o copt copt.c
diff --git a/cpp/c b/cpp/c
deleted file mode 100755
index 869f927..0000000
--- a/cpp/c
+++ /dev/null
Binary files differ
diff --git a/cpp/c.c b/cpp/c.c
deleted file mode 100644
index 03b3ee3..0000000
--- a/cpp/c.c
+++ /dev/null
@@ -1,88 +0,0 @@
-#include <stdio.h>
-#include <errno.h>
-
-#if __STDC__ == (1UL)
-#define strong_alias(Y,X) asm("export _" #X, "_" #X " = _" #Y )
-#else
-#define strong_alias(Y,X) asm("export _" "X", "_" "X" " = _" "Y" )
-#endif
-
-#if 1
-# if __STDC__
-# define comb(x,y) x ## y
-# warning Using Ansi combine
-# elif __BCC__
-# define comb(x,y) x/**/y
-# warning Using bcc combine
-# else
-# define comb(x,y) x/**/y
-# warning Using K&R combine
-# endif
-#endif
-
-#define o define
-#o signed unsigned
-#o unsigned signed
-
-#ifdef signed
-typedef signed char t_sc;
-typedef comb(un,signed) char t_uc;
-
-char c;
-t_sc sc;
-t_uc uc;
-#endif
-
-#pragma full optimise
-strong_alias(main,zulu);
-main()
-{
- int i1, i2, i3;
-
- printf("sizeof(long double) = %d\n", sizeof(long double));
-#ifdef __GNUC__
- printf("sizeof(long float) = ERROR!\n");
- printf("sizeof(long long) = %d\n", sizeof(long long));
-#else
- printf("sizeof(long float) = %d\n", sizeof(long float));
- printf("sizeof(long long) = ERROR!\n");
-#endif
- printf("sizeof(double) = %d\n", sizeof(double));
- printf("sizeof(float) = %d\n", sizeof(float));
-
- c = -6;
- uc = -6;
- sc = -6;
-
- printf("%ld, ", (long)c);
- printf("%ld, ", (long)uc);
- printf("%ld\n", (long)sc);
-
- printf("%d, ", c);
- printf("%d, ", uc);
- printf("%d\n", sc);
-
- i1 = c; i2 = uc; i3 = sc;
-
- printf("%d, ", i1);
- printf("%d, ", i2);
- printf("%d\n", i3);
-
- i1 = (char) 200 + (char) 50;
- i2 = (t_uc) 200 + (t_uc) 50;
- i3 = (t_sc) 200 + (t_sc) 50;
-
- printf("%d, ", i1);
- printf("%d, ", i2);
- printf("%d\n", i3);
-
- c = 200; uc = 200; sc = 200;
-
- i1 = c + (long) 50;
- i2 = uc + (long) 50;
- i3 = sc + (long) 50;
-
- printf("%d, ", i1);
- printf("%d, ", i2);
- printf("%d\n", i3);
-}
diff --git a/cpp/cygwin.c b/cpp/cygwin.c
new file mode 100644
index 0000000..5cb6e39
--- /dev/null
+++ b/cpp/cygwin.c
@@ -0,0 +1,99 @@
+/* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
+ * This file is part of the Linux-8086 C library and is distributed
+ * under the GNU Library General Public License.
+ */
+
+/*
+ * CTYPE Character classification and conversion
+ */
+
+/*
+ * I've copied this here from the bcc libs because cygwin's version has
+ * the _very_ silly feature of using _P as a private library constant.
+ *
+ * Single underscore variables are generally used for private variables
+ * in user libraries; the few stdio ones being 'leftovers' from version7
+ * where user and system libraries were one and the same.
+ *
+ */
+#ifndef __CTYPE_H
+#define __CTYPE_H
+
+static unsigned char __ctype[];
+
+#define __CT_d 0x01 /* numeric digit */
+#define __CT_u 0x02 /* upper case */
+#define __CT_l 0x04 /* lower case */
+#define __CT_c 0x08 /* control character */
+#define __CT_s 0x10 /* whitespace */
+#define __CT_p 0x20 /* punctuation */
+#define __CT_x 0x40 /* hexadecimal */
+
+/* Define these as simple old style ascii versions */
+#define toupper(c) (((c)>='a'&&(c)<='z') ? (c)^0x20 : (c))
+#define tolower(c) (((c)>='A'&&(c)<='Z') ? (c)^0x20 : (c))
+#define _toupper(c) ((c)^0x20)
+#define _tolower(c) ((c)^0x20)
+#define toascii(c) ((c)&0x7F)
+
+#define __CT(c) (__ctype[1+(unsigned char)c])
+
+/* Note the '!!' is a cast to 'bool' and even BCC deletes it in an if() */
+#define isalnum(c) (!!(__CT(c)&(__CT_u|__CT_l|__CT_d)))
+#define isalpha(c) (!!(__CT(c)&(__CT_u|__CT_l)))
+#define isascii(c) (!((c)&~0x7F))
+#define iscntrl(c) (!!(__CT(c)&__CT_c))
+#define isdigit(c) (!!(__CT(c)&__CT_d))
+#define isgraph(c) (!(__CT(c)&(__CT_c|__CT_s)))
+#define islower(c) (!!(__CT(c)&__CT_l))
+#define isprint(c) (!(__CT(c)&__CT_c))
+#define ispunct(c) (!!(__CT(c)&__CT_p))
+#define isspace(c) (!!(__CT(c)&__CT_s))
+#define isupper(c) (!!(__CT(c)&__CT_u))
+#define isxdigit(c) (!!(__CT(c)&__CT_x))
+
+static unsigned char __ctype[257] =
+{
+ 0, /* -1 */
+ __CT_c, __CT_c, __CT_c, __CT_c, /* 0x00..0x03 */
+ __CT_c, __CT_c, __CT_c, __CT_c, /* 0x04..0x07 */
+ __CT_c, __CT_c|__CT_s, __CT_c|__CT_s, __CT_c|__CT_s, /* 0x08..0x0B */
+ __CT_c|__CT_s, __CT_c|__CT_s, __CT_c, __CT_c, /* 0x0C..0x0F */
+
+ __CT_c, __CT_c, __CT_c, __CT_c, /* 0x10..0x13 */
+ __CT_c, __CT_c, __CT_c, __CT_c, /* 0x14..0x17 */
+ __CT_c, __CT_c, __CT_c, __CT_c, /* 0x18..0x1B */
+ __CT_c, __CT_c, __CT_c, __CT_c, /* 0x1C..0x1F */
+
+ __CT_s, __CT_p, __CT_p, __CT_p, /* 0x20..0x23 */
+ __CT_p, __CT_p, __CT_p, __CT_p, /* 0x24..0x27 */
+ __CT_p, __CT_p, __CT_p, __CT_p, /* 0x28..0x2B */
+ __CT_p, __CT_p, __CT_p, __CT_p, /* 0x2C..0x2F */
+
+ __CT_d|__CT_x, __CT_d|__CT_x, __CT_d|__CT_x, __CT_d|__CT_x,/* 0x30..0x33 */
+ __CT_d|__CT_x, __CT_d|__CT_x, __CT_d|__CT_x, __CT_d|__CT_x,/* 0x34..0x37 */
+ __CT_d|__CT_x, __CT_d|__CT_x, __CT_p, __CT_p, /* 0x38..0x3B */
+ __CT_p, __CT_p, __CT_p, __CT_p, /* 0x3C..0x3F */
+
+ __CT_p, __CT_u|__CT_x, __CT_u|__CT_x, __CT_u|__CT_x, /* 0x40..0x43 */
+ __CT_u|__CT_x, __CT_u|__CT_x, __CT_u|__CT_x, __CT_u, /* 0x44..0x47 */
+ __CT_u, __CT_u, __CT_u, __CT_u, /* 0x48..0x4B */
+ __CT_u, __CT_u, __CT_u, __CT_u, /* 0x4C..0x4F */
+
+ __CT_u, __CT_u, __CT_u, __CT_u, /* 0x50..0x53 */
+ __CT_u, __CT_u, __CT_u, __CT_u, /* 0x54..0x57 */
+ __CT_u, __CT_u, __CT_u, __CT_p, /* 0x58..0x5B */
+ __CT_p, __CT_p, __CT_p, __CT_p, /* 0x5C..0x5F */
+
+ __CT_p, __CT_l|__CT_x, __CT_l|__CT_x, __CT_l|__CT_x, /* 0x60..0x63 */
+ __CT_l|__CT_x, __CT_l|__CT_x, __CT_l|__CT_x, __CT_l, /* 0x64..0x67 */
+ __CT_l, __CT_l, __CT_l, __CT_l, /* 0x68..0x6B */
+ __CT_l, __CT_l, __CT_l, __CT_l, /* 0x6C..0x6F */
+
+ __CT_l, __CT_l, __CT_l, __CT_l, /* 0x70..0x73 */
+ __CT_l, __CT_l, __CT_l, __CT_l, /* 0x74..0x77 */
+ __CT_l, __CT_l, __CT_l, __CT_p, /* 0x78..0x7B */
+ __CT_p, __CT_p, __CT_p, __CT_c /* 0x7C..0x7F */
+};
+
+#endif /* __CTYPE_H */
diff --git a/cpp/main.c b/cpp/main.c
index c4e6cdd..b7cf0ee 100644
--- a/cpp/main.c
+++ b/cpp/main.c
@@ -4,7 +4,11 @@
#include <stdlib.h>
#include <locale.h>
#endif
+#ifndef __CYGWIN__
#include <ctype.h>
+#else
+#include "cygwin.c"
+#endif
#include <string.h>
#include <malloc.h>
#include <time.h>
diff --git a/cpp/q.c b/cpp/q.c
deleted file mode 100644
index 8ca4402..0000000
--- a/cpp/q.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#define m_size(p) ((p) [0].size) /* For malloc */
-#define m_next(p) ((p) [1].next) /* For malloc and alloca */
-#define m_deep(p) ((p) [0].depth) /* For alloca */
- m_size(p1) += m_size(m_next(p1));
- m_next(p1) = m_next(m_next(p1));
- noise("JÖIN \"2\" EOF?->˙", p1);
-#asm
- hello??
-??=warning oooer
-/\
-* wtf! */
-#define LOCK_NB 4 /* or'd with one of the above to prevent
- blocking */
-#define LOCK_UN 8 /* remove lock */
-#define bb 11
-#define cc 22
-#define bbcc 4455
-#define comba(x,y) x/**/y
-#define combb(x,y) x ## y
-#define empty
-
- \0 \00 \000 \0000 \200 \x34f \xff
-bb\
-cc
- comba(un,signed); ++ -- >> << {} combb(un,signed);
-#endasm
diff --git a/ifdef.c b/ifdef.c
index 1a9a08e..0d7fcdd 100644
--- a/ifdef.c
+++ b/ifdef.c
@@ -495,4 +495,8 @@ manifest_constant()
#ifdef __minix
save_name("__minix", 'D');
#endif
+/* This isn't much nicer */
+#ifdef __CYGWIN__
+ save_name("__CYGWIN__", 'D');
+#endif
}
diff --git a/ld/Makefile b/ld/Makefile
index 104a740..69170bd 100644
--- a/ld/Makefile
+++ b/ld/Makefile
@@ -1,8 +1,4 @@
-ifeq ($(VERSION),)
-include Version
-endif
-
LIBDIR =/usr/bin
CFLAGS =-O
LDFLAGS =
@@ -13,7 +9,7 @@ LDFLAGS =
# -DSTANDARD_GNU_A_OUT # a.out.h is like GNU normal.
# -DNO_AOUT # a.out.h is like nothing known!
#
-DEFS =-DREL_OUTPUT -DBUGCOMPAT -DVERSION='"$(VERSION)"'
+DEFS =-DREL_OUTPUT -DBUGCOMPAT
# An alternative file for a non-standard a.out.h (eg i386 linux on an Alpha)
#
@@ -25,11 +21,11 @@ OBJS= dumps.o io.o ld.o readobj.o table.o typeconv.o linksyms.o \
all: ld86 objchop catimage objdump86
ld86: $(OBJS)
- $(CC) $(LDFLAGS) $^ -o $@
+ $(CC) $(LDFLAGS) $(OBJS) -o $@
install: ld86
install -d $(LIBDIR)
- install -m 755 $^ $(LIBDIR)
+ install -m 755 ld86 $(LIBDIR)
clean realclean clobber:
rm -f *.o ld86 ld86r objchop catimage objdump86
@@ -38,7 +34,7 @@ $(OBJS): align.h ar.h bindef.h byteord.h config.h const.h globvar.h obj.h \
syshead.h type.h x86_aout.h
ar.h:
- [ -f ar.h ] || \
+ test -f ar.h || \
{ rm -f ar.h ; ln -s ../libc/include/ar.h . ; } || \
ln ../libc/include/ar.h .
diff --git a/ld/bindef.h b/ld/bindef.h
index 0ccbdf9..1c8dc49 100644
--- a/ld/bindef.h
+++ b/ld/bindef.h
@@ -1,4 +1,5 @@
+#if defined(__i386__) || defined(__8086__) || defined(__i386)
#ifndef MSDOS
#ifndef NO_AOUT
/* Ok, I'm just gonna make it simple ... override this if you like. */
@@ -76,3 +77,4 @@
#endif /* NO_AOUT */
#endif /* MSDOS */
+#endif /* CPU type */
diff --git a/ld/io.c b/ld/io.c
index 9dd7b06..743fa94 100644
--- a/ld/io.c
+++ b/ld/io.c
@@ -6,6 +6,7 @@
#include "const.h"
#include "type.h"
#include "globvar.h"
+#include "version.h"
#define DRELBUFSIZE 3072
#define ERR (-1)
diff --git a/ld/writebin.c b/ld/writebin.c
index 1b36ce7..e833f6c 100644
--- a/ld/writebin.c
+++ b/ld/writebin.c
@@ -1053,7 +1053,11 @@ bin_off_t count;
}
#else
-PUBLIC void writebin(outfilename, argsepid, argbits32, argstripflag, arguzp)
+#ifndef FUNCNAME
+#define FUNCNAME writebin
+#endif
+
+PUBLIC void FUNCNAME(outfilename, argsepid, argbits32, argstripflag, arguzp)
char *outfilename;
bool_pt argsepid;
bool_pt argbits32;
diff --git a/libc/Makefile b/libc/Makefile
index 7d1ceb9..a9a5460 100644
--- a/libc/Makefile
+++ b/libc/Makefile
@@ -15,6 +15,10 @@ DEFS=-D__LIBC__
include Make.defs
+ifeq ($(VERSION),)
+include VERSION
+endif
+
CFLAGS=$(ARCH) $(CCFLAGS) $(DEFS)
############################################################################
diff --git a/libc/misc/strtol.c b/libc/misc/strtol.c
index d8d62ea..25ea0ea 100644
--- a/libc/misc/strtol.c
+++ b/libc/misc/strtol.c
@@ -66,8 +66,8 @@ strtoul(const char *nptr, char **endptr, int base)
/* If base==0 and the string begins with "0x" then we're supposed
to assume that it's hexadecimal (base 16). */
- else
- if (base==0 && *nptr=='0')
+ if (base==0 && *nptr=='0')
+ {
if (toupper(*(nptr+1))=='X')
{
base=16;
@@ -80,7 +80,7 @@ strtoul(const char *nptr, char **endptr, int base)
base=8;
nptr++;
}
-
+ }
/* If base is still 0 (it was 0 to begin with and the string didn't begin
with "0"), then we are supposed to assume that it's base 10 */
diff --git a/libc/string/string.c b/libc/string/string.c
index d672e77..3c14e56 100644
--- a/libc/string/string.c
+++ b/libc/string/string.c
@@ -42,10 +42,11 @@ const char * str;
#ifdef PARANOID
push es
- push ds ; Im not sure if this is needed, so just in case.
+ push ds ! Im not sure if this is needed, so just in case.
pop es
cld
-#endif ! This is almost the same as memchr, but it can
+#endif
+ ! This is almost the same as memchr, but it can
! stay as a special.
#if __FIRST_ARG_IN_AX__
diff --git a/makefile.in b/makefile.in
index 2c62caf..ac4c989 100644
--- a/makefile.in
+++ b/makefile.in
@@ -18,19 +18,20 @@ CFLAGS =%CFLAGS%
LDFLAGS =
MAKEARG =CC='$(CC)' CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' \
PREFIX=$(PREFIX) LIBPRE='$(LIBPRE)' LIBDIR='$(LIBDIR)' \
- BINDIR='$(BINDIR)' ANSI='$(ANSI)' VERSION='$(VERSION)'
+ BINDIR='$(BINDIR)' ANSI='$(ANSI)'
MAKEC=$(MAKE) -C
MAKEX=
# This is only allowed on Linux because make needs to know how to look
# inside an archive to get the last modified times of the component .o
-# files. This should be fine for Linux, but it won't be for AIX.
+# files. This should be fine for Linux, but it won't be for AIX etc.
+# Unfortunatly it's even _required_ for linux because some versions
+# of Redhat have a broken standard ar command.
#ifdef __linux__
AR=ar86
#endif
#ifdef __GNUC__
-# unproto is yukky, I've included '-w' in the local makefile.
WALL =-Wall -Wtraditional -Wshadow -Wid-clash-14 -Wpointer-arith \
-Wcast-qual -Wcast-align -Wconversion -Waggregate-return \
@@ -68,6 +69,11 @@ BCCARCH =-Mf -O
#endif
# Alter these if for some reason you don't want this done as root.
+#ifdef __CYGWIN__
+INDAT=-m 644
+INEXE=-m 755
+INSCR=-m 755
+#else
#ifdef __BCC__
INDAT=-o root -g root -m 644
INEXE=-o root -g root -m 755
@@ -77,6 +83,13 @@ INDAT=-o root -g root -m 644
INEXE=-o root -g root -m 755 -s
INSCR=-o root -g root -m 755
#endif
+#endif
+
+#ifdef __CYGWIN__
+EXE=.exe
+#else
+EXE=
+#endif
#ifdef GNUMAKE
all: check_config bcc cpp unproto copt as86 ar86 ld86 objdump86 \
@@ -130,44 +143,47 @@ bindir: $(MAKEX)
#endif
bcc: bindir
+ echo '#define VERSION "'"$(VERSION)"'"' > bcc/version.h
$(MAKEC) bcc $(MAKEARG) BCCARCH='$(BCCARCH)' bcc ncc bcc-cc1
- cp -p bcc/bcc bin/Bcc
- cp -p bcc/ncc bin/ncc
- cp -p bcc/bcc-cc1 lib/bcc-cc1
+ cp -p bcc/bcc$(EXE) bin/Bcc$(EXE)
+ cp -p bcc/ncc$(EXE) bin/ncc$(EXE)
+ cp -p bcc/bcc-cc1$(EXE) lib/bcc-cc1$(EXE)
cpp: bindir
$(MAKEC) cpp $(MAKEARG) bcc-cpp
- cp -p cpp/bcc-cpp lib/bcc-cpp
+ cp -p cpp/bcc-cpp$(EXE) lib/bcc-cpp$(EXE)
unproto: bindir
$(MAKEC) unproto $(MAKEARG) unproto
- cp -p unproto/unproto lib/unproto
+ cp -p unproto/unproto$(EXE) lib/unproto$(EXE)
copt: bindir
$(MAKEC) copt $(MAKEARG) copt
- cp -p copt/copt lib/copt
+ cp -p copt/copt$(EXE) lib/copt$(EXE)
cp -p copt/rules.* lib/.
as86: bindir
+ echo '#define VERSION "'"$(VERSION)"'"' > as/version.h
$(MAKEC) as $(MAKEARG) all
- cp -p as/as86 bin/as86
+ cp -p as/as86$(EXE) bin/as86$(EXE)
cp -p as/as86_encap bin/as86_encap
ar86: bindir
$(MAKEC) ar $(MAKEARG) all
- cp -p ar/ar86 bin/ar86
+ cp -p ar/ar86$(EXE) bin/ar86$(EXE)
ld86: bindir
+ echo '#define VERSION "'"$(VERSION)"'"' > ld/version.h
$(MAKEC) ld $(MAKEARG) ld86
- cp -p ld/ld86 bin/ld86
+ cp -p ld/ld86$(EXE) bin/ld86$(EXE)
ld86r: bindir
$(MAKEC) ld $(MAKEARG) ld86r
- cp -p ld/ld86r bin/ld86r
+ cp -p ld/ld86r$(EXE) bin/ld86r$(EXE)
objdump86: bindir
$(MAKEC) ld $(MAKEARG) objdump86
- cp -p ld/objdump86 bin/objdump86
+ cp -p ld/objdump86$(EXE) bin/objdump86$(EXE)
elksemu: bindir
#ifndef __AS386_16__
@@ -196,19 +212,19 @@ install-ln: bcc cpp unproto copt as86 ar86 ld86 elksemu
install-bcc: bcc cpp unproto copt as86 ar86 ld86 objdump86
install -d $(DISTBIN) $(DISTLIB) $(DISTLIB)/i86
- install $(INEXE) bin/Bcc $(DISTBIN)/bcc
- install $(INSCR) bin/as86_encap $(DISTBIN)/as86_encap
- install $(INEXE) bin/as86 $(DISTBIN)/as86
- install $(INEXE) bin/ar86 $(DISTBIN)/ar86
- install $(INEXE) bin/ld86 $(DISTBIN)/ld86
- install $(INEXE) bin/objdump86 $(DISTBIN)/objdump86
- install $(INEXE) bin/objdump86 $(DISTBIN)/nm86
- install $(INEXE) bin/objdump86 $(DISTBIN)/size86
- install $(INEXE) lib/bcc-cc1 $(DISTLIB)/bcc-cc1
- install $(INEXE) lib/bcc-cpp $(DISTLIB)/bcc-cpp
- install $(INEXE) lib/unproto $(DISTLIB)/unproto
- install $(INEXE) lib/copt $(DISTLIB)/copt
- install $(INDAT) lib/rules.* $(DISTLIB)/i86
+ install $(INEXE) bin/Bcc$(EXE) $(DISTBIN)/bcc$(EXE)
+ install $(INSCR) bin/as86_encap $(DISTBIN)/as86_encap
+ install $(INEXE) bin/as86$(EXE) $(DISTBIN)/as86$(EXE)
+ install $(INEXE) bin/ar86$(EXE) $(DISTBIN)/ar86$(EXE)
+ install $(INEXE) bin/ld86$(EXE) $(DISTBIN)/ld86$(EXE)
+ install $(INEXE) bin/objdump86$(EXE) $(DISTBIN)/objdump86$(EXE)
+ install $(INEXE) bin/objdump86$(EXE) $(DISTBIN)/nm86$(EXE)
+ install $(INEXE) bin/objdump86$(EXE) $(DISTBIN)/size86$(EXE)
+ install $(INEXE) lib/bcc-cc1$(EXE) $(DISTLIB)/bcc-cc1$(EXE)
+ install $(INEXE) lib/bcc-cpp$(EXE) $(DISTLIB)/bcc-cpp$(EXE)
+ install $(INEXE) lib/unproto$(EXE) $(DISTLIB)/unproto$(EXE)
+ install $(INEXE) lib/copt$(EXE) $(DISTLIB)/copt$(EXE)
+ install $(INDAT) lib/rules.* $(DISTLIB)/i86
@test ! -f $(DISTLIB)/as86 || rm -f $(DISTLIB)/as86
@test ! -f $(DISTLIB)/ld86 || rm -f $(DISTLIB)/ld86
@@ -325,12 +341,13 @@ makec:
##############################################################################
-install-other:
+install-other: other
@for i in $(OTHERS) ; do \
$(MAKEC) $$i BCC=ncc DIST=$(DIST) PREFIX=$(PREFIX) install || exit 1 ; \
done
other:
+ echo '#define VERSION "'"$(VERSION)"'"' > bootblocks/version.h
@for i in $(OTHERS) ; do \
$(MAKEC) $$i BCC=ncc DIST=$(DIST) PREFIX=$(PREFIX) || exit 1; \
done
@@ -344,5 +361,9 @@ realclean:
rm -f include
rm -f makec
rm -f `find $(CLEANLIST) -type l -print`
+ rm -f bcc/version.h
+ rm -f as/version.h
+ rm -f ld/version.h
+ rm -f bootblocks/version.h
##############################################################################
diff --git a/unproto/Makefile b/unproto/Makefile
index 5381719..42fb1d9 100644
--- a/unproto/Makefile
+++ b/unproto/Makefile
@@ -83,13 +83,13 @@ OBJECTS = tok_io.o tok_class.o tok_pool.o unproto.o vstring.o symbol.o error.o \
CFLAGS = -O
LDFLAGS =
-CCFLAGS = $(CFLAGS) -w $(PIPE) $(SKIP) $(BELL) $(MAP) $(ALIAS) -DREOPEN
+CCFLAGS = $(CFLAGS) $(PIPE) $(SKIP) $(BELL) $(MAP) $(ALIAS) -DREOPEN
#CFLAGS = -O $(PIPE) $(SKIP) $(BELL) $(MAP) $(ALIAS) -p -Dstatic=
#CFLAGS = -g $(PIPE) $(SKIP) $(BELL) $(MAP) $(ALIAS) -DDEBUG
$(PROG): $(OBJECTS)
- $(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $^ $(MALLOC)
+ $(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(MALLOC)
.c.o:
$(CC) $(CCFLAGS) -c $< -o $@
diff --git a/unproto/unproto.c b/unproto/unproto.c
index da1560c..1f29bff 100644
--- a/unproto/unproto.c
+++ b/unproto/unproto.c
@@ -146,12 +146,12 @@ extern int getopt();
/* Application-specific stuff */
-#include "vstring.h"
-#ifdef _AIX
+#ifdef __STDC__
#include <stdarg.h>
#else
#include "stdarg.h"
#endif
+#include "vstring.h"
#include "token.h"
#include "error.h"
#include "symbol.h"