donn@utah-cs.UUCP (Donn Seeley) (06/05/87)
In an earlier posting, I said that I might put together a shar file of
all the changes I made to get C++ to fit into the 4.3 BSD mode of doing
things, and to get it to run under HP-UX on HP9000 series 200/300
boxen. As more people got their C++ 1.2.1 tapes, more interest
developed, and so I finally got around to producing the shar file. The
diffs in the shar file produce a much cleaned-up makefile (partly
thanks to Keith Muller at UC San Diego) and add some bug fixes to the
sources (mostly due to Keith Gorlen and Bjarne). The diffs are simple
to install -- just pull the shar'ed files out into a directory, then
run a shell script which will patch a fresh C++ 1.2.1 distribution with
the appropriate diffs. In theory an installation should reduce to:
read in the C++ tape; run the script which adds the patches; run one of
the '*.fix' scripts; then do 'make' and 'make install'.
Have fun,
Donn Seeley University of Utah CS Dept donn@cs.utah.edu
40 46' 6"N 111 50' 34"W (801) 581-5668 utah-cs!donn
PS -- I will be out of town for the next couple weeks at Usenix and
other places, so I won't be answering mail...
------------------------------- cut here -------------------------------
: Run this shell script with "sh" not "csh"
PATH=:/bin:/usr/bin:/usr/ucb
export PATH
all=FALSE
if [ $1x = -ax ]; then
all=TRUE
fi
/bin/echo 'Extracting CC.1.diff'
sed 's/^X//' <<'//go.sysin dd *' >CC.1.diff
*** /tmp/,RCSt1005822 Wed May 27 16:24:32 1987
--- CC.1 Thu Mar 19 23:37:38 1987
***************
*** 113,142 ****
.IR cpp (1)
for preprocessor options.
.SH FILES
! file.c input file
! .br
! file..c cfront output
! .br
! file.o object file
! .br
! a.out linked output
! .br
! /lib/cpp C preprocessor
! .br
! cfront C front end
! .br
! /bin/cc C compiler
! .br
! /lib/libc.a standard C library; see Section (3) in the
! .I \s-1UNIX\s+1 System V
! \f2Programmer Reference Manual\f1
! .br
! /lib/libC.a C++ library
! .br
! /usr/include/CC standard directory for \f3#include\f1 files
! .br
! /usr/include standard directory for \f3#include\f1 files
! when the +\f3V\f1 option is used
.SH "SEE ALSO"
cc(1), monitor(3), prof(1), ld(1), cpp(1), as(1).
.br
--- 113,134 ----
.IR cpp (1)
for preprocessor options.
.SH FILES
! .nf
! .ta 3i
! file.c input file
! file..c cfront output
! file.o object file
! a.out linked output
! /lib/cpp C preprocessor
! /usr/local/lib/cfront C front end
! /usr/local/lib/munch fixes up static constructors
! /bin/cc C compiler
! /lib/libc.a standard C library
! /usr/local/lib/libC.a C++ library
! /usr/include/local/CC standard directory for \f3#include\f1 files
! /usr/include standard directory for \f3#include\f1 files
! when the +\f3V\f1 option is used
! .fi
.SH "SEE ALSO"
cc(1), monitor(3), prof(1), ld(1), cpp(1), as(1).
.br
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 CC.1.diff
/bin/echo -n ' '; /bin/ls -ld CC.1.diff
fi
/bin/echo 'Extracting CC.sh.diff'
sed 's/^X//' <<'//go.sysin dd *' >CC.sh.diff
*** /tmp/,RCSt1005805 Wed May 27 16:24:28 1987
--- CC.sh Tue Mar 31 21:34:16 1987
***************
*** 1,6 ****
--- 1,8 ----
#!/bin/sh
#ident "@(#)cfront:CC 1.20"
+ PATH=/bin:/usr/bin
+
trap 'rm -f __err$$ $B$ISUF; exit' 1 2 3 15
LIB_ID=${LIB_ID-C}
LIBRARY=${LIBRARY--l${LIB_ID}}
***************
*** 14,26 ****
P=
CPLUS=-Dc_plusplus=1
OO="a.out"
! I=${I-"/usr/include/CC"}
ISUF="..c"
MVLIST=
ccC=${ccC-cc}
! cfrontC=${cfrontC-cfront}
! munchC=${munchC-munch}
cppC=${cppC-/lib/cpp}
G=0
for A do
case $A in
--- 16,33 ----
P=
CPLUS=-Dc_plusplus=1
OO="a.out"
! I=${I-%%%INCDIR%%%}
ISUF="..c"
MVLIST=
ccC=${ccC-cc}
! cfrontC=${cfrontC-%%%LIBDIR%%%/cfront}
! patchC=${cfrontC-%%%LIBDIR%%%/patch} # for COFF executables
! munchC=${munchC-%%%LIBDIR%%%/munch} # for BSD executables
cppC=${cppC-/lib/cpp}
+ LPATH="${LPATH-/lib:/usr/lib}:%%%LIBDIR%%%"
+ export LPATH # for hp9000s
+ BSD=%%%BSD%%%
+ PATCH=%%%PATCH%%%
G=0
for A do
case $A in
***************
*** 76,82 ****
;;
*.[Cc]) if test -f $A
then
! B=`basename $A .[cC]`
if test $PON
then
if test $SUF
--- 83,89 ----
;;
*.[Cc]) if test -f $A
then
! B=`echo $A | sed -e 's:^.*/::' -e 's:\.[cC]$::'`
if test $PON
then
if test $SUF
***************
*** 240,255 ****
cat __err$$
elif test "$DASHR" != 1 # find ctors/dtors
then
! nm $NMFLAGS $OO | $munchC $P >__ctdt.c
! case $? in
! 1) $ccC -c __ctdt.c >/dev/null
! #echo "ld __ctdt.o $Z $LIBRARY -lc"
! $ccC $P __ctdt.o $Z $LIBRARY # re-load
! rm __ctdt.o
! EE=$?
! ;;
! esac
! rm __ctdt.c
fi
;;
esac
--- 247,268 ----
cat __err$$
elif test "$DASHR" != 1 # find ctors/dtors
then
! if test -n "$PATCH"
! then
! # assume COFF
! $patchC $OO
! else
! nm $NMFLAGS $OO | $munchC $P >__ctdt.c
! case $? in
! 1) $ccC -c __ctdt.c >/dev/null
! #echo "ld __ctdt.o $Z $LIBRARY -lc"
! $ccC $P __ctdt.o $Z $LIBRARY # re-load
! rm __ctdt.o
! EE=$?
! ;;
! esac
! rm __ctdt.c
! fi
fi
;;
esac
***************
*** 270,273 ****
;;
*) exit $E
esac
-
--- 283,285 ----
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 CC.sh.diff
/bin/echo -n ' '; /bin/ls -ld CC.sh.diff
fi
/bin/echo 'Extracting LOG'
sed 's/^X//' <<'//go.sysin dd *' >LOG
'basename' doesn't permit patterns in the suffix on Berkeley Unix, and
it's not documented on the System V boxen around here either... [CC.sh]
'vax' doesn't exist on our system; I made it a link to /bin/true.
[makefile]
If you run 'make libC.a' twice, it will return a bad status in the huge
'if' statement the second time. Adding a '-' to the beginning of this
statement forces 'make' to continue. [makefile]
There still is the same old problem with incl/signal.h including
<sys/signal.h> and getting a complaint about redefining the type of
signal(), which is declared in both files. I hacked around this by
inserting '#define signal SIGNAL' before the '#include <sys/signal.h>'
and putting '#undef signal' after it. [incl: signal.h]
'make clean' doesn't work because it uses 'test -f *.o' and '*.o' of
course expands to several files. I simply threw out all the tests and
used '-rm -f ...' instead. What version of 'test' does this 'right'?
[makefile]
There was no entry for 'make install'. I added a Berkeley-style
install entry based on Keith Muller's. Several variables control the
placement of the compiler shell, the front end, the include files and
the manual page. [makefile]
The manual page needs to be updated to reflect local conventions for
file locations. Note that the FILES section is a botch since it uses
tabs in 'fill' mode, expecting troff to produce line breaks in
predictable places. [CC.1]
I changed the makefile to run 'sed' over a 'CC.sh' file to produce the
'CC' script. The 'sed' invocation sets INCDIR (include directory) and
LIBDIR (where 'cfront' lives) from the corresponding makefile variables.
XFor configuration convenience, BSD and PATCH are also substituted.
[CC.sh, makefile]
I needed to build a System V version of C++ and I found that makefile
goes through some unnecessary agony to produce distinct Berkeley and
System V compilers. I consolidated much of the code, basically by
extensively propagating the PATCH makefile variable. The Patch
subdirectory should no longer be needed. [makefile, CC.sh; lib/static:
_main.c, dtors.c]
HP9000 boxen have a short flags member in struct _iobuf, but are
otherwise like System V; bsd.sed was modified into hp.sed. The c++
include file was also modified. BEWARE -- the makefile sticks a
definition for BSD into stdio.h; you can't just copy it to a System
V box, unfortunately. [scratch: hp.sed; incl: stdio.h]
HP9000 boxen have a peculiar way of obtaining MAXFLOAT. [incl: math.h]
A note: makefile, math.h, stdio.h, task.c, *_swap.s and size.h all have
configuration information for particular host types... It would be
nice to consolidate all this but I'm not that ambitious just yet.
When I tried compiling on the HP9000, I didn't notice that the size.h
file by default declares all sizes and alignments to be 0. It really
should barf its guts out when you compile for an unknown box. Just
a little reminder. [src: size.h]
We have a host named 'cc', which is pretty useless, but it did
stimulate me to add a line to CC.sh which sets the PATH variable to
something innocent. [CC.sh]
Added an hp.fix script analogous to bsd.fix, for HP9000s. [hp.fix]
The default makefile entry is now 'boot'. This entry will do a make
from the bootstrap level if there is no CC in BINDIR, and will do a
'make all' otherwise. Thus if you've configured the makefile and
have run the appropriate *.fix script, you can move the source tree
to a machine which has no installed C++ compiler and do a 'make',
and something useful will happen. [makefile]
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 664 LOG
/bin/echo -n ' '; /bin/ls -ld LOG
fi
/bin/echo 'Extracting MERGE'
sed 's/^X//' <<'//go.sysin dd *' >MERGE
#! /bin/sh
#
# script to install patches in a c++ 1.2.1 distribution
# run this on a virgin c++ 1.2.1 distribution directory
# when you're done, go through the usual c++ installation procedure
# note that BSD VAXen require BSD on and PATCH off in the makefile,
# and bsd.sed must be run on the scratch sources
# on HP9000 series 200s, BSD and PATCH must be off in the makefile
# and the supplied hp.sed must be run on the scratch sources
#
#
# if you want to use rcs and the rcs binaries are not in /usr/new
# then alter this path appropriately
#
PATH=/usr/new:/usr/ucb:/bin:/usr/bin
diffdir=`expr "$0" : "^\(.*\)/" "|" "."`
cd $diffdir
diffdir=`pwd`
srcfiles=`cat srcfiles`
if [ -z "$CPLUSPLUSDIR" ]
then
echo -n "Where is the C++ distribution directory? "
read CPLUSPLUSDIR
fi
if [ -z "$CPLUSPLUSDIR" -o ! -d "$CPLUSPLUSDIR" ]
then
echo "$CPLUSPLUSDIR is not a directory..."
echo "Let's try again..."
exec sh $0
fi
cd $diffdir
cd $CPLUSPLUSDIR
missing=
for f in $srcfiles
do
if [ ! -f $f -o ! -r $f ]
then
missing="$missing $f"
fi
done
if [ -n "$missing" ]
then
echo "Some files that need to be patched are missing or unreadable..."
echo "$missing" | fmt
echo "Let's try again..."
cd $diffdir
exec sh $0
fi
if [ ! -r README ]
then
echo "Can't read README!"
echo "Hope you know what you're doing..."
elif what README | egrep -s "cfront:README 1\.11$"
then
: this is a 1.2.1 distribution
else
echo "The distributed README file should have SCCS revision"
echo "1.11 if this is a standard C++ 1.2.1 distribution..."
echo "If you don't have a 1.2.1 distribution, this script"
echo "will probably not work correctly."
echo -n "Is there any point in continuing? [yes/no] "
read yn
if [ "$yn" = "yes" ]
then
echo "Hope you know what you're doing..."
else
echo "Too bad..."
exit 1
fi
fi
if [ -z "$USERCS" ]
then
echo -n "Do you want the modified files checked in with RCS? [yes/no] "
read yn
if [ "$yn" = "yes" ]
then
USERCS=yes
echo "Okay, RCS it is..."
else
echo "Okay, the old files will be left in *.orig..."
fi
sleep 1
fi
echo "New files:"
newfiles="`cat $diffdir/newfiles`"
for f in $newfiles
do
nf=`echo $f | tr : /`
echo " installing $nf"
cp $diffdir/$f $nf
done
if [ ! -f CC.sh ]
then
echo "Renaming files:"
echo " renaming CC to CC.sh"
mv CC CC.sh
fi
echo "Patching files:"
patchfiles="`cat $diffdir/patchfiles`"
for p in $patchfiles
do
(
f=`basename $p .diff | tr : /`
echo " patching $f"
d=`expr $f : "^\(.*\)/" "|" "."`
cd $d
tf=`basename $f`
if [ -n "$USERCS" ]
then
if [ ! -d RCS ]
then
mkdir RCS
fi
ci -l -t/dev/null -sRel -m'c++ 1.2.1' \
$tf > /dev/null 2>&1
patch -s $tf $diffdir/$p
ci -u -m'miscellaneous hacks from Utah and elsewhere' \
$tf > /dev/null 2>&1
rm -f $tf.orig
else
if [ ! -w $tf ]
then
mv $tf $tf.save
cp $tf.save $tf
fi
patch -s $tf $diffdir/$p
if [ -f $tf.save ]
then
rm -f $tf.orig
mv $tf.save $tf.orig
fi
fi
)
done
echo "Finished the update..."
echo ""
echo "Be sure to run bsd.fix to configure a VAX 4.3 BSD version;"
echo "run hp.fix to configure an HP9000 Series 200/300 version."
exit 0
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 555 MERGE
/bin/echo -n ' '; /bin/ls -ld MERGE
fi
/bin/echo 'Extracting READ_ME'
sed 's/^X//' <<'//go.sysin dd *' >READ_ME
May 27, 1987
This is an update to the C++ 1.2.1 distribution which fixes a few known
bugs and permits easier configuration and installation on VAX 4.3 BSD
systems and HP9000 Series 200/300 systems. To merge in the changes,
run 'sh MERGE'. No warranty expressed or implied, and so on. Some of
the bug fixes are from Keith Gorlen at NIH, and some are from Bjarne
Stroustrup. The Utah changes are documented in the file LOG.
BIG CAVEAT: The hp9000_swap.s file is a simple translation of the
sun_swap.s file -- it almost certainly doesn't work right, but it's a
useful first step. We don't (currently) use Stroustrup's task library
so we haven't had occasion to test it.
Donn Seeley University of Utah CS Dept donn@cs.utah.edu
40 46' 6"N 111 50' 34"W (801) 581-5668 utah-cs!donn
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 READ_ME
/bin/echo -n ' '; /bin/ls -ld READ_ME
fi
/bin/echo 'Extracting bsd.fix.diff'
sed 's/^X//' <<'//go.sysin dd *' >bsd.fix.diff
*** /tmp/,RCSt1012996 Wed May 27 20:19:17 1987
--- bsd.fix Wed May 27 20:14:25 1987
***************
*** 46,53 ****
echo "chmod +w makefile"
chmod +w makefile
ed makefile <<!
! /^CCFLAGS=-O/s/$/ -DBSD/p
! /^BSD=$/s/$/1/p
w
q
!
--- 46,53 ----
echo "chmod +w makefile"
chmod +w makefile
ed makefile <<!
! /^BSD=.*$/s/=.*$/=-DBSD/p
! /^PATCH=.*$/s/=.*$/=/p
w
q
!
***************
*** 55,57 ****
--- 55,59 ----
echo
echo "$0 complete. You may now build cfront as specified"
echo "in the release notes."
+
+ exit 0
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 bsd.fix.diff
/bin/echo -n ' '; /bin/ls -ld bsd.fix.diff
fi
/bin/echo 'Extracting hp.fix'
sed 's/^X//' <<'//go.sysin dd *' >hp.fix
#!/bin/sh
#
# The HP-UX /bin/sed is appallingly slow -- if you replace it with
# a copy built from Berkeley sources, the resulting version
# will run as much as 100 times faster...
#
echo "Fix cfront to allow a build on HP-UX systems:"
echo
echo "Running scratch/hp.sed:"
echo
(cd scratch; sh hp.sed)
echo
echo "Updating makefile"
echo
echo "chmod +w makefile"
chmod +w makefile
ed makefile <<!
X/^BSD=.*$/s/=.*$/=/p
X/^PATCH=.*$/s/=.*$/=/p
w
q
!
echo
echo
echo "$0 complete. You may now build cfront as specified"
echo "in the release notes."
exit 0
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 555 hp.fix
/bin/echo -n ' '; /bin/ls -ld hp.fix
fi
/bin/echo 'Extracting incl:math.h.diff'
sed 's/^X//' <<'//go.sysin dd *' >incl:math.h.diff
*** /tmp/,RCSt1005843 Wed May 27 16:24:35 1987
--- math.h Mon Mar 30 02:23:34 1987
***************
*** 54,59 ****
--- 54,62 ----
#ifdef sun
#define MAXFLOAT 99.e999 /* IEEE infinity */
#endif
+ #ifdef hp9000s200
+ #define MAXFLOAT (*((float *) "\177\177\377\377"))
+ #endif
#define HUGE MAXFLOAT
#define _ABS(x) ((x) < 0 ? -(x) : (x))
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 incl:math.h.diff
/bin/echo -n ' '; /bin/ls -ld incl:math.h.diff
fi
/bin/echo 'Extracting incl:signal.h.diff'
sed 's/^X//' <<'//go.sysin dd *' >incl:signal.h.diff
*** /tmp/,RCSt1005832 Wed May 27 16:24:33 1987
--- signal.h Mon Mar 30 07:54:16 1987
***************
*** 4,10 ****
--- 4,13 ----
#ifndef SIGNALH
#define SIGNALH
+ /* XXX ignore existing signal() definition XXX */
+ #define signal SIGNAL
#include<sys/signal.h>
+ #undef signal
typedef int (*SIG_PF) (...);
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 incl:signal.h.diff
/bin/echo -n ' '; /bin/ls -ld incl:signal.h.diff
fi
/bin/echo 'Extracting incl:stdio.h.diff'
sed 's/^X//' <<'//go.sysin dd *' >incl:stdio.h.diff
*** /tmp/,RCSt1005853 Wed May 27 16:24:37 1987
--- stdio.h Wed Apr 22 20:29:14 1987
***************
*** 12,18 ****
# ifndef FILE
extern struct _iobuf {
! #if vax || u3b || u3b2 || u3b5 || mc68k
int _cnt;
char *_ptr;
#else
--- 12,18 ----
# ifndef FILE
extern struct _iobuf {
! #if vax || u3b || u3b2 || u3b5 || mc68k || hp9000s200
int _cnt;
char *_ptr;
#else
***************
*** 24,30 ****
--- 24,34 ----
int _bufsiz;
short _flag;
# else
+ # if hp9000s200
+ short _flag;
+ # else
char _flag;
+ # endif
# endif
char _file;
} _iob[_NFILE];
***************
*** 77,83 ****
extern int sprintf(char*, const char* ...);
extern int scanf(const char* ...);
extern int fscanf(FILE*, const char* ...);
! extern int sscanf(char*, const char* ...);
extern int fread(char*, unsigned int, int, FILE*);
extern int fwrite(const char*, unsigned int, int, FILE*);
extern int fclose(FILE*);
--- 81,87 ----
extern int sprintf(char*, const char* ...);
extern int scanf(const char* ...);
extern int fscanf(FILE*, const char* ...);
! extern int sscanf(const char*, const char* ...);
extern int fread(char*, unsigned int, int, FILE*);
extern int fwrite(const char*, unsigned int, int, FILE*);
extern int fclose(FILE*);
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 incl:stdio.h.diff
/bin/echo -n ' '; /bin/ls -ld incl:stdio.h.diff
fi
/bin/echo 'Extracting incl:stream.h.diff'
sed 's/^X//' <<'//go.sysin dd *' >incl:stream.h.diff
*** /tmp/,RCSt1005865 Wed May 27 16:24:39 1987
--- stream.h Wed Apr 22 21:05:24 1987
***************
*** 114,120 ****
// Return EOF on error or end of input
// next character on success
! filebuf* open(char *name, open_mode om); // Open a file
// return 0 if failure
// return "this" if success
int close() { int i = opened?::close(fd):0; opened=0; return i; }
--- 114,120 ----
// Return EOF on error or end of input
// next character on success
! filebuf* open(const char *name, open_mode om); // Open a file
// return 0 if failure
// return "this" if success
int close() { int i = opened?::close(fd):0; opened=0; return i; }
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 incl:stream.h.diff
/bin/echo -n ' '; /bin/ls -ld incl:stream.h.diff
fi
/bin/echo 'Extracting lib:static:_main.c.diff'
sed 's/^X//' <<'//go.sysin dd *' >lib:static:_main.c.diff
*** /tmp/,RCSt1005905 Wed May 27 16:24:45 1987
--- _main.c Mon Mar 30 02:46:48 1987
***************
*** 1,6 ****
--- 1,25 ----
/*ident "@(#)cfront:lib/static/_main.c 1.4" */
+
+ #ifdef PATCH
+ struct __link {
+ struct __link *next;
+ char (*ctor)();
+ char (*dtor)();
+ };
+ extern struct __link *__HEAD ;
+ struct __link *__HEAD = (__link *)0;
+ #endif
+
extern void _main()
{
+ #ifdef PATCH
+ struct __link *ptr;
+ for (ptr = __HEAD; ptr; ptr = ptr->next)
+ {
+ if (ptr->ctor)
+ (*(ptr->ctor))();
+ }
+ #else munch
typedef void (*PFV)();
extern PFV _ctors[];
for (PFV* pf=_ctors; *pf; pf++) {
***************
*** 7,10 ****
--- 26,30 ----
(**pf)();
*pf = 0; // permits main to be called recursively
}
+ #endif
}
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 lib:static:_main.c.diff
/bin/echo -n ' '; /bin/ls -ld lib:static:_main.c.diff
fi
/bin/echo 'Extracting lib:static:dtors.c.diff'
sed 's/^X//' <<'//go.sysin dd *' >lib:static:dtors.c.diff
*** /tmp/,RCSt1005915 Wed May 27 16:24:46 1987
--- dtors.c Sun Mar 29 20:32:46 1987
***************
*** 1,9 ****
/*ident "@(#)cfront:lib/static/dtors.c 1.2" */
! typedef void (*PFV)();
! void dtors()
{
extern PFV _dtors[];
static ddone;
if (ddone == 0) { // once only
--- 1,30 ----
/*ident "@(#)cfront:lib/static/dtors.c 1.2" */
! #ifdef PATCH
! struct __link {
! struct __link *next;
! int (*ctor)();
! int (*dtor)();
! };
! extern struct __link *__HEAD;
! #endif
! extern void dtors()
{
+ #ifdef PATCH
+ static int one_time = 0;
+ struct __link *ptr;
+ if (one_time == 0)
+ {
+ one_time = 1;
+ for (ptr = __HEAD; ptr; ptr = ptr->next)
+ {
+ if (ptr->dtor)
+ (*(ptr->dtor))();
+ }
+ }
+ #else munch
+ typedef void (*PFV)();
extern PFV _dtors[];
static ddone;
if (ddone == 0) { // once only
***************
*** 12,15 ****
--- 33,37 ----
while (*pf) pf++;
while (_dtors < pf) (**--pf)();
}
+ #endif
}
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 lib:static:dtors.c.diff
/bin/echo -n ' '; /bin/ls -ld lib:static:dtors.c.diff
fi
/bin/echo 'Extracting lib:stream:filebuf.c.diff'
sed 's/^X//' <<'//go.sysin dd *' >lib:stream:filebuf.c.diff
*** /tmp/,RCSt1005875 Wed May 27 16:24:40 1987
--- filebuf.c Wed Apr 22 20:27:14 1987
***************
*** 2,13 ****
#include "stream.h"
/* define some UNIX calls */
! extern int open (char *, int);
extern int close (int);
extern long lseek (int, long, int);
extern int read (int, char *, unsigned);
extern int write (int, char *, unsigned);
! extern int creat (char *, int);
/*
* Open a file with the given mode.
--- 2,13 ----
#include "stream.h"
/* define some UNIX calls */
! extern int open (const char *, int);
extern int close (int);
extern long lseek (int, long, int);
extern int read (int, char *, unsigned);
extern int write (int, char *, unsigned);
! extern int creat (const char *, int);
/*
* Open a file with the given mode.
***************
*** 14,20 ****
* Return: NULL if failure
* this if success
*/
! filebuf* filebuf::open (char *name, open_mode om)
{
switch (om) {
case input:
--- 14,20 ----
* Return: NULL if failure
* this if success
*/
! filebuf* filebuf::open (const char *name, open_mode om)
{
switch (om) {
case input:
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 lib:stream:filebuf.c.diff
/bin/echo -n ' '; /bin/ls -ld lib:stream:filebuf.c.diff
fi
/bin/echo 'Extracting lib:stream:in.c.diff'
sed 's/^X//' <<'//go.sysin dd *' >lib:stream:in.c.diff
*** /tmp/,RCSt1005885 Wed May 27 16:24:42 1987
--- in.c Wed Apr 22 20:24:00 1987
***************
*** 18,24 ****
{
if (is.tied_to) is.tied_to->flush();
register streambuf *nbp = is.bp;
! register char c = nbp->sgetc();
while (isspace(c&0377)) c = nbp->snextc();
if (c == EOF) is.state |= _eof;
}
--- 18,24 ----
{
if (is.tied_to) is.tied_to->flush();
register streambuf *nbp = is.bp;
! register c = nbp->sgetc();
while (isspace(c&0377)) c = nbp->snextc();
if (c == EOF) is.state |= _eof;
}
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 lib:stream:in.c.diff
/bin/echo -n ' '; /bin/ls -ld lib:stream:in.c.diff
fi
/bin/echo 'Extracting lib:task:hp9000_swap.s'
sed 's/^X//' <<'//go.sysin dd *' >lib:task:hp9000_swap.s
# hp9000_swap.s
# TFRAME is the displacement of t_frame in the task class.
set TFRAME,20
# TH is the displacement of th in the task class.
set TH,24
data
comm _rr4,4
comm _rr3,4
comm _rr2,4
text
global _swap
_swap:
mov.l 4(%sp),%a0 # a0 = this
mov.l TFRAME(%a0),%a6 # a6 (fp) = this -> t_framep
mov.l TH(%a0),%d0 # return this -> th
rts
global _sswap
_sswap:
link.l %a6,&0
mov.l _rr4,%a0 # a0 = t_savearea
mov.l _rr2,%a1 # a1 = t_basep
mov.l _rr3,%d0 # d0 = sz, test if zero
beq.b L2
subq.l &1,%d0 # for dbra
L1:
mov.l (%a0)+,(%a1)+
dbra.w %d0,L1
L2:
mov.l 8(%a6),%a0 # a0 = this
mov.l TFRAME(%a0),(%a6) # a6 (fp) AFTER unlk = this -> t_framep
mov.l TH(%a0),%d0 # return this -> th
unlk %a6
rts
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 lib:task:hp9000_swap.s
/bin/echo -n ' '; /bin/ls -ld lib:task:hp9000_swap.s
fi
/bin/echo 'Extracting lib:task:task.c.diff'
sed 's/^X//' <<'//go.sysin dd *' >lib:task:task.c.diff
*** /tmp/,RCSt1005895 Wed May 27 16:24:43 1987
--- task.c Tue Mar 31 00:56:59 1987
***************
*** 105,110 ****
--- 105,128 ----
#endif
+ #ifdef hp9000s200
+
+ // STACK GROWS DOWN
+ #define FP(p) ( (int*)(&p+1) )
+ #define AP() 0 /* unnecessary on hp9000 */
+ #define OLD_AP(fp) 0 /* unnecessary on hp9000 */
+ #define OLD_FP(fp) (*fp)
+ #define TOP(p) ( (int *) (&p) )
+
+ #define COPY_STACK(f,c,t) while (c--) *t-- = *f--
+ #define ACTIVE_STK_SZ(b,t) b - t + 1 /* size of active stack */
+ #define STACK_BASE(b,s) b + s - 1
+ #define SAVED_AREA(b,s) b - s + 1
+ #define FIX_FRAME(x)\
+ OLD_FP(t_framep) = int(de_fp - x)
+
+ #endif
+
#define SETTRAP() t_trap = *(t_basep + t_stacksize - 1)
#define CHECKTRAP() if (t_trap != *(t_basep+t_stacksize-1))\
task_error(E_STACK,0)
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 lib:task:task.c.diff
/bin/echo -n ' '; /bin/ls -ld lib:task:task.c.diff
fi
/bin/echo 'Extracting makefile.diff'
sed 's/^X//' <<'//go.sysin dd *' >makefile.diff
*** /tmp/,RCSt1005037 Thu May 28 20:02:31 1987
--- makefile Thu May 28 19:57:32 1987
***************
*** 5,12 ****
# CCFLAGS=-O -DBSD
# BSD=1
! CCFLAGS=-O
! BSD=
#Some systems don't predefine $(MAKE)
MAKE=/bin/make
--- 5,22 ----
# CCFLAGS=-O -DBSD
# BSD=1
! DESTDIR=
! BINDIR=/usr/local
! LIBDIR=/usr/local/lib
! INCDIR=/usr/include/local/CC
! MANDIR=/usr/local/man/man1
!
! # Set BSD to -DBSD on Berkeley Unix
! # Set PATCH to -DPATCH on systems which use the COFF object format
! BSD=-DBSD
! PATCH=
!
! CCFLAGS=-O $(BSD) $(PATCH)
#Some systems don't predefine $(MAKE)
MAKE=/bin/make
***************
*** 20,45 ****
#Additional: when make is complete:
# make test - checks that static constructors are properly called
# make clean - removes all .o files generated in these procedures
- #####################
- # make patch ::
- # makes a patch version for SYS V users
- # only need to execute patch targer when building patch with a munch Translator
- # such as during the bootstrap process.
- # if a patch Translator is running, only need to execute mk_patch
- # which will set up the files properly
! CC = CC
! all: libC.a munch cfront
:
libC.a: ck_task
cd lib/mk; $(MAKE) CC=$(CC) CCFLAGS="$(CCFLAGS)" BSD=$(BSD)
mv lib/mk/libC.a .
! munch: always
! $(CC) $(CCFLAGS) -o munch lib/static/munch.c
! rm munch.o
cfront: always
cd src; $(MAKE) CC=$(CC) CCFLAGS="$(CCFLAGS)"
--- 30,80 ----
#Additional: when make is complete:
# make test - checks that static constructors are properly called
# make clean - removes all .o files generated in these procedures
! CC = $(BINDIR)/CC
! #
! # If there is no installed C++, we must bootstrap.
! # We assume that the scratch directory has had any needed modifications.
! #
! boot: always
! -if [ ! -f $(CC) ]; \
! then \
! make ${MFLAGS} "BSD=$(BSD)" "CCFLAGS=$(CCFLAGS)" scratch; \
! rm -f CC; \
! make ${MFLAGS} "BSD=$(BSD)" "PATCH=$(PATCH)" \
! "INCDIR=`pwd`/incl" "LIBDIR=`pwd`" CC; \
! chmod +x CC; \
! (LIBRARY=`pwd`/libC.a; export LIBRARY; \
! make ${MFLAGS} "BSD=$(BSD)" "CCFLAGS=$(CCFLAGS)" \
! "INCDIR=$(INCDIR)" "LIBDIR=$(LIBDIR)" \
! "PATCH=$(PATCH)" "CC=`pwd`/CC" all); \
! rm -f CC; \
! make ${MFLAGS} "BSD=$(BSD)" "PATCH=$(PATCH)" \
! "INCDIR=$(INCDIR)" "LIBDIR=$(LIBDIR)" CC; \
! else \
! make ${MFLAGS} "BSD=$(BSD)" "CCFLAGS=$(CCFLAGS)" \
! "INCDIR=$(INCDIR)" "LIBDIR=$(LIBDIR)" \
! "PATCH=$(PATCH)" "CC=$(CC)" all; \
! fi
!
! all: libC.a munch patch cfront CC
:
+ CC: CC.sh
+ -rm -f CC
+ sed -e s:%%%INCDIR%%%:$(INCDIR):g -e s:%%%LIBDIR%%%:$(LIBDIR):g \
+ -e s:%%%BSD%%%:$(BSD):g -e s:%%%PATCH%%%:$(PATCH):g CC.sh > CC
+
libC.a: ck_task
cd lib/mk; $(MAKE) CC=$(CC) CCFLAGS="$(CCFLAGS)" BSD=$(BSD)
mv lib/mk/libC.a .
! munch: always
! -if test -z "$(PATCH)"; then \
! $(CC) $(CCFLAGS) -o munch lib/static/munch.c; \
! rm -f munch.o; \
! fi
cfront: always
cd src; $(MAKE) CC=$(CC) CCFLAGS="$(CCFLAGS)"
***************
*** 48,85 ****
scratch: always
cd scratch; $(MAKE) CC=$(CC) BSD=$(BSD) CCFLAGS="$(CCFLAGS)"
! patch: mk_patch cfront libC.a munch
! :
!
! mk_patch: patch.o
! if test ! -d nonPatch; then\
! chmod +w CC; \
! mkdir nonPatch; \
! mv CC nonPatch/NP_CC; \
! cp Patch/CC ./CC; \
! chmod +x ./CC; \
! chmod +w src/makefile; \
! sed -e '/^PATCH/s/PATCH=/&-DPATCH/' src/makefile > xXx; \
! mv src/makefile nonPatch/NP_makefile; \
! mv xXx src/makefile; \
! chmod +w lib/static/_main.c lib/static/dtors.c; \
! mv lib/static/_main.c nonPatch/NP__main.c; \
! mv lib/static/dtors.c nonPatch/NP_dtors.c; \
! cp Patch/_main.c lib/static/_main.c; \
! cp Patch/dtors.c lib/static/dtors.c; \
! chmod -w nonPatch/*; \
fi
- patch.o: Patch/patch.c
- cc -o patch -O Patch/patch.c -lld
-
ck_task:
! if vax; then \
if test ! -f lib/task/swap.s ; then\
cp lib/task/vax_swap.s lib/task/swap.s ; fi; \
elif u3b; then \
if test ! -f lib/task/swap.s ; then\
cp lib/task/3b_swap.s lib/task/swap.s ; fi; \
elif sun; then \
if test ! -f lib/task/swap.s ; then\
cp lib/task/sun_swap.s lib/task/swap.s ; fi; \
--- 83,103 ----
scratch: always
cd scratch; $(MAKE) CC=$(CC) BSD=$(BSD) CCFLAGS="$(CCFLAGS)"
! patch: always
! -if test -n "$(PATCH)"; then \
! cc -o patch -O Patch/patch.c -lld; \
fi
ck_task:
! -if vax; then \
if test ! -f lib/task/swap.s ; then\
cp lib/task/vax_swap.s lib/task/swap.s ; fi; \
elif u3b; then \
if test ! -f lib/task/swap.s ; then\
cp lib/task/3b_swap.s lib/task/swap.s ; fi; \
+ elif hp9000s200; then \
+ if test ! -f lib/task/swap.s ; then\
+ cp lib/task/hp9000_swap.s lib/task/swap.s ; fi; \
elif sun; then \
if test ! -f lib/task/swap.s ; then\
cp lib/task/sun_swap.s lib/task/swap.s ; fi; \
***************
*** 94,104 ****
fi ; \
fi
clean:
! if test -f scratch/*..o; then rm scratch/*..o; fi
! if test -f lib/mk/*.o; then rm lib/mk/*.o; fi
! if test -f src/*.o; then rm src/*.o; fi
! if test -f src/y.tab.c; then rm src/y.tab.c; fi
# create a simple test case that will require invocation of static constructors
test:
--- 112,144 ----
fi ; \
fi
+ install:
+ -if test ! -d $(DESTDIR)$(BINDIR); then mkdir $(DESTDIR)$(BINDIR); fi
+ -if test ! -d $(DESTDIR)$(LIBDIR); then mkdir $(DESTDIR)$(LIBDIR); fi
+ -if test ! -d $(DESTDIR)$(INCDIR); then mkdir $(DESTDIR)$(INCDIR); fi
+ -if test ! -d $(DESTDIR)$(MANDIR); then mkdir $(DESTDIR)$(MANDIR); fi
+ mv libC.a $(DESTDIR)$(LIBDIR); chmod 644 $(DESTDIR)$(LIBDIR)/libC.a
+ -if test -n "$(BSD)"; then ranlib $(DESTDIR)$(LIBDIR)/libC.a; fi
+ cp CC $(DESTDIR)$(BINDIR); chmod 755 $(DESTDIR)$(BINDIR)/CC
+ cp cfront $(DESTDIR)$(LIBDIR); chmod 711 $(DESTDIR)$(LIBDIR)/cfront
+ -if test -n "$(PATCH)"; then cp patch $(DESTDIR)$(LIBDIR); chmod 711 $(DESTDIR)$(LIBDIR)/patch; fi
+ -if test -z "$(PATCH)"; then cp munch $(DESTDIR)$(LIBDIR); chmod 711 $(DESTDIR)$(LIBDIR)/munch; fi
+ -chmod 0755 $(DESTDIR)$(INCDIR)
+ -(cd incl; for j in *.[h]; do \
+ cmp -s $$j $(DESTDIR)$(INCDIR)/$$j || \
+ (cp $$j $(DESTDIR)$(INCDIR); chmod 444 $(DESTDIR)$(INCDIR)/$$j);\
+ done)
+ -if test ! -d $(DESTDIR)$(INCDIR)/sys; then mkdir $(DESTDIR)$(INCDIR)/sys; fi
+ -chmod 0755 $(DESTDIR)$(INCDIR)/sys
+ -(cd incl/sys; for j in *.[h]; do \
+ cmp -s $$j $(DESTDIR)$(INCDIR)/sys/$$j || \
+ (cp $$j $(DESTDIR)$(INCDIR)/sys; chmod 444 $(DESTDIR)$(INCDIR)/sys/$$j);\
+ done)
+ -cmp -s CC.1 $(DESTDIR)$(MANDIR)/CC.1 || \
+ (cp CC.1 $(DESTDIR)$(MANDIR); chmod 444 $(DESTDIR)$(MANDIR)/CC.1)
+
clean:
! -rm -f scratch/*.o lib/mk/*.o src/*.o src/y.tab.c
# create a simple test case that will require invocation of static constructors
test:
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 664 makefile.diff
/bin/echo -n ' '; /bin/ls -ld makefile.diff
fi
/bin/echo 'Extracting newfiles'
sed 's/^X//' <<'//go.sysin dd *' >newfiles
LOG
hp.fix
lib:task:hp9000_swap.s
scratch:hp.sed
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 newfiles
/bin/echo -n ' '; /bin/ls -ld newfiles
fi
/bin/echo 'Extracting patchfiles'
sed 's/^X//' <<'//go.sysin dd *' >patchfiles
CC.1.diff
CC.sh.diff
bsd.fix.diff
incl:math.h.diff
incl:signal.h.diff
incl:stdio.h.diff
incl:stream.h.diff
lib:static:_main.c.diff
lib:static:dtors.c.diff
lib:stream:filebuf.c.diff
lib:stream:in.c.diff
lib:task:task.c.diff
makefile.diff
src:expr2.c.diff
src:size.h.diff
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 patchfiles
/bin/echo -n ' '; /bin/ls -ld patchfiles
fi
/bin/echo 'Extracting scratch:hp.sed'
sed 's/^X//' <<'//go.sysin dd *' >scratch:hp.sed
#!/bin/sh
#ident "@(#)cfront:scratch/bsd.sed 1.9"
echo "Fixing _iobuf structures:"
for f in */*..c
do
echo $f
sed -e '/char __iobuf__flag/s//short __iobuf__flag/' $f > temp$$
mv temp$$ $f
done
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 555 scratch:hp.sed
/bin/echo -n ' '; /bin/ls -ld scratch:hp.sed
fi
/bin/echo 'Extracting src:expr2.c.diff'
sed 's/^X//' <<'//go.sysin dd *' >src:expr2.c.diff
*** /tmp/,RCSt1005935 Wed May 27 16:24:50 1987
--- expr2.c Wed Apr 22 20:57:23 1987
***************
*** 1321,1326 ****
--- 1321,1329 ----
case NAME:
{ Pname n = (Pname)this;
if (n->n_evaluated && n->n_scope!=ARG) return n->n_val;
+ if (n->n_initializer
+ && n->n_initializer->base==IVAL
+ && n->n_initializer->i1==n->n_val) return n->n_val;
if (binary_val && strcmp(string,"_result")==0) return 8888;
Neval = "cannot evaluate constant";
return 1;
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 src:expr2.c.diff
/bin/echo -n ' '; /bin/ls -ld src:expr2.c.diff
fi
/bin/echo 'Extracting src:size.h.diff'
sed 's/^X//' <<'//go.sysin dd *' >src:size.h.diff
*** /tmp/,RCSt1005925 Wed May 27 16:24:48 1987
--- size.h Mon Mar 30 07:52:58 1987
***************
*** 120,126 ****
#define DF_SENSITIVE 0
#define DF_OPTIMIZED 1
#else
! #if sun | mc68k
/* most M68K boxes */
#define DBI_IN_WORD 32
#define DBI_IN_BYTE 8
--- 120,126 ----
#define DF_SENSITIVE 0
#define DF_OPTIMIZED 1
#else
! #if sun || mc68k || hp9000s200
/* most M68K boxes */
#define DBI_IN_WORD 32
#define DBI_IN_BYTE 8
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 src:size.h.diff
/bin/echo -n ' '; /bin/ls -ld src:size.h.diff
fi
/bin/echo 'Extracting srcfiles'
sed 's/^X//' <<'//go.sysin dd *' >srcfiles
CC.1
CC
bsd.fix
incl/math.h
incl/signal.h
incl/stdio.h
incl/stream.h
lib/static/_main.c
lib/static/dtors.c
lib/stream/filebuf.c
lib/stream/in.c
lib/task/task.c
makefile
src/expr2.c
src/size.h
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 444 srcfiles
/bin/echo -n ' '; /bin/ls -ld srcfiles
fi