Initial commit

This commit is contained in:
ceriel 1989-10-23 11:19:44 +00:00
parent ead414d725
commit d5dc0b7342
5 changed files with 1620 additions and 0 deletions

182
fast_misc/INSTALL Executable file
View file

@ -0,0 +1,182 @@
#!/bin/sh
# installation of fast ACK compilers fcc, fm2, and fpc
# is the call correct?
case $# in
1)
if [ -d $1 ]
then
:
else
echo $0: $1 is not a directory >&2
exit 1
fi
;;
*)
echo $0: Call is $0 \<bin directory\> >&2
exit 1
;;
esac
# investigate machine: either vax or sun(3)
echo $0: determining type of machine ...
cat > t.c <<'EOF'
main() {
#ifdef sun
printf("sun\n");
#endif
#ifdef vax
printf("vax\n");
#endif
}
EOF
if cc t.c
then
:
else
$0: compilation failed >&2
exit 1
fi
m=`./a.out`
rm -f a.out t.[co]
case $m in
sun|vax)
echo $0: Starting installation for a $m ...
;;
*)
echo $0: machine must be sun or vax >&2
exit 1
;;
esac
# make links to proper bin and lib directories
echo $0: creating bin and lib directories ...
rm -f bin lib
ln -s bin.$m bin
ln -s lib.$m lib
# edit manual page
sed s@CHANGE_ME@`pwd`/def@ < man/fm2.1.src > man/fm2.1
# now compile the driver program
echo $0: compiling driver program ...
rm -f fcc fm2 fpc
SunOs4=
if [ -f /usr/lib/ld.so ]
then
# different options for the loader on SunOs 4.0
SunOs4=-DSunOs4
fi
if cc -O -DFASTDIR=\"`pwd`\" $SunOs4 -DFCC -o fcc driver.c &&
cc -O -DFASTDIR=\"`pwd`\" $SunOs4 -DFM2 -o fm2 driver.c &&
cc -O -DFASTDIR=\"`pwd`\" $SunOs4 -DFPC -o fpc driver.c
then
:
else
echo $0: compilation of driver program failed >&2
exit 1
fi
if cc -o str_change str_change.c
then
case $m in
vax)
./str_change /usr/em `pwd` < bin.vax/m2mm > fm2mm
;;
sun)
./str_change /proj/em/Work `pwd` < bin.sun/m2mm > fm2mm
;;
esac
rm -f str_change.o str_change
chmod +x fm2mm
else
echo "$0: compilation of string patching program failed; cannot create fm2mm" >&2
fi
#now run simple tests
echo $0: run some simple tests
failed=false
cat > test.mod <<'EOF'
MODULE test;
FROM InOut IMPORT WriteString, WriteLn;
BEGIN
WriteString("Hello World");
WriteLn
END test.
EOF
if ./fm2 test.mod 2>/dev/null
then
case `a.out` in
"Hello World")
;;
*)
echo $0: fm2 test failed >&2
failed=true
;;
esac
else
echo $0: fm2 compilation failed >&2
failed=true
fi
cat > test.c <<'EOF'
main() { printf("Hello World\n"); }
EOF
if ./fcc test.c 2>/dev/null
then
case `a.out` in
"Hello World")
;;
*)
echo $0: fcc test failed >&2
failed=true
;;
esac
else
echo $0: fcc compilation failed >&2
failed=true
fi
cat > test.p <<'EOF'
program p(output); begin writeln('Hello World') end.
EOF
if ./fpc test.p 2>/dev/null
then
case `a.out` in
"Hello World")
;;
*)
echo $0: fpc test failed >&2
failed=true
;;
esac
else
echo $0: fpc compilation failed >&2
failed=true
fi
rm -f test.* a.out
case $failed in
true)
echo $0: some tests failed, installation aborted >&2
exit 1
;;
false)
rm -f $1/fm2 $1/fcc $1/fpc
cp fm2 fcc fpc $1
if [ -f fm2mm ]
then
rm -f $1/fm2mm
cp fm2mm $1/fm2mm
fi
rm -f fm2 fpc fcc fm2mm
echo $0: Installation completed
exit 0
;;
esac

166
fast_misc/INSTALL_A Executable file
View file

