READ_ME
+COPYING
lib
src
Makefile
--- /dev/null
+Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+All rights reserved.
+
+Permission to use and copy this software and its documentation for research
+and educational use only is hereby granted, provided that the above copyright
+notice and this permission notice appear in all copies. No commercial use of
+any kind is permitted without permission in writing from the copyright owner.
+
+One way of obtaining such a permission is to obtain the Amsterdam Compiler
+Kit. LLgen is part of it. The Amsterdam Compiler Kit is available from
+two companies:
+
+Transmediair Products & Support B.V. Unipress Software
+Melkweg 3 2025 Lincoln Highway
+3721 RG Bilthoven Edison, NJ 08817
+The Netherlands U.S.A.
+tel: +31 30 281820 tel: +1 908 287 2100
+fax: +31 30 292294 fax: +1 908 287 4929
done for switches that have density between
\fIlow_percentage\fP and \fIhigh_percentage\fP, as explained below.
Usually, compilers generate a jumptable when the density of the switch
-is above a certain threshold. If you want jump tables in more cases,
-set \fIhigh_percentage\fP to this threshold, and \fIlow_percentage\fP to
-a minimum threshold. There is a time-space trade-off here.
+is above a certain threshold. When jump tables are to be used more often,
+\fIhigh_percentage\fP must be set to this threshold, and \fIlow_percentage\fP
+must be set to a minimum threshold. There is a time-space trade-off here.
.I num
is the minimum number of cases in a switch for the \fB\-j\fP option to be
effective. The default value (if
# $Header$
-EMHOME=../..
-INSTALLDIR=$(EMHOME)/bin
-LIBDIR=$(EMHOME)/lib/LLgen
-MANDIR=$(EMHOME)/man
+INSTALLDIR=/usr/local/bin
+LIBDIR=/usr/local/lib/LLgen
+MANDIR=/usr/local/man/man1
all:
- cd src; make
+ cd src; make LIBDIR=$(LIBDIR)
clean:
-cd src; make clean
install:
- cd src; make
+ cd src; make LIBDIR=$(LIBDIR)
rm -f $(INSTALLDIR)/LLgen $(LIBDIR)/rec $(LIBDIR)/incl $(MANDIR)/LLgen.1
cp src/LLgen $(INSTALLDIR)/LLgen
cp lib/rec $(LIBDIR)/rec
cp LLgen.1 $(MANDIR)/LLgen.1
firstinstall:
- cd src; make first
+ cd src; make LIBDIR=$(LIBDIR) first
rm -f $(INSTALLDIR)/LLgen $(LIBDIR)/rec $(LIBDIR)/incl $(MANDIR)/LLgen.1
cp src/LLgen $(INSTALLDIR)/LLgen
-mkdir $(LIBDIR)
cp LLgen.1 $(MANDIR)/LLgen.1
cmp:
- cd src; make
+ cd src; make LIBDIR=$(LIBDIR)
-cmp src/LLgen $(INSTALLDIR)/LLgen
-cmp lib/rec $(LIBDIR)/rec
-cmp lib/incl $(LIBDIR)/incl
LIBDIR=$(TARGET_HOME)/lib/LLgen
all:
- cd src; make
+ cd src; make LIBDIR=$(LIBDIR)
clean:
-cd src; make clean
install:
- cd src; make
+ cd src; make LIBDIR=$(LIBDIR)
cp src/LLgen $(INSTALLDIR)/LLgen
if [ $(DO_MACHINE_INDEP) = y ] ; \
then cp $(SRC_HOME)/util/LLgen/lib/rec $(LIBDIR)/rec ; \
fi
firstinstall:
- cd src; make first
+ cd src; make LIBDIR=$(LIBDIR) first
cp src/LLgen $(INSTALLDIR)/LLgen
if [ $(DO_MACHINE_INDEP) = y ] ; \
then if [ -d $(LIBDIR) ] ; then : ; else mkdir $(LIBDIR) ; fi ; \
fi
cmp:
- cd src; make
+ cd src; make LIBDIR=$(LIBDIR)
-cmp src/LLgen $(INSTALLDIR)/LLgen
-cmp $(SRC_HOME)/util/LLgen/lib/rec $(LIBDIR)/rec
-cmp $(SRC_HOME)/util/LLgen/lib/incl $(LIBDIR)/incl
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
# $Header$
-EMHOME=../../..
PROF=
LLOPT= # -vvv -x
-INCLUDES = -I$(EMHOME)/h
-CFLAGS=-O -DNDEBUG $(INCLUDES) $(PROF)
+INCLUDES =
+DEFINES = -DNDEBUG
+CFLAGS=-O $(DEFINES) $(INCLUDES) $(PROF)
LDFLAGS=
OBJECTS = main.o gencode.o compute.o LLgen.o tokens.o check.o reach.o global.o name.o sets.o Lpars.o alloc.o machdep.o cclass.o
CFILES = main.c gencode.c compute.c LLgen.c tokens.c check.c reach.c global.c name.c sets.c Lpars.c alloc.c machdep.c cclass.c
-FILES =types.h tunable.h extern.h io.h sets.h tokens.g LLgen.g main.c name.c compute.c sets.c gencode.c global.c check.c reach.c alloc.c machdep.c Makefile cclass.c
+FILES =types.h extern.h io.h sets.h tokens.g LLgen.g main.c name.c compute.c sets.c gencode.c global.c check.c reach.c alloc.c machdep.c Makefile cclass.c
GFILES = tokens.g LLgen.g
-LINT = lint -b -DNDEBUG -DNORCSID
+LINT = lint -b $(DEFINES) -DNORCSID
+
+LIBDIRSTR = \"$(LIBDIR)\"
all: parser
- @make LLgen "LDFLAGS=$(LDFLAGS)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "PROF=$(PROF)"
+ @make LLgen "LDFLAGS=$(LDFLAGS)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "PROF=$(PROF)" "LIBDIR=$(LIBDIR)"
parser: $(GFILES)
LLgen $(LLOPT) $(GFILES)
@touch parser
first: firstparser
- @make LLgen "LDFLAGS=$(LDFLAGS)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "PROF=$(PROF)"
+ @make LLgen "LDFLAGS=$(LDFLAGS)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "PROF=$(PROF)" "LIBDIR=$(LIBDIR)"
firstparser:
cp LLgen.c.dist LLgen.c
@touch parser
LLgen: $(OBJECTS)
- $(CC) $(PROF) $(LDFLAGS) $(OBJECTS) $(EMHOME)/modules/lib/libsystem.a -o LLgen
+ $(CC) $(PROF) $(LDFLAGS) $(OBJECTS) -o LLgen
@size LLgen
pr :
cp LLgen.c LLgen.c.dist
cp tokens.c tokens.c.dist
+machdep.o: machdep.c
+ $(CC) -c $(CFLAGS) -DLIBDIR=$(LIBDIRSTR) machdep.c
+
# The next lines are generated automatically
# AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO
LLgen.o: Lpars.h
global.o: extern.h
global.o: io.h
global.o: types.h
-machdep.o: $(EMHOME)/h/em_path.h
machdep.o: types.h
main.o: extern.h
main.o: io.h
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
# include "types.h"
# include "extern.h"
-# include <local.h>
# ifndef NORCSID
static string rcsid = "$Header$";
if (p->i_max >= p->i_top) { /* No more free elements */
sz = p->i_size;
-#if BIGMACHINE
- /*
- Do not worry about size. Just double it.
- */
- p->i_size += p->i_size;
- if (! p->i_size)
+ if (sizeof(char *) > 2) {
+ /*
+ Do not worry about size. Just double it.
+ */
+ p->i_size += p->i_size;
+ if (! p->i_size)
+ p->i_size += p->i_incr * p->i_esize;
+ }
+ else {
+ /*
+ Worry about size, so only increment in chunks of i_incr.
+ */
p->i_size += p->i_incr * p->i_esize;
-#else
- /*
- Worry about size, so only increment in chunks of i_incr.
- */
- p->i_size += p->i_incr * p->i_esize;
-#endif
+ }
p->i_ptr = !p->i_ptr ?
alloc(p->i_size) :
ralloc(p->i_ptr, p->i_size);
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
+
+/* $Header$ */
+
#include "cclass.h"
char c_class[] = {
0, /* 00 */
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
+
+/* $Header$ */
+
extern char c_class[];
#define ISLET 1
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
*/
/*
- * extern.h $Header$
+ * $Header$
* Miscellanious constants and
* some variables that are visible in more than one file
*/
-# define LTEXTSZ 51 /* Size of longest token */
+# define LTEXTSZ 256 /* Size of longest token */
/*
* options for the identifier search routine
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
*/
/*
- * io.h $Header$
+ * $Header$
* Some important file names and variables
*/
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
* Machine dependant things
*/
-
-# include <em_path.h>
# include "types.h"
# ifndef NORCSID
UNLINK(x) string x; {
/* Must remove the file "x" */
+#ifdef USE_SYS
sys_remove(x); /* systemcall to remove file */
+#else
+ unlink(x);
+#endif
}
RENAME(x,y) string x,y; {
/* Must move the file "x" to the file "y" */
+#ifdef USE_SYS
if(! sys_rename(x,y)) fatal(1,"Cannot rename to %s",y);
+#else
+ unlink(y);
+ if (link(x,y) != 0) fatal(1,"Cannot rename to %s",y);
+ unlink(x);
+#endif
}
/* to make it easier to patch ... */
-char emdir[64] = EM_DIR;
+char libdir[256] = LIBDIR;
string
libpath(s) string s; {
register length;
p_mem alloc();
string strcpy(), strcat();
- static string subdir = "/lib/LLgen/";
- length = strlen(emdir) + strlen(subdir) + strlen(s) + 1;
+ length = strlen(libdir) + strlen(s) + 2;
p = (string) alloc((unsigned) length);
- strcpy(p,emdir);
- strcat(p,subdir);
+ strcpy(p,libdir);
+ strcat(p,"/");
strcat(p,s);
return p;
}
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
#PARAMS do not remove this line
SRC_DIR = $(SRC_HOME)/util/LLgen/src
-INCLUDES = -I$(TARGET_HOME)/h -I$(TARGET_HOME)/config -I$(SRC_DIR) -I.
-CFLAGS = -DNDEBUG $(INCLUDES) $(COPTIONS)
+LIBDIR = $(TARGET_HOME)/lib/LLgen
+INCLUDES = -I$(SRC_DIR) -I.
+LIBDIRSTR = \"$(LIBDIR)\"
+DEFINES = -DNDEBUG
+CFLAGS = $(DEFINES) $(INCLUDES) $(COPTIONS)
LDFLAGS=$(LDOPTIONS)
LLOPT= # -vvv -x
$(SRC_DIR)/machdep.c $(SRC_DIR)/cclass.c
CFILES = LLgen.c tokens.c Lpars.c $(CSRC)
GFILES = $(SRC_DIR)/tokens.g $(SRC_DIR)/LLgen.g
-FILES = $(SRC_DIR)/types.h $(SRC_DIR)/tunable.h $(SRC_DIR)/extern.h \
+FILES = $(SRC_DIR)/types.h $(SRC_DIR)/extern.h \
$(SRC_DIR)/io.h $(SRC_DIR)/sets.h \
$(GFILES) $(CSRC) $(SRC_DIR)/proto.make
all: parser
- @make LLgen "LDFLAGS=$(LDFLAGS)" "CC=$(CC)" "CFLAGS=$(CFLAGS)"
+ @make LLgen "LDFLAGS=$(LDFLAGS)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "LIBDIR=$(LIBDIR)"
parser: $(GFILES)
LLgen $(LLOPT) $(GFILES)
@touch parser
first: firstparser
- @make LLgen "LDFLAGS=$(LDFLAGS)" "CC=$(CC)" "CFLAGS=$(CFLAGS)"
+ @make LLgen "LDFLAGS=$(LDFLAGS)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "LIBDIR=$(LIBDIR)"
firstparser:
cp $(SRC_DIR)/LLgen.c.dist LLgen.c
global.$(SUF): $(SRC_DIR)/types.h
machdep.$(SUF): $(SRC_DIR)/machdep.c
- $(CC) -c $(CFLAGS) $(SRC_DIR)/machdep.c
+ $(CC) -c $(CFLAGS) -DUSE_SYS -DLIBDIR=$(LIBDIRSTR) $(SRC_DIR)/machdep.c
machdep.$(SUF): $(SRC_DIR)/types.h
main.$(SUF): $(SRC_DIR)/main.c
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
*/
/*
- * sets.h $Header$
+ * $Header$
* Some macros that deal with bitsets and their size
*/
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
+/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
+ * All rights reserved.
*/
/*
*/
/*
- * types.h $Header$
+ * $Header$
* Type and structure definitions
*/