Merge in build system changes.

This commit is contained in:
David Given 2013-05-16 14:33:19 +01:00
commit 84f81a442c
321 changed files with 3501 additions and 6636 deletions

14
.distr
View file

@ -1,9 +1,7 @@
README
CHANGES
Copyright
pm
pmfile
config.pm
Makefile
h
modules/h
@ -13,7 +11,7 @@ util/data
util/LLgen
modules/src/alloc
modules/src/assert
#modules/src/assert
modules/src/system
modules/src/string
modules/src/read_em
@ -31,7 +29,7 @@ util/ack
lib/descr/fe
util/arch
#util/cpp
util/cgg
#util/cgg
util/ncgg
util/misc
util/opt
@ -43,15 +41,19 @@ lang/cem
lang/pc
lang/m2
#lang/occam
#lang/basic
lang/basic
mach/proto
mach/i80
mach/i86
mach/i386
mach/m68020
plat
plat/cpm
plat/pc86
plat/linux
plat/linux386
plat/linux68k
examples

142
Makefile Normal file
View file

@ -0,0 +1,142 @@
# ======================================================================= #
# ACK CONFIGURATION #
# (Edit this before building) #
# ======================================================================= #
# What platform to build for by default?
DEFAULT_PLATFORM = pc86
# Where should the ACK put its temporary files?
ACK_TEMP_DIR = /tmp
# Where is the ACK going to be installed, eventually?
PREFIX = /usr/local
# Where do you want to put the object files used when building?
BUILDDIR = $(ACK_TEMP_DIR)/ack-build
# What build flags do you want to use?
CFLAGS = -g
LDFLAGS = -s
# ======================================================================= #
# END OF CONFIGURATION #
# ======================================================================= #
#
# You shouldn't need to change anything below this point unless you are
# actually developing ACK.
OBJDIR = $(BUILDDIR)/obj
BINDIR = $(BUILDDIR)/bin
LIBDIR = $(BUILDDIR)/lib
INCDIR = $(BUILDDIR)/include
INSDIR = $(BUILDDIR)/staging
PLATIND = $(INSDIR)/share/ack
PLATDEP = $(INSDIR)/lib/ack
CC = gcc
AR = ar
RM = rm -f
CP = cp
hide = @
CFLAGS += \
-I$(INCDIR) \
-Imodules/h \
-Ih
LDFLAGS +=
all: installables
.DELETE_ON_ERROR:
include first/core.mk
include modules/src/object/build.mk
include modules/src/alloc/build.mk
include modules/src/input/build.mk
include modules/src/idf/build.mk
include modules/src/system/build.mk
include modules/src/string/build.mk
include modules/src/print/build.mk
include modules/src/flt_arith/build.mk
include modules/src/em_code/build.mk
include modules/src/em_mes/build.mk
include modules/src/read_em/build.mk
include util/amisc/build.mk
include util/cmisc/build.mk
include util/ack/build.mk
include util/LLgen/build.mk
include util/data/build.mk
include util/opt/build.mk
include util/ncgg/build.mk
include util/arch/build.mk
include util/misc/build.mk
include util/led/build.mk
include util/topgen/build.mk
include util/ego/build.mk
include lang/cem/build.mk
include lang/basic/build.mk
include lang/pc/build.mk
include lang/m2/build.mk
include mach/proto/as/build.mk
include mach/proto/ncg/build.mk
include mach/proto/top/build.mk
include plat/linux/liblinux/build.mk
include mach/i80/build.mk
include mach/i386/build.mk
include mach/i86/build.mk
include mach/m68020/build.mk
# include mach/powerpc/build.mk
include plat/build.mk
include plat/pc86/build.mk
include plat/cpm/build.mk
include plat/linux386/build.mk
include plat/linux68k/build.mk
# include plat/linuxppc/build.mk
.PHONY: installables
installables: $(INSTALLABLES)
@echo ""
@echo "Build completed successfully."
.PHONY: install
install: installables
@echo INSTALLING into $(PREFIX)
$(hide) tar cf - -C $(INSDIR) . | tar xvf - -C $(PREFIX)
.PHONY: clean
clean:
@echo CLEAN
$(hide) $(RM) $(CLEANABLES)
$(INCDIR)/local.h:
@echo LOCAL
@mkdir -p $(dir $@)
$(hide) echo '#define VERSION 3' > $@
$(hide) echo '#define ACKM "$(DEFAULT_PLATFORM)"' >> $@
$(hide) echo '#define BIGMACHINE 1' >> $@
$(hide) echo '#define SYS_5' >> $@
$(INCDIR)/em_path.h:
@echo EM_PATH
@mkdir -p $(dir $@)
$(hide) echo '#define TMP_DIR "$(ACK_TEMP_DIR)"' > $@
$(hide) echo '#define EM_DIR "$(PREFIX)"' >> $@
$(hide) echo '#define ACK_PATH "share/ack/descr"' >> $@
-include $(DEPENDS)

62
README
View file

@ -1,8 +1,8 @@
THE AMSTERDAM COMPILER KIT V6.0pre4
THE AMSTERDAM COMPILER KIT V6.0pre5
===================================
© 1987-2005 Vrije Universiteit, Amsterdam
2010-08-08
2013-05-15
INTRODUCTION
@ -24,58 +24,57 @@ SUPPORT
Languages:
ANSI C, Pascal, Modula 2. K&R is supported via the ANSI C compiler.
ANSI C, Pascal, Modula 2, Basic. K&R is supported via the ANSI C compiler.
Platforms:
pc86 produces bootable floppy disk images for 8086 PCs
linux386 produces ELF executables for PC Linux systems
linux68k produces ELF executables for m68020 Linux systems
cpm produces i80 CP/M .COM files
INSTALLATION
============
The version 6.0 build mechanism has been completely rewritten and is based
around the Prime Mover build tool (see http://primemover.sf.net for more
information). Installation ought to be fairly straightforward.
The version 5.0 build mechanism has been completely rewritten. Installation
ought to be fairly straightforward.
Requirements:
- an ANSI C compiler. Currently, I'm afraid, it's hard-coded to use gcc.
To change, try changing the variable definitions in first/c.pm. This also
needs to be available as 'cc' from the shell.
- an ANSI C compiler. This defaults to gcc. You can change this by setting
the CC make variable.
- about 20MB free in /tmp (or some other temporary directory).
- about 40MB free in /tmp (or some other temporary directory).
- about 6MB in the target directory.
Instructions:
- edit config.pm. There's a small section at the top containing some editable
variables. Probably the only one you may want to edit is PREFIX, which
changes where the ACK installs to.
- edit the Makefile. There's a small section at the top where you can change
the configuration. Probably the only one you may want to edit is PREFIX,
which changes where the ACK installs to.
- Run:
./pm configure
make
...from the command line. This will write out a configuration file.
...from the command line. This will do the build.
The make system is fully parallelisable. If you have a multicore system,
you probably want to do:
make -j8
...instead (substituting the right number of cores, of course). You can
also shave a few seconds of the build time by using the -r flag.
- Run:
./pm
sudo make install
...from the command line. This will actually do the build. This takes
about two minutes on my 1.6GHz Athlon Linux machine and about 30 on my
166MHz Pentium OpenBSD machine.
- Run:
./pm install
...from the command line (possibly with sudo). This will install the built
ACK into whatever directory you nominated in PREFIX.
...from the command line. This will install the ACK in your PREFIX
directory (by default, /usr/local).
The ACK should now be ready to use.
@ -94,8 +93,9 @@ Some useful options include:
-o <file> specifies the output file
-c produce a .o file
-c.s produce a .s assembly file
-O enable optimisation
-O enable optimisation (optimisation levels go up to 6)
-ansi compile ANSI C (when using the C compiler)
-v be more verbose (repeatable)
<file> build file
ack figures out which language to use from the file extension:
@ -107,6 +107,7 @@ ack figures out which language to use from the file extension:
.p Pascal
.o object files
.s assembly files
.e ACK intermediate code assembly files
For further information, see the man page (which actually does get
installed, but is rather out of date).
@ -117,6 +118,7 @@ A sample command line is:
ack -mlinux386 -O examples/paranoia.c
GOTCHAS
=======
@ -163,8 +165,4 @@ Please enjoy.
David Given (dtrg on Sourceforge)
dg@cowlark.com
2010-08-08
# $Source$
# $State$
# $Revision$
2013-05-13