@ -0,0 +1,166 @@
#!/bin/sh
# installation of fast ACK compilers afcc, afm2
# is the call correct?
case $# in
1)
if [ -d $1 ]
then
:
else
echo $0: $1 is not a directory >&2
exit 1
fi
;;
*)
echo $0: Call is $0 \<ACK home directory\> >&2
exit 1
;;
esac
# investigate machine: either vax or sun(3)
echo $0: determining type of machine ...
cat > t.c <<'EOF'
main() {
#ifdef sun
printf("sun\n");
#endif
#ifdef vax
printf("vax\n");
#endif
}
EOF
if cc t.c
then
:
else
echo $0: compilation failed >&2
exit 1
fi
m=`./a.out`
rm -f a.out t.[co]
case $m in
sun|vax)
echo $0: Starting installation for a $m ...
;;
*)
echo $0: machine must be sun or vax >&2
exit 1
;;
esac
# edit manual page
sed s@CHANGE_ME@$1/lib/m2@ < man/afm2.1.src > man/afm2.1
# install the compiler binaries
echo $0: copying compiler binaries ...
case $m in
sun)
cp ack.sun/cemcom* ack.sun/m2* $1/lib/m68020
;;
vax)
cp ack.vax/cemcom* ack.vax/m2* $1/lib/vax4
;;
esac
# now compile the driver program
echo $0: compiling driver program ...
rm -f afcc afm2
if cc -O -DACK_BIN -I$1/h -DFCC -o afcc driver.c &&
cc -O -DACK_BIN -I$1/h -DFM2 -o afm2 driver.c
then
:
else
echo $0: compilation of driver program failed >&2
exit 1
fi
( cd $1/lang/m2/libm2
echo 'killbss() { }' > killbss.c
../../../bin/acc -L -c -LIB killbss.c
cp LIST LIST.old
echo 'killbss.c' >> LIST
../../../bin/arch r tail_m2.a killbss.c
) > /dev/null 2>&1
case $m in
sun)
( cd $1/lib/sun3
cp tail_m2 tail_m2.orig
../../bin/aal r tail_m2 ../../lang/m2/libm2/killbss.o
)
;;
vax)
( cd $1/lib/vax4
cp tail_m2 tail_m2.orig
ar r tail_m2 ../../lang/m2/libm2/killbss.o
ranlib tail_m2
)
;;
esac > /dev/null 2>&1
#now run simple tests
echo $0: run some simple tests
failed=false
cat > test.mod <<'EOF'
MODULE test;
FROM InOut IMPORT WriteString, WriteLn;
BEGIN
WriteString("Hello World");
WriteLn
END test.
EOF
if ./afm2 test.mod 2>/dev/null
then
case `a.out` in
"Hello World")
;;
*)
echo $0: afm2 test failed >&2
failed=true
;;
esac
else
echo $0: afm2 compilation failed >&2
failed=true
fi
cat > test.c <<'EOF'
main() { printf("Hello World\n"); }
EOF
if ./afcc test.c 2>/dev/null
then
case `a.out` in
"Hello World")
;;
*)
echo $0: afcc test failed >&2
failed=true
;;
esac
else
echo $0: afcc compilation failed >&2
failed=true
fi
rm -f test.* a.out
case $failed in
true)
echo $0: some tests failed, installation aborted >&2
exit 1
;;
false)
rm -f $1/bin/afm2 $1/bin/afcc
cp afm2 afcc $1/bin
rm -f afm2 afcc
cp man/afcc.1 man/afm2.1 $1/man
echo $0: Installation completed
exit 0
;;
esac

80
fast_misc/READ_ME.n Normal file
View file

