Renamed the language libraries and runtimes to have more
conventional names.
This commit is contained in:
19
lang/pc/Makefile
Normal file
19
lang/pc/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
d=../..
|
||||
h=$d/h
|
||||
|
||||
cmp:
|
||||
(cd comp ; make cmp)
|
||||
|
||||
install:
|
||||
(cd comp ; make install)
|
||||
|
||||
clean:
|
||||
-rm -f *.o *.old
|
||||
(cd comp ; make clean)
|
||||
|
||||
opr:
|
||||
make pr ^ opr
|
||||
|
||||
pr:
|
||||
@(cd comp ; make pr)
|
||||
@(cd libpc ; make pr)
|
||||
60
lang/pc/comp/Resolve
Executable file
60
lang/pc/comp/Resolve
Executable file
@@ -0,0 +1,60 @@
|
||||
: create a directory Xsrc with name clashes resolved
|
||||
: and run make in that directory
|
||||
: '$Header$'
|
||||
|
||||
case $# in
|
||||
1)
|
||||
;;
|
||||
*) echo "$0: one argument expected" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
PW=`pwd`
|
||||
case $1 in
|
||||
main) target=$PW/$1
|
||||
;;
|
||||
omain) target=$PW/$1
|
||||
options=-DPEEPHOLE
|
||||
;;
|
||||
cemain) target=$PW/$1
|
||||
options=-DCODE_EXPANDER
|
||||
;;
|
||||
Xlint) target=$1
|
||||
;;
|
||||
*) echo "$0: $1: Illegal argument" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
if test -d ../Xsrc
|
||||
then
|
||||
:
|
||||
else mkdir ../Xsrc
|
||||
fi
|
||||
make EMHOME=$EMHOME longnames
|
||||
: remove code generating routines from the clashes list as they are defines.
|
||||
: code generating routine names start with C_
|
||||
sed '/^C_/d' < longnames > tmp$$
|
||||
cclash -c -l7 tmp$$ > ../Xsrc/Xclashes
|
||||
rm -f tmp$$
|
||||
cd ../Xsrc
|
||||
if cmp -s Xclashes clashes
|
||||
then
|
||||
:
|
||||
else
|
||||
mv Xclashes clashes
|
||||
fi
|
||||
rm -f Makefile
|
||||
ed - $PW/Makefile <<'EOF'
|
||||
/^#EXCLEXCL/,/^#INCLINCL/d
|
||||
w Makefile
|
||||
q
|
||||
EOF
|
||||
for i in `cat $PW/Cfiles`
|
||||
do
|
||||
cat >> Makefile <<EOF
|
||||
|
||||
$i: clashes $PW/$i
|
||||
\$(CID) -Fclashes < $PW/$i > $i
|
||||
EOF
|
||||
done
|
||||
make EMHOME=$EMHOME COPTIONS=$options MACH=$MACH CURRDIR=$PW/ $target
|
||||
1
lang/pc/comp/Version.c
Normal file
1
lang/pc/comp/Version.c
Normal file
@@ -0,0 +1 @@
|
||||
static char Version[] = "ACK Pascal compiler Version 2.2";
|
||||
394
lang/pc/comp/char.c
Normal file
394
lang/pc/comp/char.c
Normal file
@@ -0,0 +1,394 @@
|
||||
#include "class.h"
|
||||
char tkclass[] = {
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STSKIP,
|
||||
STNL,
|
||||
STNL,
|
||||
STNL,
|
||||
STSKIP,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STSKIP,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STSTR,
|
||||
STSIMP,
|
||||
STSIMP,
|
||||
STSIMP,
|
||||
STSIMP,
|
||||
STSIMP,
|
||||
STSIMP,
|
||||
STCOMP,
|
||||
STSIMP,
|
||||
STNUM,
|
||||
STNUM,
|
||||
STNUM,
|
||||
STNUM,
|
||||
STNUM,
|
||||
STNUM,
|
||||
STNUM,
|
||||
STNUM,
|
||||
STNUM,
|
||||
STNUM,
|
||||
STCOMP,
|
||||
STSIMP,
|
||||
STCOMP,
|
||||
STSIMP,
|
||||
STCOMP,
|
||||
STGARB,
|
||||
STSIMP,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STSIMP,
|
||||
STGARB,
|
||||
STSIMP,
|
||||
STSIMP,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STIDF,
|
||||
STSIMP,
|
||||
STGARB,
|
||||
STSIMP,
|
||||
STGARB,
|
||||
STGARB,
|
||||
STEOI,
|
||||
};
|
||||
char inidf[] = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
char isdig[] = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
49
lang/pc/comp/next.c
Normal file
49
lang/pc/comp/next.c
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "debug.h"
|
||||
struct lab *h_lab = 0;
|
||||
#ifdef DEBUG
|
||||
int cnt_lab = 0;
|
||||
#endif
|
||||
struct forwtype *h_forwtype = 0;
|
||||
#ifdef DEBUG
|
||||
int cnt_forwtype = 0;
|
||||
#endif
|
||||
struct def *h_def = 0;
|
||||
#ifdef DEBUG
|
||||
int cnt_def = 0;
|
||||
#endif
|
||||
struct withdesig *h_withdesig = 0;
|
||||
#ifdef DEBUG
|
||||
int cnt_withdesig = 0;
|
||||
#endif
|
||||
struct node *h_node = 0;
|
||||
#ifdef DEBUG
|
||||
int cnt_node = 0;
|
||||
#endif
|
||||
struct scope *h_scope = 0;
|
||||
#ifdef DEBUG
|
||||
int cnt_scope = 0;
|
||||
#endif
|
||||
struct scopelist *h_scopelist = 0;
|
||||
#ifdef DEBUG
|
||||
int cnt_scopelist = 0;
|
||||
#endif
|
||||
struct paramlist *h_paramlist = 0;
|
||||
#ifdef DEBUG
|
||||
int cnt_paramlist = 0;
|
||||
#endif
|
||||
struct type *h_type = 0;
|
||||
#ifdef DEBUG
|
||||
int cnt_type = 0;
|
||||
#endif
|
||||
struct case_hdr *h_case_hdr = 0;
|
||||
#ifdef DEBUG
|
||||
int cnt_case_hdr = 0;
|
||||
#endif
|
||||
struct case_entry *h_case_entry = 0;
|
||||
#ifdef DEBUG
|
||||
int cnt_case_entry = 0;
|
||||
#endif
|
||||
struct tmpvar *h_tmpvar = 0;
|
||||
#ifdef DEBUG
|
||||
int cnt_tmpvar = 0;
|
||||
#endif
|
||||
4
lang/pc/comp/nmclash.c
Normal file
4
lang/pc/comp/nmclash.c
Normal file
@@ -0,0 +1,4 @@
|
||||
/* Accepted if many characters of long names are significant */
|
||||
abcdefghijklmnopr() { }
|
||||
abcdefghijklmnopq() { }
|
||||
main() { }
|
||||
295
lang/pc/comp/tab.c
Normal file
295
lang/pc/comp/tab.c
Normal file
@@ -0,0 +1,295 @@
|
||||
/* @cc tab.c -o $INSTALLDIR/tab@
|
||||
tab - table generator
|
||||
|
||||
Author: Erik Baalbergen (..tjalk!erikb)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static char *RcsId = "$Header$";
|
||||
|
||||
#define MAXTAB 10000
|
||||
#define MAXBUF 10000
|
||||
#define COMCOM '-'
|
||||
#define FILECOM '%'
|
||||
|
||||
int InputForm = 'c';
|
||||
char OutputForm[MAXBUF] = "%s,\n";
|
||||
int TabSize = 257;
|
||||
char *Table[MAXTAB];
|
||||
char *Name;
|
||||
char *ProgCall;
|
||||
|
||||
main(argc, argv)
|
||||
char *argv[];
|
||||
{
|
||||
ProgCall = *argv++;
|
||||
argc--;
|
||||
while (argc-- > 0) {
|
||||
if (**argv == COMCOM) {
|
||||
option(*argv++);
|
||||
}
|
||||
else {
|
||||
process(*argv++, InputForm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
Salloc(s)
|
||||
char *s;
|
||||
{
|
||||
char *malloc();
|
||||
char *ns = malloc(strlen(s) + 1);
|
||||
|
||||
if (ns) {
|
||||
strcpy(ns, s);
|
||||
}
|
||||
return ns;
|
||||
}
|
||||
|
||||
option(str)
|
||||
char *str;
|
||||
{
|
||||
/* note that *str indicates the source of the option:
|
||||
either COMCOM (from command line) or FILECOM (from a file).
|
||||
*/
|
||||
switch (*++str) {
|
||||
|
||||
case ' ': /* command */
|
||||
case '\t':
|
||||
case '\0':
|
||||
break;
|
||||
case 'I':
|
||||
InputForm = *++str;
|
||||
break;
|
||||
case 'f':
|
||||
if (*++str == '\0') {
|
||||
fprintf(stderr, "%s: -f: name expected\n", ProgCall);
|
||||
exit(1);
|
||||
}
|
||||
DoFile(str);
|
||||
break;
|
||||
case 'F':
|
||||
sprintf(OutputForm, "%s\n", ++str);
|
||||
break;
|
||||
case 'T':
|
||||
printf("%s\n", ++str);
|
||||
break;
|
||||
case 'p':
|
||||
PrintTable();
|
||||
break;
|
||||
case 'C':
|
||||
ClearTable();
|
||||
break;
|
||||
case 'S':
|
||||
{
|
||||
register i = stoi(++str);
|
||||
|
||||
if (i <= 0 || i > MAXTAB) {
|
||||
fprintf(stderr, "%s: size would exceed maximum\n",
|
||||
ProgCall);
|
||||
}
|
||||
else {
|
||||
TabSize = i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
fprintf(stderr, "%s: bad option -%s\n", ProgCall, str);
|
||||
}
|
||||
}
|
||||
|
||||
ClearTable()
|
||||
{
|
||||
register i;
|
||||
|
||||
for (i = 0; i < MAXTAB; i++) {
|
||||
Table[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
PrintTable()
|
||||
{
|
||||
register i;
|
||||
|
||||
for (i = 0; i < TabSize; i++) {
|
||||
if (Table[i]) {
|
||||
printf(OutputForm, Table[i]);
|
||||
}
|
||||
else {
|
||||
printf(OutputForm, "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
process(str, format)
|
||||
char *str;
|
||||
{
|
||||
char *cstr = str;
|
||||
char *Name = cstr; /* overwrite original string! */
|
||||
|
||||
/* strip of the entry name
|
||||
*/
|
||||
while (*str && *str != ':') {
|
||||
if (*str == '\\') {
|
||||
++str;
|
||||
}
|
||||
*cstr++ = *str++;
|
||||
}
|
||||
|
||||
if (*str != ':') {
|
||||
fprintf(stderr, "%s: bad specification: \"%s\", ignored\n",
|
||||
ProgCall, Name);
|
||||
return 0;
|
||||
}
|
||||
*cstr = '\0';
|
||||
str++;
|
||||
|
||||
switch (format) {
|
||||
|
||||
case 'c':
|
||||
return c_proc(str, Name);
|
||||
default:
|
||||
fprintf(stderr, "%s: bad input format\n", ProgCall);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
c_proc(str, Name)
|
||||
char *str;
|
||||
char *Name;
|
||||
{
|
||||
int ch, ch2;
|
||||
int quoted();
|
||||
|
||||
while (*str) {
|
||||
if (*str == '\\') {
|
||||
ch = quoted(&str);
|
||||
}
|
||||
else {
|
||||
ch = *str++;
|
||||
}
|
||||
if (*str == '-') {
|
||||
if (*++str == '\\') {
|
||||
ch2 = quoted(&str);
|
||||
}
|
||||
else {
|
||||
if (ch2 = *str++);
|
||||
else str--;
|
||||
}
|
||||
if (ch > ch2) {
|
||||
fprintf(stderr, "%s: bad range\n", ProgCall);
|
||||
return 0;
|
||||
}
|
||||
if (ch >= 0 && ch2 <= 255)
|
||||
while (ch <= ch2)
|
||||
Table[ch++] = Salloc(Name);
|
||||
}
|
||||
else {
|
||||
if (ch >= 0 && ch <= 255)
|
||||
Table[ch] = Salloc(Name);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
quoted(pstr)
|
||||
char **pstr;
|
||||
{
|
||||
register int ch;
|
||||
register int i;
|
||||
register char *str = *pstr;
|
||||
|
||||
if ((*++str >= '0') && (*str <= '9')) {
|
||||
ch = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
ch = 8 * ch + *str - '0';
|
||||
if (*++str < '0' || *str > '9')
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (*str++) {
|
||||
|
||||
case 'n':
|
||||
ch = '\n';
|
||||
break;
|
||||
case 't':
|
||||
ch = '\t';
|
||||
break;
|
||||
case 'b':
|
||||
ch = '\b';
|
||||
break;
|
||||
case 'r':
|
||||
ch = '\r';
|
||||
break;
|
||||
case 'f':
|
||||
ch = '\f';
|
||||
break;
|
||||
default :
|
||||
ch = *str;
|
||||
}
|
||||
}
|
||||
*pstr = str;
|
||||
return ch & 0377;
|
||||
}
|
||||
|
||||
int
|
||||
stoi(str)
|
||||
char *str;
|
||||
{
|
||||
register i = 0;
|
||||
|
||||
while (*str >= '0' && *str <= '9') {
|
||||
i = i * 10 + *str++ - '0';
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
char *
|
||||
getline(s, n, fp)
|
||||
char *s;
|
||||
FILE *fp;
|
||||
{
|
||||
register c = getc(fp);
|
||||
char *str = s;
|
||||
|
||||
while (n--) {
|
||||
if (c == EOF) {
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
if (c == '\n') {
|
||||
*str++ = '\0';
|
||||
return s;
|
||||
}
|
||||
*str++ = c;
|
||||
c = getc(fp);
|
||||
}
|
||||
s[n - 1] = '\0';
|
||||
return s;
|
||||
}
|
||||
|
||||
#define BUFSIZE 1024
|
||||
|
||||
DoFile(name)
|
||||
char *name;
|
||||
{
|
||||
char text[BUFSIZE];
|
||||
FILE *fp;
|
||||
|
||||
if ((fp = fopen(name, "r")) == NULL) {
|
||||
fprintf(stderr, "%s: cannot read file %s\n", ProgCall, name);
|
||||
exit(1);
|
||||
}
|
||||
while (getline(text, BUFSIZE, fp) != NULL) {
|
||||
if (text[0] == FILECOM) {
|
||||
option(text);
|
||||
}
|
||||
else {
|
||||
process(text, InputForm);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ local d = ROOTDIR.."lang/pc/libpc/"
|
||||
head = ackfile {
|
||||
file (d.."head_pc.e"),
|
||||
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/head_pc")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/pascal.o")
|
||||
}
|
||||
|
||||
tail = acklibrary {
|
||||
@@ -83,7 +83,7 @@ tail = acklibrary {
|
||||
ackfile (d.."rcka.c"),
|
||||
ackfile (d.."trp.e"),
|
||||
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/tail_pc")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libpascal.a")
|
||||
}
|
||||
|
||||
lang_pc_runtime = group {
|
||||
|
||||
Reference in New Issue
Block a user