View file

@ -13,7 +13,7 @@ ACK_TEMP_DIR = "/tmp"
-- Where is the ACK going to be installed, eventually?
PREFIX = "/usr/local"
PREFIX = "/tmp/ack-temp/staging"
-- ======================================================================= --
-- BROKEN ACK CONFIGURATION --

View file

@ -143,7 +143,7 @@ echo ""
if [ -e $destdir ]; then
if [ "$delete" = "yes" ]; then
echo "Press RETURN to erase $destdir and its contents, or CTRL+C to abort."
read
read _ _
echo "Erasing..."
rm -rf "$destdir"
else

View file

@ -1,9 +1,4 @@
ack.pm
ack-custom.pm
c.pm
llgen.pm
yacc.pm
core.mk
#create_dir
#cp_dir
#em_path.h.src

198
first/core.mk Normal file
View file

@ -0,0 +1,198 @@
define reset
$(eval q :=)
$(eval o :=)
$(eval s :=)
$(eval cflags :=)
$(eval ldflags :=)
$(eval objdir :=)
endef
# --- Host compiler
define cfile-rule
$o: $s
@echo CC $o
@mkdir -p $(dir $o)
@$(CC) $(CFLAGS) $(cflags) -MM -MQ $d -o $d $s
$(hide) $(CC) $(CFLAGS) $(cflags) -c -o $o $s
endef
define cfile
$(eval s := $1)
$(eval o := $(OBJDIR)/$(objdir)/$(1:.c=.o))
$(eval d := $(OBJDIR)/$(objdir)/$(1:.c=.d))
$(eval DEPENDS += $d)
$(eval CLEANABLES += $o $d)
$(eval q += $o)
$(eval $(cfile-rule))
endef
# --- ACK compiler
define ackfile-rule
$o: $s $(ACK) \
$(CCOMPILER) \
$(PLATFORM_$(PLATFORM)) \
$(ACK_CORE_TOOLS)
@echo ACK $o
@mkdir -p $(dir $o)
$(hide) ACKDIR=$(INSDIR) $(ACK) $(ACKFLAGS) $(ackflags) -m$(PLATFORM) -c -o $o $s
endef
define ackfile
$(eval s := $1)
$(eval o := $(OBJDIR)/$(objdir)/$(basename $1).o)
$(eval d := $(OBJDIR)/$(objdir)/$(basename $1).d)
$(eval DEPENDS += $d)
$(eval CLEANABLES += $o $d)
$(eval q += $o)
$(eval $(ackfile-rule))
endef
# --- Add a raw to the queue
define file
$(eval q += $1)
endef
# --- Host compiler linking
define cprogram-rule
$o: $s
@echo CPROGRAM $o
@mkdir -p $(dir $o)
$(hide) $(CC) $(CFLAGS) $(cflags) $(LDFLAGS) $(ldflags) -o $o $s
endef
define cprogram
$(eval o := $1)
$(eval s := $q)
$(eval CLEANABLES += $o)
$(eval q := $o)
$(eval $(cprogram-rule))
endef
# --- Host library linking
define clibrary-rule
$o: $s
@echo CLIBRARY $o
@mkdir -p $(dir $o)
@$(RM) $o
$(hide) $(AR) qsc $o $s
endef
define clibrary
$(eval o := $1)
$(eval s := $q)
$(eval CLEANABLES += $o)
$(eval q := $o)
$(eval $(clibrary-rule))
endef
# --- ACK library linking
define acklibrary-rule
$o: $s $(ACKAR)
@echo ACKLIBRARY $o
@mkdir -p $(dir $o)
@$(RM) $o
$(hide) $(AAL) q $o $s
endef
define acklibrary
$(eval o := $1)
$(eval s := $q)
$(eval CLEANABLES += $o)
$(eval q := $o)
$(eval $(acklibrary-rule))
endef
# --- Copies a file.
define copyto-rule
$o: $s
@echo CP $o
@mkdir -p $(dir $o)
$(hide) $(CP) $s $o
endef
define copyto
$(eval o := $1)
$(eval s := $q)
$(eval CLEANABLES += $o)
$(eval q := $o)
$(eval $(copyto-rule))
endef
# --- Installs a file (copies it and adds it to INSTALLABLES).
define installto-rule
$o: $s
@echo INSTALL $o
@mkdir -p $(dir $o)
$(hide) $(CP) $s $o
endef
define installto
$(eval o := $1)
$(eval s := $q)
$(eval CLEANABLES += $o)
$(eval INSTALLABLES += $o)
$(eval q := $o)
$(eval $(installto-rule))
endef
# --- Adds a dependency for the last object file
define dependson
$(eval $o: $1)
endef
# --- Runs yacc.
# $1: directory to put output files
# $2: input files
#
# Output files are compiled via cfile and queued.
define yacc-impl
$(eval o := $1/y.tab.c)
$(eval CLEANABLES += $o $1/y.tab.h)
$o: $2
@echo YACC $o
@mkdir -p $(dir $o)
$(hide) yacc -t -b $1/y -d $2
$(call cfile, $o)
$1/y.tab.h: $o
endef
yacc = $(eval $(call yacc-impl,$1,$2))
# --- Runs flex.
# $1: directory to put output files
# $2: input files
#
# Output files are compiled via cfile and queued.
define flex-impl
$(eval o := $1/lex.yy.c)
$(eval CLEANABLES += $o)
$o: $2
@echo FLEX $o
@mkdir -p $(dir $o)
$(hide) flex -s -t $2 > $o
$(call cfile, $o)
endef
flex = $(eval $(call flex-impl,$1,$2))

View file

@ -1,3 +1,3 @@
pmfile
build.mk
src
lib

3
lang/basic/build.mk Normal file
View file

@ -0,0 +1,3 @@
include lang/basic/lib/build.mk
include lang/basic/src/build.mk

View file

@ -1,4 +1,4 @@
pmfile
build.mk
abs.c
asc.c
asrt.c

View file

@ -7,62 +7,7 @@
/* $Id$ */
#define __NO_DEFS
#include <math.h>
double
_atn(x)
double x;
{
/* Algorithm and coefficients from:
"Software manual for the elementary functions"
by W.J. Cody and W. Waite, Prentice-Hall, 1980
*/
double _atn(double x) { return atan(x); }
static double p[] = {
-0.13688768894191926929e+2,
-0.20505855195861651981e+2,
-0.84946240351320683534e+1,
-0.83758299368150059274e+0
};
static double q[] = {
0.41066306682575781263e+2,
0.86157349597130242515e+2,
0.59578436142597344465e+2,
0.15024001160028576121e+2,
1.0
};
static double a[] = {
0.0,
0.52359877559829887307710723554658381, /* pi/6 */
M_PI_2,
1.04719755119659774615421446109316763 /* pi/3 */
};
int neg = x < 0;
int n;
double g;
if (neg) {
x = -x;
}
if (x > 1.0) {
x = 1.0/x;
n = 2;
}
else n = 0;
if (x > 0.26794919243112270647) { /* 2-sqtr(3) */
n = n + 1;
x = (((0.73205080756887729353*x-0.5)-0.5)+x)/
(1.73205080756887729353+x);
}
/* ??? avoid underflow ??? */
g = x * x;
x += x * g * POLYNOM3(g, p) / POLYNOM4(g, q);
if (n > 1) x = -x;
x += a[n];
return neg ? -x : x;
}

48
lang/basic/lib/build.mk Normal file
View file