@ -0,0 +1,80 @@
.ND
.SH
Installing the fast ACK compilers
.LP
This is the first distribution of the fast ACK compilers, in
binary form, for either a DEC VAX running Berkeley Unix BSD 4.2 or BSD 4.3,
or a SUN-3 MC68020 work-station running SunOS 3.2-3.5, or SunOS 4.0.
The distribution contains a C-, a Modula-2-, and a Pascal-compiler producing object
code that is compatible with cc-produced object code. There are also
versions for C and Modula-2 producing object code that is compatible
with ACK, 4th distribution.
The distribution also contains a Modula-2 makefile generator.
.LP
The tape contains the following files and directories:
.IP "lib.vax and bin.vax"
.br
binaries and libraries for the VAX.
.IP "lib.sun and bin.sun"
.br
binaries and libraries for the SUN-3.
.IP def
directory containing definition modules of the Modula-2 run-time system.
.IP man
directory containing manual pages.
.IP doc
directory containing some documents describing the languages implemented.
.IP "ack.sun and ack.vax"
.br
binaries for ACK compatible fast compilers.
.IP "driver.c"
.br
sources of the compiler driver.
.IP "READ_ME"
.br
the file you are reading now.
.IP "INSTALL" and "INSTALL_A"
.br
shell-scripts taking care of the installation.
.LP
Installation makes the following commands available:
.IP fm2
fast Modula-2 compiler.
.IP fcc
fast C compiler.
.IP fpc
fast Pascal compiler.
.IP fm2mm
.br
makefile generator for fast Modula-2 compiler.
.LP
To install these commands, proceed as follows:
.IP 1.
Create a directory for the compilers, f.i. /usr/local/lib/fastc.
You will need about 3 megabyte to extract the tape.
.IP 2.
Go to this directory and extract the tape (which is in 1600 bpi tar-format).
.IP 3.
Execute the INSTALL shell-script with one argument: the directory in
which the fm2, fcc, fpc, and fm2mm binaries must be installed, f.i.
/usr/local/bin.
This will take care of the installation of the cc(1) compatible
versions of the fast ACK compilers.
The INSTALL script will also run some small tests.
.IP 4.
The man-subdirectory contains manual pages. When you have satisfied
yourself that fm2, fcc, and fpc work properly, install the
fm2, fm2mm, fcc, and fpc manual pages
in a public man-directory, and announce the availability of
fm2, fm2mm, fcc, and fpc.
.IP 5.
The tape also contains ACK-compatible fast ACK compilers for C and Modula-2.
If you have the 4th ACK distribution (became available in august 1988),
you can use the INSTALL_A shell-script to install these in the ACK tree.
Call INSTALL_A with the ACK home directory as argument.
This will make afm2 and afcc available in the ACK bin-directory.
.IP 6.
After the installation, some directories are no longer needed. The ack.sun
and ack.vax directories can be removed; when on a SUN, the bin.vax and
lib.vax directories can be removed; when on a VAX, the bin.sun and lib.sun
directories can be removed.

1097
fast_misc/driver.c Normal file

File diff suppressed because it is too large Load diff

95
fast_misc/str_change.c Normal file
View file

@ -0,0 +1,95 @@
/* Utility to change strings in binary files.
Reads from standard input, writes on standard output.
Only replaces one occurrence if the -s flag is given.
*/
#include <stdio.h>
main(argc, argv)
char *argv[];
{
register char *psrc;
register int ch;
int srclen;
int sflag = 0;
char *progname = argv[0];
while (argc > 1 && argv[1][0] == '-') {
switch(argv[1][1]) {
case 's':
sflag = 1;
break;
default:
fprintf(stderr,
"Usage: %s [-s] <originalstring> <replacementstring>\n",
progname);
exit(1);
}
argc--;
argv++;
}
if (argc != 3) {
fprintf(stderr,
"Usage: %s [-s] <originalstring> <replacementstring>\n",
progname);
exit(1);
}
psrc = argv[1];
srclen = strlen(psrc);
if (srclen == 0) {
fprintf(stderr,
"%s: originalstring must have length > 0\n",
progname);
exit(1);
}
for (;;) {
ch = getchar();
if (ch == EOF) exit(0);
if (ch != (*psrc & 0377)) {
putchar(ch);
continue;
}
do {
psrc++;
ch = getchar();
} while (ch && ch == (*psrc & 0377));
if (ch != EOF) ungetc(ch, stdin);
if (*psrc == '\0') {
/* we have a match */
register int i;
register char *prepl = argv[2];
for (i = srclen; i; i--) {
if (*prepl) {
putchar(*prepl);
prepl++;
}
else putchar('\0');
}
while (*prepl) {
putchar(*prepl);
prepl++;
if (ch != EOF) ch = getchar();
}
if (sflag) {
break;
}
}
else {
register char *p = argv[1];
while (p < psrc) {
putchar(*p);
p++;
}
if (ch == EOF) exit(0);
}
psrc = argv[1];
}
if (ch == EOF) exit(0);
while ((ch = getchar()) != EOF) {
putchar(ch);
}
exit(0);
}