@ -0,0 +1,48 @@
define build-runtime-libbasic-impl
$(call reset)
$(eval objdir := $(PLATFORM))
$(call ackfile, lang/basic/lib/fif.e)
$(call ackfile, lang/basic/lib/fef.e)
$(call ackfile, lang/basic/lib/setline.e)
$(call ackfile, lang/basic/lib/abs.c)
$(call ackfile, lang/basic/lib/asc.c)
$(call ackfile, lang/basic/lib/asrt.c)
$(call ackfile, lang/basic/lib/atn.c)
$(call ackfile, lang/basic/lib/chr.c)
$(call ackfile, lang/basic/lib/conversion.c)
$(call ackfile, lang/basic/lib/error.c)
$(call ackfile, lang/basic/lib/exp.c)
$(call ackfile, lang/basic/lib/file.c)
$(call ackfile, lang/basic/lib/hlt.c)
$(call ackfile, lang/basic/lib/io.c)
$(call ackfile, lang/basic/lib/log.c)
$(call ackfile, lang/basic/lib/mki.c)
$(call ackfile, lang/basic/lib/oct.c)
$(call ackfile, lang/basic/lib/peek.c)
$(call ackfile, lang/basic/lib/power.c)
$(call ackfile, lang/basic/lib/print.c)
$(call ackfile, lang/basic/lib/random.c)
$(call ackfile, lang/basic/lib/read.c)
$(call ackfile, lang/basic/lib/return.c)
$(call ackfile, lang/basic/lib/salloc.c)
$(call ackfile, lang/basic/lib/sgn.c)
$(call ackfile, lang/basic/lib/sin.c)
$(call ackfile, lang/basic/lib/sqt.c)
$(call ackfile, lang/basic/lib/stop.c)
$(call ackfile, lang/basic/lib/string.c)
$(call ackfile, lang/basic/lib/swap.c)
$(call ackfile, lang/basic/lib/trace.c)
$(call ackfile, lang/basic/lib/trap.c)
$(call ackfile, lang/basic/lib/write.c)
$(call acklibrary, $(LIBDIR)/$(PLATFORM)/libbasic.a)
$(call installto, $(PLATIND)/$(PLATFORM)/libbasic.a)
endef
build-runtime-libbasic = $(eval $(build-runtime-libbasic-impl))
$(eval RUNTIMES += libbasic)

View file

@ -1,4 +1,5 @@
/* $Id$ */
#include <stdlib.h>
#include <stdio.h>
/* error takes an error value in the range of 0-255 */
/* and generates a trap */

View file

@ -10,88 +10,7 @@
#define __NO_DEFS
#include <math.h>
static double
ldexp(fl,exp)
double fl;
int exp;
double _exp(double x)
{
extern double _fef();
int sign = 1;
int currexp;
if (fl<0) {
fl = -fl;
sign = -1;
}
fl = _fef(fl,&currexp);
exp += currexp;
if (exp > 0) {
while (exp>30) {
fl *= (double) (1L << 30);
exp -= 30;
}
fl *= (double) (1L << exp);
}
else {
while (exp<-30) {
fl /= (double) (1L << 30);
exp += 30;
}
fl /= (double) (1L << -exp);
}
return sign * fl;
}
double
_exp(x)
double x;
{
/* Algorithm and coefficients from:
"Software manual for the elementary functions"
by W.J. Cody and W. Waite, Prentice-Hall, 1980
*/
static double p[] = {
0.25000000000000000000e+0,
0.75753180159422776666e-2,
0.31555192765684646356e-4
};
static double q[] = {
0.50000000000000000000e+0,
0.56817302698551221787e-1,
0.63121894374398503557e-3,
0.75104028399870046114e-6
};
double xn, g;
int n;
int negative = x < 0;
if (x <= M_LN_MIN_D) {
return M_MIN_D;
}
if (x >= M_LN_MAX_D) {
if (x > M_LN_MAX_D) error(3);
return M_MAX_D;
}
if (negative) x = -x;
/* ??? avoid underflow ??? */
n = x * M_LOG2E + 0.5; /* 1/ln(2) = log2(e), 0.5 added for rounding */
xn = n;
{
double x1 = (long) x;
double x2 = x - x1;
g = ((x1-xn*0.693359375)+x2) - xn*(-2.1219444005469058277e-4);
}
if (negative) {
g = -g;
n = -n;
}
xn = g * g;
x = g * POLYNOM2(xn, p);
n += 1;
return (ldexp(0.5 + x/(POLYNOM3(xn, q) - x), n));
return exp(x);
}

View file

@ -1,4 +1,4 @@
/* $Id$ */
#include <stdlib.h>
_hlt(nr)
int nr;

View file

@ -1,9 +1,8 @@
#include "bc_io.h"
#include <sgtty.h>
/* $Id$ */
struct sgttyb _ttydef;
/* dtrg --- this originally used sgtty.h to do clever tty manipulation.
* Strictly this should be converted to use termios, but for simplicity
* we're going to stick with plain stdio for now. */
/* BASIC has some nasty io characteristics */
@ -65,9 +64,6 @@ char *buf;
if( _chann == -1)
{
pos= _pos;
gtty(0,_ttydef);
_ttydef.sg_flags &= ~ECHO;
stty(0,_ttydef);
}else pos= _fdtable[_chann].pos;
c= buf;
while( (holder = fgetc(_chanrd)) != EOF && holder != '\n'){
@ -79,8 +75,6 @@ char *buf;
if( _chann== -1)
{
_pos=pos;
_ttydef.sg_flags |= ECHO;
stty(0,_ttydef);
} else _fdtable[_chann].pos= pos;
}
_tab(x)

View file

@ -10,48 +10,7 @@
#define __NO_DEFS
#include <math.h>
double
_log(x)
double x;
double _log(double x)
{
/* Algorithm and coefficients from:
"Software manual for the elementary functions"
by W.J. Cody and W. Waite, Prentice-Hall, 1980
*/
static double a[] = {
-0.64124943423745581147e2,
0.16383943563021534222e2,
-0.78956112887491257267e0
};
static double b[] = {
-0.76949932108494879777e3,
0.31203222091924532844e3,
-0.35667977739034646171e2,
1.0
};
extern double _fef();
double znum, zden, z, w;
int exponent;
if (x <= 0) {
error(3);
return -HUGE;
}
x = _fef(x, &exponent);
if (x > M_1_SQRT2) {
znum = (x - 0.5) - 0.5;
zden = x * 0.5 + 0.5;
}
else {
znum = x - 0.5;
zden = znum * 0.5 + 0.5;
exponent--;
}
z = znum/zden; w = z * z;
x = z + z * w * (POLYNOM2(w,a)/POLYNOM3(w,b));
z = exponent;
x += z * (-2.121944400546905827679e-4);
return x + z * 0.693359375;
return log(x);
}

View file

@ -1,3 +1,5 @@
#include <stdlib.h>
#include <stdio.h>
#include "bc_string.h"
/* $Id$ */

View file

@ -1,32 +1,4 @@
/* $Id$ */
#include <math.h>
/*
computes a^b.
uses log and exp
*/
double _power(double x, double y) { return pow(x, y); }
double _log(), _exp();
double
_power(base,pownr)
double pownr, base;
{
double temp;
long l;
if(pownr <= 0.0) {
if(pownr == 0.0) {
if(base <= 0.0)
error(3);
return(0.0);
}
l = base;
if(l != base)
error(3);
temp = _exp(base * _log(-pownr));
if(l & 1)
temp = -temp;
return(temp);
}
return(_exp(base * _log(pownr)));
}

View file

@ -1,3 +1,5 @@
#include <stdlib.h>
#include <stdio.h>
#include "bc_string.h"
#include "bc_io.h"

View file

@ -1,4 +1,5 @@
/* $Id$ */
#include <stdlib.h>
#include <stdio.h>
#if !defined(EM_WSIZE)
#define EM_WSIZE _EM_WSIZE

View file

@ -1,6 +1,4 @@
/* $Id$ */
extern char *malloc() ;
#include <stdlib.h>
char * salloc(length)
unsigned length;

View file

@ -10,96 +10,7 @@
#define __NO_DEFS
#include <math.h>
static double
sinus(x, cos_flag)
double x;
{
/* Algorithm and coefficients from:
"Software manual for the elementary functions"
by W.J. Cody and W. Waite, Prentice-Hall, 1980
*/
double _sin(double x) { return sin(x); }
double _cos(double x) { return cos(x); }
double _tan(double x) { return tan(x); }
static double r[] = {
-0.16666666666666665052e+0,
0.83333333333331650314e-2,
-0.19841269841201840457e-3,
0.27557319210152756119e-5,
-0.25052106798274584544e-7,
0.16058936490371589114e-9,
-0.76429178068910467734e-12,
0.27204790957888846175e-14
};
double xsqr;
double y;
int neg = 0;
if (x < 0) {
x = -x;
neg = 1;
}
if (cos_flag) {
neg = 0;
y = M_PI_2 + x;
}
else y = x;
/* ??? avoid loss of significance, if y is too large, error ??? */
y = y * M_1_PI + 0.5;
/* Use extended precision to calculate reduced argument.
Here we used 12 bits of the mantissa for a1.
Also split x in integer part x1 and fraction part x2.
*/
#define A1 3.1416015625
#define A2 -8.908910206761537356617e-6
{
double x1, x2;
extern double _fif();
_fif(y, 1.0, &y);
if (_fif(y, 0.5, &x1)) neg = !neg;
if (cos_flag) y -= 0.5;
x2 = _fif(x, 1.0, &x1);
x = x1 - y * A1;
x += x2;
x -= y * A2;
#undef A1
#undef A2
}
if (x < 0) {
neg = !neg;
x = -x;
}
/* ??? avoid underflow ??? */
y = x * x;
x += x * y * POLYNOM7(y, r);
return neg ? -x : x;
}
double
_sin(x)
double x;
{
return sinus(x, 0);
}
double
_cos(x)
double x;
{
if (x < 0) x = -x;
return sinus(x, 1);
}
/* EXTENSION */
double
_tan(x)
double x;
{
return _sin(x)/_cos(x);
}

View file

@ -10,62 +10,5 @@
#define __NO_DEFS
#include <math.h>
#define NITER 5
double _sqt(double x) { return sqrt(x); }
static double
ldexp(fl,exp)
double fl;
int exp;
{
extern double _fef();
int sign = 1;
int currexp;
if (fl<0) {
fl = -fl;
sign = -1;
}
fl = _fef(fl,&currexp);
exp += currexp;
if (exp > 0) {
while (exp>30) {
fl *= (double) (1L << 30);
exp -= 30;
}
fl *= (double) (1L << exp);
}
else {
while (exp<-30) {
fl /= (double) (1L << 30);
exp += 30;
}
fl /= (double) (1L << -exp);
}
return sign * fl;
}
double
_sqt(x)
double x;
{
extern double _fef();
int exponent;
double val;
if (x <= 0) {
if (x < 0) error(3);
return 0;
}
val = _fef(x, &exponent);
if (exponent & 1) {
exponent--;
val *= 2;
}
val = ldexp(val + 1.0, exponent/2 - 1);
/* was: val = (val + 1.0)/2.0; val = ldexp(val, exponent/2); */
for (exponent = NITER - 1; exponent >= 0; exponent--) {
val = (val + x / val) / 2.0;
}
return val;
}

View file

@ -1,4 +1,5 @@
/* $Id$ */
#include <stdlib.h>
#include <stdio.h>
_stop()
{

View file

@ -1,3 +1,5 @@
#include <stdlib.h>
#include <string.h>
#include "bc_string.h"
/* $Id$ */

View file

@ -1,3 +1,5 @@
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <setjmp.h>

View file

@ -1,4 +1,4 @@
pmfile
build.mk
basic.g
basic.lex
bem.c

View file

@ -237,7 +237,7 @@ File *stream;
extern char *strchr();
getline()
getinputline()
{
/* get next input line */

44
lang/basic/src/build.mk Normal file
View file

@ -0,0 +1,44 @@
D := lang/basic/src
define build-bem-impl
$(call reset)
$(eval cflags += -I$(OBJDIR)/$D -I$D)
$(call cfile, $D/bem.c)
$(call cfile, $D/symbols.c)
$(call cfile, $D/initialize.c)
$(call cfile, $D/compile.c)
$(call cfile, $D/parsepar.c)
$(call cfile, $D/gencode.c)
$(call cfile, $D/util.c)
$(call cfile, $D/graph.c)
$(call cfile, $D/eval.c)
$(call cfile, $D/func.c)
$(call llgen, $(OBJDIR)/$D, $D/basic.g)
$(eval g := $(OBJDIR)/$D/tokentab.h)
$(eval $q: $g)
$(eval CLEANABLES += $g)
$g: $D/maketokentab $(OBJDIR)/$D/Lpars.h
@echo TOKENTAB $$@
@mkdir -p $$(dir $$@)
$(hide) cd $(OBJDIR)/$D && $(abspath $$^)
$(eval $q: $(OBJDIR)/$D/Lpars.h)
$(eval $q: $(INCDIR)/print.h)
$(call file, $(LIBEM_MES))
$(call file, $(LIBEMK))
$(call file, $(LIBEM_DATA))
$(call file, $(LIBALLOC))
$(call file, $(LIBPRINT))
$(call file, $(LIBSTRING))
$(call file, $(LIBSYSTEM))
$(call cprogram, $(BINDIR)/em_bem)
$(call installto, $(PLATDEP)/em_bem)
endef
$(eval $(build-bem-impl))

View file

@ -23,7 +23,7 @@ compileprogram()
prolog2(); /* Some statements are moved from prolog2 to
epilogcode in the new version of the compiler */
while( basicline = 0, getline())
while( basicline = 0, getinputline())
(void) LLparse();
epilogcode();
sys_close(yyin);

View file

@ -644,7 +644,7 @@ prolog2()
C_loi((arith) BEMPTRSIZE);
C_exa_dnam("trpbuf");
C_lae_dnam("trpbuf",(arith)0);
C_cal("setjmp");
C_cal("__setjmp");
C_df_ilb(l);
C_asp((arith)(BEMPTRSIZE+BEMPTRSIZE));
C_lfr((arith)BEMINTSIZE);

View file

@ -1,4 +1,4 @@
pmfile
build.mk
cemcom.ansi
cpp.ansi
libcc.ansi

6
lang/cem/build.mk Normal file
View file

@ -0,0 +1,6 @@
include lang/cem/cpp.ansi/build.mk
include lang/cem/cemcom.ansi/build.mk
include lang/cem/libcc.ansi/build.mk
$(eval CCOMPILER := $(CPPANSI) $(CEMCOMANSI) $(LIBCCANSIHEADERS))

View file

@ -1,4 +1,4 @@
pmfile
build.mk
LLlex.c
LLlex.h
LLmessage.c

View file

@ -5,13 +5,8 @@
/* $Id$ */
/* L E X I C A L A N A L Y Z E R */
#include "debug.h"
#include "lint.h"
#include <alloc.h>
#include "idfsize.h"
#include "numsize.h"
#include "strsize.h"
#include "nopp.h"
#include "parameters.h"
#include "input.h"
#include "arith.h"
#include "def.h"

View file

@ -11,7 +11,6 @@
*/
#include "file_info.h"
#include "nopp.h"
/* the structure of a token: */
struct token {

View file

@ -6,7 +6,6 @@
/* PARSER ERROR ADMINISTRATION */
#include <alloc.h>
#include "idf.h"
#include "arith.h"
#include "LLlex.h"
#include "Lpars.h"

View file

@ -5,8 +5,7 @@
/* $Id$ */
/* A L I G N M E N T D E F I N I T I O N S */
#include "nocross.h"
#include "trgt_sizes.h"
#include "parameters.h"
#ifndef NOCROSS
extern int

View file

@ -11,11 +11,8 @@
semantics of C is a mess.
*/
#include "parameters.h"
#include <alloc.h>
#include "debug.h"
#include "lint.h"
#include "nobitfield.h"
#include "idf.h"
#include <flt_arith.h>
#include "arith.h"
#include "sizes.h"

View file

@ -13,7 +13,7 @@
be handy.
*/
#include "spec_arith.h"
#include "parameters.h"
#ifndef SPECIAL_ARITHMETICS

View file

@ -1,5 +1,6 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
@ -10,7 +11,8 @@
there is no reasonable method to prove that a program is 100%
correct, these assertions are needed in some places.
*/
#include "debug.h" /* UF */
#include "parameters.h"
#ifdef DEBUG
/* Note: this macro uses parameter substitution inside strings */

View file

@ -5,7 +5,7 @@
/* $Id$ */
/* B L O C K S T O R I N G A N D L O A D I N G */
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>

View file

@ -0,0 +1,156 @@
D := lang/cem/cemcom.ansi
define build-cemcom-ansi-allocd-header
$(eval g := $(OBJDIR)/$D/$(strip $1).h)
$g: $D/$(strip $1).str $D/make.allocd
@echo ALLOCD $$@
@mkdir -p $$(dir $$@)
$(hide) $D/make.allocd < $$^ > $$@
$(eval CLEANABLES += $g)
$(eval $q: $g)
endef
define build-cemcom-ansi-next
$(eval CLEANABLES += $(OBJDIR)/$D/next.c)
$(OBJDIR)/$D/next.c: $D/make.next $1
@echo NEXT $$@
@mkdir -p $$(dir $$@)
$(hide) $$^ > $$@
$(call cfile, $(OBJDIR)/$D/next.c)
$(foreach f, $1, $(call build-cemcom-ansi-allocd-header, \
$(basename $(notdir $f))))
endef
define build-cemcom-ansi-impl
$(call reset)
$(eval cflags += -I$(OBJDIR)/$D -I$D)
$(call cfile, $D/arith.c)
$(call dependson, $(INCDIR)/flt_arith.h)
$(call cfile, $D/blocks.c)
$(call dependson, $(INCDIR)/em_codeEK.h)
$(call cfile, $D/LLlex.c)
$(call cfile, $D/LLmessage.c)
$(call cfile, $D/ch3.c)
$(call cfile, $D/ch3bin.c)
$(call cfile, $D/ch3mon.c)
$(call cfile, $D/code.c)
$(call cfile, $D/conversion.c)
$(call cfile, $D/cstoper.c)
$(call cfile, $D/dataflow.c)
$(call cfile, $D/declarator.c)
$(call cfile, $D/decspecs.c)
$(call cfile, $D/domacro.c)
$(call cfile, $D/dumpidf.c)
$(call cfile, $D/error.c)
$(call cfile, $D/eval.c)
$(call cfile, $D/expr.c)
$(call cfile, $D/field.c)
$(call cfile, $D/fltcstoper.c)
$(call cfile, $D/idf.c)
$(call cfile, $D/init.c)
$(call cfile, $D/input.c)
$(call cfile, $D/l_comment.c)
$(call cfile, $D/l_ev_ord.c)
$(call cfile, $D/l_lint.c)
$(call cfile, $D/l_misc.c)
$(call cfile, $D/l_outdef.c)
$(call cfile, $D/l_states.c)
$(call cfile, $D/label.c)
$(call cfile, $D/main.c)
$(call cfile, $D/options.c)
$(call cfile, $D/pragma.c)
$(call cfile, $D/proto.c)
$(call cfile, $D/replace.c)
$(call cfile, $D/skip.c)
$(call cfile, $D/stab.c)
$(call cfile, $D/stack.c)
$(call cfile, $D/struct.c)
$(call cfile, $D/switch.c)
$(call cfile, $D/tokenname.c)
$(call cfile, $D/type.c)
$(call cfile, $D/util.c)
$(call llgen, $(OBJDIR)/$D, \
$(OBJDIR)/$D/tokenfile.g \
$D/program.g \
$D/declar.g \
$D/expression.g \
$D/statement.g \
$D/ival.g)
$(eval CLEANABLES += $(OBJDIR)/$D/tokenfile.g)
$(OBJDIR)/$D/tokenfile.g: $D/make.tokfile $D/tokenname.c
@echo TOKENFILE $$@
@mkdir -p $$(dir $$@)
$(hide) sh $D/make.tokfile < $D/tokenname.c > $$@
$(call tabgen, $D/char.tab)
$(eval $q: $(OBJDIR)/$D/parameters.h)
$(eval CLEANABLES += $(OBJDIR)/$D/parameters.h)
$(OBJDIR)/$D/parameters.h: $D/BigPars
@echo PARAMETERS $$@
@mkdir -p $$(dir $$@)
$(hide) echo '#ifndef PARAMETERS_H' > $$@
$(hide) echo '#define PARAMETERS_H' >> $$@
$(hide) grep -v '^!' < $D/BigPars >> $$@
$(hide) echo '#endif' >> $$@
$(eval CLEANABLES += $(OBJDIR)/$D/symbol2str.c)
$(OBJDIR)/$D/symbol2str.c: $D/make.tokcase $D/tokenname.c
@echo TOKCASE $$@
@mkdir -p $$(dir $$@)
$(hide) $D/make.tokcase < $D/tokenname.c > $$@
$(call cfile, $(OBJDIR)/$D/symbol2str.c)
$(call build-cemcom-ansi-next, \
$D/code.str \
$D/declar.str \
$D/def.str \
$D/expr.str \
$D/field.str \
$D/estack.str \
$D/util.str \
$D/proto.str \
$D/replace.str \
$D/idf.str \
$D/macro.str \
$D/stack.str \
$D/stmt.str \
$D/struct.str \
$D/switch.str \
$D/type.str \
$D/l_brace.str \
$D/l_state.str \
$D/l_outdef.str)
$(eval $q: $(OBJDIR)/$D/Lpars.h)
$(call file, $(LIBEM_MES))
$(call file, $(LIBEMK))
$(call file, $(LIBEM_DATA))
$(call file, $(LIBINPUT))
$(call file, $(LIBASSERT))
$(call file, $(LIBALLOC))
$(call file, $(LIBFLT_ARITH))
$(call file, $(LIBPRINT))
$(call file, $(LIBSYSTEM))
$(call file, $(LIBSTRING))
$(call cprogram, $(BINDIR)/cemcom.ansi)
$(call installto, $(PLATDEP)/em_cemcom.ansi)
$(eval CEMCOMANSI := $o)
$(call reset)
$(eval q := $D/cemcom.ansi.1)
$(call installto, $(INSDIR)/share/man/man1/cemcom.6)
endef
$(eval $(build-cemcom-ansi-impl))

View file

@ -5,12 +5,10 @@
/* $Id$ */
/* S E M A N T I C A N A L Y S I S -- C H A P T E R 3.3 */
#include "debug.h"
#include "lint.h"
#include "nobitfield.h"
#include "idf.h"
#include "parameters.h"
#include <flt_arith.h>
#include "arith.h"
#include "idf.h"
#include "proto.h"
#include "type.h"
#include "struct.h"

View file

@ -5,11 +5,8 @@
/* $Id$ */
/* SEMANTIC ANALYSIS (CHAPTER 3.3) -- BINARY OPERATORS */
#include "botch_free.h"
#include "debug.h"
#include "parameters.h"
#include <alloc.h>
#include "lint.h"
#include "idf.h"
#include <flt_arith.h>
#include "arith.h"
#include "type.h"

View file

@ -5,17 +5,15 @@
/* $Id$ */
/* SEMANTIC ANALYSIS (CHAPTER 3.3) -- MONADIC OPERATORS */
#include "botch_free.h"
#include "debug.h"
#include "parameters.h"
#include <alloc.h>
#include "nobitfield.h"
#include "Lpars.h"
#include <flt_arith.h>
#include "idf.h"
#include "arith.h"
#include "type.h"
#include "label.h"
#include "expr.h"
#include "idf.h"
#include "def.h"
#include "sizes.h"

View file

@ -7,23 +7,18 @@
#include <stdlib.h>
#include <string.h>
#include "lint.h"
#include "debug.h"
#include "dbsymtab.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>
#else
#include "l_em.h"
#include "l_lint.h"
#endif /* LINT */
#include "botch_free.h"
#include <alloc.h>
#include "dataflow.h"
#include "use_tmp.h"
#include <flt_arith.h>
#include "idf.h"
#include "arith.h"
#include "type.h"
#include "idf.h"
#include "label.h"
#include "code.h"
#include "stmt.h"

View file

@ -5,7 +5,7 @@
/* $Id$ */
/* C O N V E R S I O N - C O D E G E N E R A T O R */
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>

View file

@ -5,8 +5,7 @@
/* $Id$ */
/* C O N S T A N T E X P R E S S I O N H A N D L I N G */
#include "trgt_sizes.h"
#include "idf.h"
#include "parameters.h"
#include <flt_arith.h>
#include "arith.h"
#include "type.h"

View file

@ -9,7 +9,7 @@
Use the compiler option --d.
*/
#include "dataflow.h" /* UF */
#include "parameters.h" /* UF */
#ifdef DATAFLOW
char *CurrentFunction = 0;

View file

@ -6,17 +6,14 @@
/* DECLARATION SYNTAX PARSER */
{
#include "lint.h"
#include "dbsymtab.h"
#include "parameters.h"
#include <alloc.h>
#include "nobitfield.h"
#include "debug.h"
#include <flt_arith.h>
#include "idf.h"
#include "arith.h"
#include "LLlex.h"
#include "label.h"
#include "code.h"
#include "idf.h"
#include "type.h"
#include "proto.h"
#include "struct.h"

View file

@ -5,8 +5,7 @@
/* $Id$ */
/* D E C L A R A T O R M A N I P U L A T I O N */
#include "debug.h"
#include "botch_free.h"
#include "parameters.h"
#include <alloc.h>
#include <flt_arith.h>
#include "arith.h"
@ -15,7 +14,6 @@
#include "Lpars.h"
#include "declar.h"
#include "def.h"
#include "idf.h"
#include "label.h"
#include "expr.h"
#include "sizes.h"

View file

@ -5,7 +5,7 @@
/* $Id$ */
/* IDENTIFIER DEFINITION DESCRIPTOR */
#include "lint.h"
#include "parameters.h"
struct def { /* for ordinary tags */
struct def *next;

View file

@ -5,29 +5,20 @@
/* $Id$ */
/* PREPROCESSOR: CONTROLLINE INTERPRETER */
#include "debug.h"
#include <stdlib.h>
#include "parameters.h"
#include "idf.h"
#include "arith.h"
#include "LLlex.h"
#include "Lpars.h"
#include "idf.h"
#include "input.h"
#include "nopp.h"
#include "lint.h"
#include "replace.h"
#ifndef NOPP
#include "ifdepth.h"
#include "botch_free.h"
#include "nparams.h"
#include "parbufsize.h"
#include "textsize.h"
#include "idfsize.h"
#include "assert.h"
#include <alloc.h>
#include "class.h"
#include "macro.h"
#include "macbuf.h"
#include "replace.h"
#include "dbsymtab.h"
#ifdef DBSYMTAB
#include <stb.h>
#include <em.h>

View file

@ -5,16 +5,13 @@
/* $Id$ */
/* DUMP ROUTINES */
#include "debug.h"
#ifdef DEBUG
#include "parameters.h"
#include <alloc.h>
#include "nopp.h"
#include "nobitfield.h"
#include <flt_arith.h>
#include "arith.h"
#include "stack.h"
#include "idf.h"
#include "def.h"
#include "type.h"
#include "proto.h"

View file

@ -5,7 +5,7 @@
/* $Id$ */
/* E R R O R A N D D I A G N O S T I C R O U T I N E S */
#include "lint.h"
#include "parameters.h"
#if __STDC__
#include <stdarg.h>
#else
@ -18,11 +18,6 @@
#include "l_em.h"
#endif /* LINT */
#include "debug.h"
#include "lint.h"
#include "nopp.h"
#include "errout.h"
#include "tokenname.h"
#include <flt_arith.h>
#include "arith.h"

View file

@ -5,19 +5,16 @@
/* $Id$ */
/* EXPRESSION-CODE GENERATOR */
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>
#include <em_reg.h>
#include <alloc.h>
#include "debug.h"
#include "nobitfield.h"
#include "dataflow.h"
#include <flt_arith.h>
#include "idf.h"
#include "arith.h"
#include "type.h"
#include "idf.h"
#include "label.h"
#include "code.h"
#include "assert.h"
@ -41,7 +38,7 @@ arith NewLocal(); /* util.c */
extern int err_occurred; /* error.c */
/* EVAL() is the main expression-tree evaluator, which turns
any legal expression tree into EM code. Parameters:
any legal expression tree into EM code. parameters.h:
struct expr *expr
pointer to root of the expression tree to be evaluated

View file

@ -5,13 +5,12 @@
/* $Id$ */
/* EXPRESSION TREE HANDLING */
#include "lint.h"
#include "debug.h"
#include <stdlib.h>
#include "parameters.h"
#include "assert.h"
#include "botch_free.h"
#include <alloc.h>
#include "idf.h"
#include <flt_arith.h>
#include "idf.h"
#include "arith.h"
#include "def.h"
#include "type.h"
@ -23,7 +22,6 @@
#include "declar.h"
#include "sizes.h"
#include "level.h"
#include "use_tmp.h"
extern char *symbol2str();
extern char options[];

View file

@ -7,13 +7,11 @@
{
#include <alloc.h>
#include "lint.h"
#include "debug.h"
#include "parameters.h"
#include <flt_arith.h>
#include "arith.h"
#include "LLlex.h"
#include "type.h"
#include "idf.h"
#include "label.h"
#include "expr.h"
#include "code.h"

View file

@ -5,19 +5,16 @@
/* $Id$ */
/* BITFIELD EXPRESSION EVALUATOR */
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include "nobitfield.h"
#ifndef NOBITFIELD
#include <em.h>
#include <em_reg.h>
#include "debug.h"
#include <flt_arith.h>
#include "arith.h"
#include "type.h"
#include "idf.h"
#include "label.h"
#include "code.h"
#include "assert.h"

View file

@ -6,11 +6,9 @@
/* C O N S T A N T E X P R E S S I O N H A N D L I N G */
/* F O R F L O A T I N G P O I N T N U M B E R S */
#include "debug.h"
#include "parameters.h"
#include "assert.h"
#include <alloc.h>
#include "trgt_sizes.h"
#include "idf.h"
#include <flt_arith.h>
#include "arith.h"
#include "type.h"

View file

@ -7,20 +7,15 @@
#include <stdlib.h>
#include <string.h>
#include "lint.h"
#include "parameters.h"
#include <em_reg.h>
#include "debug.h"
#include "idfsize.h"
#include "botch_free.h"
#include "nopp.h"
#include "nparams.h"
#include <alloc.h>
#include "idf.h"
#include "arith.h"
#include "align.h"
#include "LLlex.h"
#include "level.h"
#include "stack.h"
#include "idf.h"
#include "label.h"
#include "def.h"
#include "type.h"

View file

@ -5,7 +5,7 @@
/* $Id$ */
/* IDENTIFIER DESCRIPTOR */
#include "nopp.h"
#include "parameters.h"
struct id_u {
#ifndef NOPP

View file

@ -7,15 +7,15 @@
#include <stdlib.h>
#include <string.h>
#include "nopp.h"
#include "parameters.h"
#ifndef NOPP
#include <system.h>
#include <alloc.h>
#include <time.h>
#include "idf.h"
#include "class.h"
#include "macro.h"
#include "idf.h"
extern char *sprint();

View file

@ -4,10 +4,10 @@
*/
/* $Id$ */
#include "parameters.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "inputtype.h"
#include "file_info.h"
#include "input.h"
@ -15,12 +15,9 @@
#define INP_TYPE struct file_info
#define INP_VAR finfo
struct file_info finfo;
#include "nopp.h"
#include <inp_pkg.body>
#include <alloc.h>
#include "dbsymtab.h"
#include "lint.h"
#ifndef NOPP
#ifdef DBSYMTAB
#include <stb.h>

View file

@ -6,18 +6,18 @@
/* CODE FOR THE INITIALISATION OF GLOBAL VARIABLES */
{
#include "lint.h"
#include <stdlib.h>
#include "parameters.h"
#ifndef LINT
#include <em.h>
#else
#include "l_em.h"
#include "l_lint.h"
#endif /* LINT */
#include "debug.h"
#include <alloc.h>
#include <assert.h>
#include "nobitfield.h"
#include <flt_arith.h>
#include "idf.h"
#include "arith.h"
#include "label.h"
#include "expr.h"
@ -29,11 +29,11 @@
#include "Lpars.h"
#include "sizes.h"
#include "align.h"
#include "idf.h"
#include "level.h"
#include "def.h"
#include "LLlex.h"
#include "estack.h"
#include "stack.h"
#define con_nullbyte() C_con_ucon("0", (arith)1)
#define aggregate_type(tp) ((tp)->tp_fund == ARRAY || (tp)->tp_fund == STRUCT)

View file

@ -5,10 +5,9 @@
/* $Id$ */
/* Lint-specific comment handling */
#include "parameters.h"
#include <ctype.h>
#include "lint.h"
#ifdef LINT
#include <alloc.h>

View file

@ -5,7 +5,7 @@
/* $Id$ */
/* Lint evaluation order checking */
#include "lint.h"
#include "parameters.h"
#ifdef LINT
@ -18,7 +18,6 @@
#include "arith.h" /* definition arith */
#include "label.h" /* definition label */
#include "expr.h"
#include "idf.h"
#include "def.h"
#include "code.h" /* RVAL etc */
#include "LLlex.h"

View file

@ -5,12 +5,11 @@
/* $Id$ */
/* Lint main routines */
#include "lint.h"
#include "parameters.h"
#ifdef LINT
#include <alloc.h> /* for st_free */
#include "debug.h"
#include "interface.h"
#include "assert.h"
#ifdef ANSI
@ -19,7 +18,6 @@
#include "arith.h" /* definition arith */
#include "label.h" /* definition label */
#include "expr.h"
#include "idf.h"
#include "def.h"
#include "code.h" /* RVAL etc */
#include "LLlex.h"

View file

@ -5,7 +5,7 @@
/* $Id$ */
/* Lint miscellaneous routines */
#include "lint.h"
#include "parameters.h"
#ifdef LINT
@ -17,7 +17,6 @@
#include "arith.h" /* definition arith */
#include "label.h" /* definition label */
#include "expr.h"
#include "idf.h"
#include "def.h"
#include "code.h" /* RVAL etc */
#include "LLlex.h"

View file

@ -5,7 +5,7 @@
/* $Id$ */
/* Lint outdef construction */
#include "lint.h"
#include "parameters.h"
#ifdef LINT
@ -26,7 +26,6 @@
#include "def.h"
#include "struct.h"
#include "field.h"
#include "idf.h"
#include "level.h"
#include "label.h"
#include "code.h"

View file

@ -5,21 +5,19 @@
/* $Id$ */
/* Lint status checking */
#include "lint.h"
#include "parameters.h"
#ifdef LINT
#include <alloc.h> /* for st_free */
#include "interface.h"
#include "assert.h"
#include "debug.h"
#ifdef ANSI
#include <flt_arith.h>
#endif /* ANSI */
#include "arith.h"
#include "label.h"
#include "expr.h"
#include "idf.h"
#include "def.h"
#include "code.h" /* RVAL etc */
#include "LLlex.h"

View file

@ -5,9 +5,10 @@
/* $Id$ */
/* L A B E L H A N D L I N G */
#include "parameters.h"
#include "idf.h"
#include "Lpars.h"
#include "level.h"
#include "idf.h"
#include "label.h"
#include "arith.h"
#include "def.h"

View file

@ -5,7 +5,7 @@
/* $Id$ */
/* PREPROCESSOR: DEFINITION OF MACRO DESCRIPTOR */
#include "nopp.h"
#include "parameters.h"
#ifndef NOPP
/* The flags of the mc_flag field of the macro structure. Note that

View file

@ -5,16 +5,11 @@
/* $Id$ */
/* MAIN PROGRAM */
#include "lint.h"
#include "parameters.h"
#include <system.h>
#include "debug.h"
#include "nopp.h"
#include "trgt_sizes.h"
#include "use_tmp.h"
#include "inputtype.h"
#include "idf.h"
#include "input.h"
#include "level.h"
#include "idf.h"
#include "arith.h"
#include "type.h"
#include "proto.h"
@ -24,7 +19,6 @@
#include "LLlex.h"
#include <alloc.h>
#include "specials.h"
#include "nocross.h"
#include "sizes.h"
#include "align.h"
#include "macro.h"

View file

@ -1,6 +1,6 @@
#!/bin/sh
echo '#include "debug.h"'
echo '#include "parameters.h"'
sed -n '
s:^.*ALLOCDEF.*"\(.*\)".*$:struct \1 *h_\1 = 0;\
#ifdef DEBUG\

View file

@ -5,23 +5,15 @@
/* $Id$ */
/* U S E R O P T I O N - H A N D L I N G */
#include "parameters.h"
#include <stdlib.h>
#include <string.h>
#include "lint.h"
#include "botch_free.h"
#include <alloc.h>
#include "nopp.h"
#include "idfsize.h"
#include "nobitfield.h"
#include "class.h"
#include "macro.h"
#include "idf.h"
#include "arith.h"
#include "sizes.h"
#include "align.h"
#include "use_tmp.h"
#include "dataflow.h"
#include "dbsymtab.h"
#ifndef NOPP
extern char **inctable;

View file

@ -5,8 +5,7 @@
/* $Id$ */
/* PREPROCESSOR: PRAGMA INTERPRETER */
#include "debug.h"
#include "idf.h"
#include "parameters.h"
#define P_UNKNOWN 0
#define NR_PRAGMAS 0

View file

@ -45,13 +45,10 @@
%start If_expr, control_if_expression;
{
#include "lint.h"
#include "nopp.h"
#include "debug.h"
#include "parameters.h"
#include <flt_arith.h>
#include "arith.h"
#include "LLlex.h"
#include "idf.h"
#include "label.h"
#include "type.h"
#include "declar.h"
@ -59,6 +56,7 @@
#include "code.h"
#include "expr.h"
#include "def.h"
#include "stack.h"
#ifdef LINT
#include "l_lint.h"
#endif /* LINT */

View file

@ -5,19 +5,15 @@
/* $Id$ */
/* P R O T O T Y P E F I D D L I N G */
#include "lint.h"
#include "debug.h"
#include "idfsize.h"
#include "nparams.h"
#include "botch_free.h"
#include "parameters.h"
#include <alloc.h>
#include "idf.h"
#include "Lpars.h"
#include "level.h"
#include <flt_arith.h>
#include "arith.h"
#include "align.h"
#include "stack.h"
#include "idf.h"
#include "def.h"
#include "type.h"
#include "struct.h"

View file

@ -7,26 +7,18 @@
#include <stdlib.h>
#include <string.h>
#include "nopp.h"
#include "parameters.h"
#ifndef NOPP
#include "debug.h"
#include "pathlength.h"
#include "strsize.h"
#include "nparams.h"
#include "idfsize.h"
#include "numsize.h"
#include <alloc.h>
#include "idf.h"
#include "idf.h"
#include "input.h"
#include "macro.h"
#include "arith.h"
#include "LLlex.h"
#include "class.h"
#include "assert.h"
#include "static.h"
#include "macbuf.h"
#include "replace.h"
extern struct idf *GetIdentifier();

View file

@ -5,8 +5,7 @@
/* $Id$ */
/* VARIOUS TARGET MACHINE SIZE DESCRIPTORS */
#include "nocross.h"
#include "trgt_sizes.h"
#include "parameters.h"
#ifndef NOCROSS
extern arith

View file

@ -5,7 +5,7 @@
/* $Id$ */
/* PREPROCESSOR: INPUT SKIP FUNCTIONS */
#include "nopp.h"
#include "parameters.h"
#include "arith.h"
#include "LLlex.h"
#include "class.h"

View file

@ -9,7 +9,7 @@
/* $Id$ */
#include "dbsymtab.h"
#include "parameters.h"
#ifdef DBSYMTAB
@ -20,13 +20,13 @@
#include <flt_arith.h>
#include <stb.h>
#include "idf.h"
#include "LLlex.h"
#include "stack.h"
#include "def.h"
#include "type.h"
#include "struct.h"
#include "field.h"
#include "idf.h"
#include "Lpars.h"
#include "level.h"

View file

@ -5,21 +5,19 @@
/* $Id$ */
/* S T A C K / U N S T A C K R O U T I N E S */
#include "lint.h"
#include "parameters.h"
#include <system.h>
#ifndef LINT
#include <em.h>
#else
#include "l_em.h"
#endif /* LINT */
#include "debug.h"
#include "botch_free.h"
#include <alloc.h>
#include "idf.h"
#include "Lpars.h"
#include "arith.h"
#include "stack.h"
#include "type.h"
#include "idf.h"
#include "def.h"
#include "struct.h"
#include "level.h"

View file

@ -6,7 +6,7 @@
/* STATEMENT SYNTAX PARSER */
{
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>
#else
@ -14,15 +14,11 @@
#include "l_lint.h"
#endif /* LINT */
#include "debug.h"
#include "botch_free.h"
#include "dbsymtab.h"
#include <flt_arith.h>
#include "idf.h"
#include "arith.h"
#include "LLlex.h"
#include "type.h"
#include "idf.h"
#include "label.h"
#include "expr.h"
#include "code.h"

View file

@ -5,13 +5,11 @@
/* $Id$ */
/* ADMINISTRATION OF STRUCT AND UNION DECLARATIONS */
#include "nobitfield.h"
#include "debug.h"
#include "botch_free.h"
#include "parameters.h"
#include <alloc.h>
#include "idf.h"
#include "arith.h"
#include "stack.h"
#include "idf.h"
#include "def.h"
#include "type.h"
#include "proto.h"

View file

@ -5,18 +5,14 @@
/* $Id$ */
/* S W I T C H - S T A T E M E N T A D M I N I S T R A T I O N */
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>
#else
#include "l_em.h"
#endif /* LINT */
#include "debug.h"
#include "botch_free.h"
#include <alloc.h>
#include "density.h"
#include "Lpars.h"
#include "idf.h"
#include "label.h"
#include <flt_arith.h>
#include "arith.h"

View file

@ -5,7 +5,8 @@
/* $Id$ */
/* TOKEN NAME DEFINITIONS */
#include "idf.h"
#include "parameters.h"
#include "idf.h"
#include "arith.h"
#include "LLlex.h"
#include "tokenname.h"

View file

@ -5,14 +5,12 @@
/* $Id$ */
/* T Y P E D E F I N I T I O N M E C H A N I S M */
#include "nobitfield.h"
#include "debug.h"
#include "botch_free.h"
#include "parameters.h"
#include <alloc.h>
#include "idf.h"
#include "Lpars.h"
#include "arith.h"
#include "type.h"
#include "idf.h"
#include "def.h"
#include "proto.h"
#include "sizes.h"

View file

@ -5,8 +5,7 @@
/* $Id$ */
/* TYPE DESCRIPTOR */
#include "nobitfield.h"
#include "dbsymtab.h"
#include "parameters.h"
struct type {
struct type *next; /* used for ARRAY and for qualifiers */

View file

@ -11,7 +11,7 @@
allowing re-use.
*/
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>
#else
@ -22,10 +22,7 @@
#include <alloc.h>
#include <em_mes.h>
#include "debug.h"
#include "util.h"
#include "use_tmp.h"
#include "regcount.h"
#include "sizes.h"
#include "align.h"
#include "stack.h"

View file

@ -1,4 +1,4 @@
pmfile
build.mk
LLlex.c
LLlex.h
LLmessage.c

View file

@ -39,7 +39,7 @@ arith NewLocal(); /* util.c */
#define LocalPtrVar() NewLocal(pointer_size, pointer_align, reg_pointer, REGISTER)
/* EVAL() is the main expression-tree evaluator, which turns
any legal expression tree into EM code. Parameters:
any legal expression tree into EM code. parameters.h:
struct expr *expr
pointer to root of the expression tree to be evaluated

View file

@ -70,7 +70,7 @@ replace(idef)
return 0;
}
if (++mac->mc_count > 100) {
/* 100 must be some number in Parameters */
/* 100 must be some number in parameters.h */
lexwarning("macro %s is assumed recursive",
idef->id_text);
return 0;

View file

@ -1,8 +1,8 @@
pmfile
build.mk
LLlex.c
LLlex.h
LLmessage.c
Parameters
parameters.h
arith.h
bits.h
ch3bin.c
@ -22,7 +22,6 @@ input.h
macro.str
main.c
make.allocd
make.hfiles
make.next
make.tokcase
make.tokfile

View file

@ -5,9 +5,7 @@
/* $Id$ */
/* L E X I C A L A N A L Y Z E R */
#include "idfsize.h"
#include "numsize.h"
#include "strsize.h"
#include "parameters.h"
#include <alloc.h>
#include "input.h"

View file

@ -3,7 +3,7 @@
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
#include "dobits.h"
#include "parameters.h"
#ifdef DOBITS
#define bit0 0x01
#define bit1 0x02

104
lang/cem/cpp.ansi/build.mk Normal file
View file

@ -0,0 +1,104 @@
D := lang/cem/cpp.ansi
define build-cpp-ansi-allocd-header
$1: $2 $D/make.allocd
@echo ALLOCD $1
@mkdir -p $(dir $1)
$(hide) $D/make.allocd < $2 > $1
$(eval CLEANABLES += $1)
endef
define build-cpp-ansi-tokfile
$(OBJDIR)/$D/tokenfile.g: $D/make.tokfile $D/tokenname.c
@echo TOKENFILE $$@
@mkdir -p $$(dir $$@)
$(hide) sh $D/make.tokfile < $D/tokenname.c > $$@
$(eval CLEANABLES += $(OBJDIR)/$D/tokenfile.g)
endef
define build-cpp-ansi-tokcase
$(OBJDIR)/$D/symbol2str.c: $D/make.tokcase $D/tokenname.c
@echo TOKCASE $$@
@mkdir -p $$(dir $$@)
$(hide) sh $D/make.tokcase < $D/tokenname.c > $$@
$(eval CLEANABLES += $(OBJDIR)/$D/symbol2str.c)
endef
define build-cpp-ansi-next
$(OBJDIR)/$D/next.c: $D/make.next $D/macro.str $D/replace.str
@echo NEXT $$@
@mkdir -p $$(dir $$@)
$(hide) sh $D/make.next $D/macro.str $D/replace.str > $$@
$(eval CLEANABLES += $(OBJDIR)/$D/next.c)
endef
define build-cpp-ansi-impl
$(eval $(call build-cpp-ansi-next))
$(eval $(call build-cpp-ansi-tokcase))
$(eval $(call build-cpp-ansi-tokfile))
$(eval $(call build-cpp-ansi-allocd-header, \
$(OBJDIR)/$D/macro.h, $D/macro.str \
))
$(eval $(call build-cpp-ansi-allocd-header, \
$(OBJDIR)/$D/replace.h, $D/replace.str \
))
$(call reset)
$(eval cflags += -I$(OBJDIR)/$D -I$D)
$(call cfile, $D/LLlex.c)
$(call cfile, $D/LLmessage.c)
$(call cfile, $D/ch3bin.c)
$(call cfile, $D/ch3mon.c)
$(call cfile, $D/domacro.c)
$(call cfile, $D/error.c)
$(call cfile, $D/idf.c)
$(call cfile, $D/init.c)
$(call cfile, $D/input.c)
$(call cfile, $D/main.c)
$(call cfile, $D/options.c)
$(call cfile, $D/preprocess.c)
$(call cfile, $D/replace.c)
$(call cfile, $D/skip.c)
$(call cfile, $D/tokenname.c)
$(call cfile, $D/expr.c)
$(call cfile, $(OBJDIR)/$D/symbol2str.c)
$(call cfile, $(OBJDIR)/$D/next.c)
$(call llgen, $(OBJDIR)/$D, $(OBJDIR)/$D/tokenfile.g $D/expression.g)
$(call file, $(LIBINPUT))
$(call file, $(LIBASSERT))
$(call file, $(LIBALLOC))
$(call file, $(LIBPRINT))
$(call file, $(LIBSYSTEM))
$(call file, $(LIBSTRING))
$(call tabgen, $D/char.tab)
$(eval $q: \
$(OBJDIR)/$D/macro.h \
$(OBJDIR)/$D/Lpars.h \
$(INCDIR)/alloc.h \
$(INCDIR)/inp_pkg.spec \
$(INCDIR)/idf_pkg.spec \
$(OBJDIR)/$D/replace.h \
$(INCDIR)/system.h \
$(INCDIR)/inp_pkg.body \
$(INCDIR)/inp_pkg.spec \
$(INCDIR)/idf_pkg.body)
$(call cprogram, $(BINDIR)/cpp.ansi)
$(call installto, $(PLATDEP)/cpp.ansi)
$(eval CPPANSI := $o)
$(call reset)
$(eval q := $D/ncpp.6)
$(call installto, $(INSDIR)/share/man/man6/cpp.ansi.6)
endef
$(eval $(build-cpp-ansi-impl))

Some files were not shown because too many files have changed in this diff Show more