Commit 706d0203 authored by anton's avatar anton

replced tester.fs and coretest.fs with the new versions from John Hayes

make mostlyclean virtualclean added
Cache-flushing now works on the Alpha (other minor changes there)
configure now uses gcc by default and passes its GCC variable to the Makefile
introduced sourcefilename and sourceline# (and used them in many places).
parent 8ebed000
......@@ -12,7 +12,8 @@ siev bubble matrix fib machine and configuration
31.90 35.60 28.30 36.70 i486 66MHz 256K cache; gcc-2.6.3 -DFORCE_REG; gforth-0.1alpha
39.50 45.91 36.73 44.90 i486 50MHz 256K cache; gcc-2.7.0 -DFORCE_REG -DDIRECT_THREADED; gforth-0.1beta
42.82 46.74 38.69 48.30 i486 50MHz 256K cache; gcc-2.7.0 -DFORCE_REG; gforth-0.1beta
9.0 9.6 7.7 9.6 21064A (Alpha) 289MHz 2M cache; gcc-2.7.0; gforth-0.1beta
8.4 8.3 7.2 9.4 21064A (Alpha) 300MHz 2M cache; gcc-2.7.1; gforth-0.1beta
17.3 19.0 14.1 18.3 R4000 100MHz 1M cache; gcc-2.4.5; gforth-0.1beta
50.9 56.8 42.4 52.0 R3000 25MHz 64K+64K cache; gcc-2.5.8 -DFORCE_REG; gforth-0.1beta
63.0 73.3 74.6 65.7 FJMB86903 (SPARC ELC) 33MHz; gcc-2.5.8; gforth-0.1beta
30.0 34.1 20.5 33.0 PA-RISC 1.1 50MHz 64K cache; gcc-2.6.3 -DDIRECT_THREADED; gforth-0.1beta
......@@ -4,14 +4,6 @@ First, type
./configure
or better
CC=gcc ./configure
or however your gcc is called; because configure needs cc to find out some
parameters, and there may be differences in what is obtained from gcc and
from ghe default cc.
configure has the following useful parameters:
--prefix=PREFIX install architecture-independent files in PREFIX
[default: /usr/local]
......@@ -36,21 +28,18 @@ configure has the following useful parameters:
If you don't like the defaults for the installation directories, you
should override them already during configure. E.g., if you want to
install in the /gnu hierarchy instead of in the default /usr/local
hirarchy, say
hierarchy, say
./configure --prefix=/gnu
After, configuration, type
Moreover, if your GCC is not called gcc (but, e.g., gcc-2.7.1), you
should say so during configuration:
make
env GCC=gcc-2.7.1 ./configure
If your make has trouble with the Makefile, "make gforth" might work.
If your installed gcc isn't called "gcc" (e.g., called "gcc-2.6.1"), type
make GCC=<whatever you call your gcc>
After, configuration, type
instead.
make
Now you can check whether your shiny new Forth system works. Say
......
......@@ -34,7 +34,7 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
LN_S = @LN_S@
GCC = gcc
GCC = @GCC@
CC = $(GCC)
FORTH = ./gforth
FORTHK = $(FORTH) -i kernal.fi
......@@ -100,7 +100,7 @@ SOURCES = Makefile.in configure.in configure config.sub config.guess \
RCS_FILES = ToDo model high-level
GEN = gforth
GEN = gforth first
OBJECTS = engine.o io.o main.o @LIBOBJS@ @getopt_long@
......@@ -142,8 +142,14 @@ more: $(FORTH_GEN) gforth
# `distclean' also deletes the files made by config.
# `realclean' also deletes everything that could be regenerated automatically."
clean:
-$(RM) $(GEN) *.o *.s gforth.fi *.fi~ *.fi+ version.fs TAGS crossdoc.fd
mostlyclean:
-$(RM) -rf *.s gforth.fi *.fi~ *.fi+ version.fs TAGS \
crossdoc.fd doc.fd gforth.aux gforth.cp gforth.cps \
gforth.dvi gforth.fn gforth.ky gforth.log gforth.pg \
gforth.toc gforth.tp gforth.vr html
clean: mostlyclean
-$(RM) -rf $(GEN) *.o
distclean: clean
-$(RM) machine.h kernal.fi config.cache config.log config.status Makefile
......@@ -151,6 +157,11 @@ distclean: clean
realclean: distclean
-$(RM) $(GEN_PRECIOUS)
#mostlyclean, but also remove some of the stuff that is distributed
virtualclean: mostlyclean
-$(RM) -rf gforth.fns gforth.texi gforth.ps gforth.info* \
gforth-$(VERSION).tar.gz config.cache *~
dist: $(SOURCES) $(FORTH_GEN) $(DOCDIST)
-rm -rf gforth-$(VERSION)
mkdir gforth-$(VERSION)
......@@ -190,6 +201,7 @@ binonlydist: $(SOURCES) $(FORTH_GEN) gforth $(OBJECTS)
install: gforth $(FORTH_SRC) kernal.fi gforth.fi gforth.1 gforth.info
$(INSTALL) -d $(bindir) $(mandir) $(infodir) $(libdir)/gforth/$(VERSION) $(datadir)/gforth/$(VERSION) $(libdir)/gforth/site-forth $(datadir)/gforth/site-forth
touch $(datadir)/gforth/site-forth/site-init.fs
-$(RM) $(bindir)/gforth
$(INSTALL_PROGRAM) -s gforth $(bindir)
ln -f $(bindir)/gforth $(bindir)/gforth-$(VERSION)
$(INSTALL_DATA) gforth.1 $(mandir)
......@@ -197,7 +209,7 @@ install: gforth $(FORTH_SRC) kernal.fi gforth.fi gforth.1 gforth.info
for i in $(FORTH_SRC); do \
$(INSTALL_DATA) $$i $(datadir)/gforth/$(VERSION); \
done
rm gforth.fi; make gforth.fi #gforth.fi contains some path names
$(RM) gforth.fi; make gforth.fi #gforth.fi contains some path names
$(INSTALL_DATA) kernal.fi gforth.fi $(libdir)/gforth/$(VERSION)
......@@ -329,7 +341,7 @@ gforth.texi: gforth.ds primitives.b ds2texi.fs prims2x.fs doc.fd crossdoc.fd
checkdoc: gforth.ds primitives.b ds2texi.fs prims2x.fs doc.fd crossdoc.fd answords.fs
$(FORTHK) -p . ds2texi.fs answords.fs -e bye
gforth.dvi: gforth.texi
gforth.dvi gforth.fns: gforth.texi
$(TEXI2DVI) gforth.texi
gforth.ps: gforth.dvi
......
......@@ -20,9 +20,17 @@
*/
/* Be careful: long long on Alpha are 64 bit :-(( */
#define LONG_LATENCY
#if !defined(USE_TOS) && !defined(USE_NO_TOS)
#define USE_TOS
#endif
#ifdef DIRECT_THREADED
#warning direct threading not supported on the Alpha (yet)
#undefine DIRECT_THREADED
#endif
#define FLUSH_ICACHE(addr,size) asm("call_pal 0x86") /* imb */
#include "32bit.h"
dnl Process this file with autoconf to produce a configure script.
AC_INIT(engine.c)
GCC=${GCC-gcc}
AC_SUBST(GCC)
dnl configure needs $CC to find out some parameters, and there may be
dnl differences in what is obtained from gcc and from the default cc.
dnl Therefore, we define $CC to be gcc:
CC=$GCC
AC_ARG_ENABLE(force-reg,
[ --enable-force-reg Use explicit register declarations if they appear in
the machine.h file. This can cause a good speedup,
......
......@@ -418,7 +418,7 @@ Create tag-bof 1 c, 0C c,
loadfilename 2@ last-loadfilename 2@ d<>
IF
tag-bof count tag-file-id write-line throw
loadfilename 2@ 2dup
sourcefilename 2dup
tag-file-id write-file throw
last-loadfilename 2!
s" ,0" tag-file-id write-line throw
......@@ -432,7 +432,7 @@ Create tag-bof 1 c, 0C c,
tag-beg count tag-file-id write-file throw
tlast @ >image count $1F and tag-file-id write-file throw
tag-end count tag-file-id write-file throw
base @ decimal loadline @ 0 <# #s #> tag-file-id write-file throw
base @ decimal sourceline# 0 <# #s #> tag-file-id write-file throw
\ >in @ 0 <# #s [char] , hold #> tag-file-id write-line throw
s" ,0" tag-file-id write-line throw
base !
......
......@@ -74,11 +74,11 @@ create emit-file-char 0 c,
: put-load-file-name ( file-id -- )
>r
loadfilename 2@ last-loadfilename 2@ d<>
sourcefilename last-loadfilename 2@ d<>
if
#ff r@ emit-file throw
#lf r@ emit-file throw
loadfilename 2@ 2dup
sourcefilename 2dup
r@ write-file throw
last-loadfilename 2!
s" ,0" r@ write-line throw
......@@ -100,7 +100,7 @@ create emit-file-char 0 c,
last @ name>string r@ write-file throw
bl r@ emit-file throw
1 r@ emit-file throw
base @ decimal loadline @ 0 <# #s #> r@ write-file throw base !
base @ decimal sourceline# 0 <# #s #> r@ write-file throw base !
s" ,0" r@ write-line throw
\ the character position in the file; not strictly necessary AFAIK
\ instead of using 0, we could use file-position and subtract
......
......@@ -129,14 +129,14 @@ decimal
\ SOURCE-ID SAVE-INPUT RESTORE-INPUT 11jun93jaw
: source-id ( -- 0 | -1 | fileid ) \ core-ext source-i-d
loadfile @ dup 0= IF drop loadline @ 0 min THEN ;
loadfile @ dup 0= IF drop sourceline# 0 min THEN ;
: save-input ( -- x1 .. xn n ) \ core-ext
>in @
loadfile @ ?dup
IF dup file-position throw loadline @ >tib @ 6
IF dup file-position throw sourceline# >tib @ 6
#tib @ >tib +!
ELSE loadline @ blk @ linestart @ >tib @ 5 THEN
ELSE sourceline# blk @ linestart @ >tib @ 5 THEN
;
: restore-input ( x1 .. xn n -- flag ) \ core-ext
......@@ -144,7 +144,7 @@ decimal
6 = IF loadline ! rot dup loadfile !
reposition-file IF drop true EXIT THEN
ELSE linestart ! blk !
dup loadline @ <> IF 2drop true EXIT THEN
dup sourceline# <> IF 2drop true EXIT THEN
loadline !
THEN
>in ! false ;
......
......@@ -308,7 +308,7 @@ aligned constant syntax-expr \ length of a syntax-expr )
\ the following is just a dummy
[ s" gforth" environment? ]
[IF] [ 2drop ]
0 loadline @ 2,
0 sourceline# 2,
[ELSE]
[ s" bigFORTH" environment? ]
[IF] [ 2drop ]
......
......@@ -1338,7 +1338,7 @@ Defer key ( -- c ) \ core
tib /line
loadfile @ ?dup
IF read-line throw
ELSE loadline @ 0< IF 2drop false EXIT THEN
ELSE sourceline# 0< IF 2drop false EXIT THEN
accept true
THEN
1 loadline +!
......@@ -1380,14 +1380,14 @@ create nl$ 1 c, A c, 0 c, \ gnu includes usually a cr in dos
\ include-file 07apr93py
: push-file ( -- ) r>
loadline @ >r loadfile @ >r
sourceline# >r loadfile @ >r
blk @ >r tibstack @ >r >tib @ >r #tib @ >r
>tib @ tibstack @ = IF r@ tibstack +! THEN
tibstack @ >tib ! >in @ >r >r ;
: pop-file ( throw-code -- throw-code )
dup IF
source >in @ loadline @ loadfilename 2@
source >in @ sourceline# sourcefilename
error-stack dup @ dup 1+
max-errors 1- min error-stack !
6 * cells + cell+
......@@ -1463,6 +1463,20 @@ create image-included-files 0 , 0 , ( pointer to and count of included files )
\ a-addr 2@ produces the current file name ( c-addr u )
included-files 2@ drop loadfilename# @ 2* cells + ;
: sourcefilename ( -- c-addr u ) \ gforth
\ the name of the source file which is currently the input
\ source. The result is valid only while the file is being
\ loaded. If the current input source is no (stream) file, the
\ result is undefined.
loadfilename 2@ ;
: sourceline# ( -- u ) \ gforth sourceline-number
\ the line number of the line that is currently being interpreted
\ from a (stream) file. The first line has the number 1. If the
\ current input source is no (stream) file, the result is
\ undefined.
loadline @ ;
: init-included-files ( -- )
image-included-files 2@ 2* cells save-string drop ( addr )
image-included-files 2@ nip included-files 2! ;
......@@ -1629,8 +1643,8 @@ DEFER DOERROR
;
: (DoError) ( throw-code -- )
loadline @ IF
source >in @ loadline @ 0 0 .error-frame
sourceline# IF
source >in @ sourceline# 0 0 .error-frame
THEN
error-stack @ 0 ?DO
-1 error-stack +!
......
......@@ -83,7 +83,7 @@ Create inlocal 5 cells allot inlocal off
: (local) ( addr u -- ) inlocal @ 0=
IF postpone <local inlocal on
inlocal 3 cells + 2! inlocal cell+ 2! THEN
dup IF linestart @ >r loadline @ >r loadfile @ >r
dup IF linestart @ >r sourceline# >r loadfile @ >r
blk @ >r >tib @ >r #tib @ dup >r >in @ >r
>tib +! dup #tib ! >tib @ swap move
......
......@@ -34,10 +34,10 @@ INSTALL = install-sh
INSTALL_PROGRAM = install-sh
INSTALL_DATA = install-sh
LN_S = copy
GCC = gcc
GCC = @GCC@
CC = $(GCC)
FORTH = gforth
FORTHK = $(FORTH) -p . -i kernal.fi
FORTHK = $(FORTH) -i kernal.fi
STRIP = strip
TEXI2DVI = texi2dvi
DVI2PS = dvips -D300
......@@ -100,7 +100,7 @@ SOURCES = Makefile.in configure.in configure config.sub config.guess \
RCS_FILES = ToDo model high-level
GEN = gforth
GEN = gforth first
OBJECTS = engine.o main.o ecvt.o select.o getopt.o getopt1.o
......@@ -123,11 +123,11 @@ GEN_PRECIOUS = $(FORTH_GEN) $(KERNLS) gforth.texi gforth.dvi gforth.ps Makefile
.SUFFIXES:
.SUFFIXES: .c .o
all:
if [ ! -f gforth ]; then $(MAKE) first; fi
$(MAKE) more
all: first more
first: gforth
first:
$(MAKE) gforth
touch first
more: $(FORTH_GEN) gforth
......@@ -142,8 +142,14 @@ more: $(FORTH_GEN) gforth
# `distclean' also deletes the files made by config.
# `realclean' also deletes everything that could be regenerated automatically."
clean:
-$(RM) $(GEN) *.o *.s gforth.fi *.fi~ *.fi+ version.fs TAGS crossdoc.fd
mostlyclean:
-$(RM) -rf *.s gforth.fi *.fi~ *.fi+ version.fs TAGS \
crossdoc.fd doc.fd gforth.aux gforth.cp gforth.cps \
gforth.dvi gforth.fn gforth.ky gforth.log gforth.pg \
gforth.toc gforth.tp gforth.vr html
clean: mostlyclean
-$(RM) -rf $(GEN) *.o
distclean: clean
-$(RM) machine.h kernal.fi config.cache config.log config.status Makefile
......@@ -151,6 +157,11 @@ distclean: clean
realclean: distclean
-$(RM) $(GEN_PRECIOUS)
#mostlyclean, but also remove some of the stuff that is distributed
virtualclean: mostlyclean
-$(RM) -rf gforth.fns gforth.texi gforth.ps gforth.info* \
gforth-$(VERSION).tar.gz config.cache *~
dist: $(SOURCES) $(FORTH_GEN) $(DOCDIST)
-rm -rf gforth-$(VERSION)
mkdir gforth-$(VERSION)
......@@ -190,6 +201,7 @@ binonlydist: $(SOURCES) $(FORTH_GEN) gforth $(OBJECTS)
install: gforth $(FORTH_SRC) kernal.fi gforth.fi gforth.1 gforth.info
$(INSTALL) -d $(bindir) $(mandir) $(infodir) $(libdir)/gforth/$(VERSION) $(datadir)/gforth/$(VERSION) $(libdir)/gforth/site-forth $(datadir)/gforth/site-forth
touch $(datadir)/gforth/site-forth/site-init.fs
-$(RM) $(bindir)/gforth
$(INSTALL_PROGRAM) -s gforth $(bindir)
ln -f $(bindir)/gforth $(bindir)/gforth-$(VERSION)
$(INSTALL_DATA) gforth.1 $(mandir)
......@@ -197,7 +209,7 @@ install: gforth $(FORTH_SRC) kernal.fi gforth.fi gforth.1 gforth.info
for i in $(FORTH_SRC); do \
$(INSTALL_DATA) $$i $(datadir)/gforth/$(VERSION); \
done
rm gforth.fi; make gforth.fi #gforth.fi contains some path names
$(RM) gforth.fi; make gforth.fi #gforth.fi contains some path names
$(INSTALL_DATA) kernal.fi gforth.fi $(libdir)/gforth/$(VERSION)
......@@ -231,22 +243,22 @@ gforth: $(OBJECTS)
coff2exe $@
kernl16l.fi+: $(KERN_SRC) mach16l.fs $(FORTH_GEN0)
$(FORTHK) -e 's" mach16l.fs"' main.fs
$(FORTHK) -p . -e 's" mach16l.fs"' main.fs
kernl16b.fi+: $(KERN_SRC) mach16b.fs $(FORTH_GEN0)
$(FORTHK) -e 's" mach16b.fs"' main.fs
$(FORTHK) -p . -e 's" mach16b.fs"' main.fs
kernl32l.fi+: $(KERN_SRC) mach32l.fs $(FORTH_GEN0)
$(FORTHK) -e 's" mach32l.fs"' main.fs
$(FORTHK) -p . -e 's" mach32l.fs"' main.fs
kernl32b.fi+: $(KERN_SRC) mach32b.fs $(FORTH_GEN0)
$(FORTHK) -e 's" mach32b.fs"' main.fs
$(FORTHK) -p . -e 's" mach32b.fs"' main.fs
kernl64l.fi+: $(KERN_SRC) mach64l.fs $(FORTH_GEN0)
$(FORTHK) -e 's" mach64l.fs"' main.fs
$(FORTHK) -p . -e 's" mach64l.fs"' main.fs
kernl64b.fi+: $(KERN_SRC) mach64b.fs $(FORTH_GEN0)
$(FORTHK) -e 's" mach64b.fs"' main.fs
$(FORTHK) -p . -e 's" mach64b.fs"' main.fs
kernl16b.fi: $(KERNLS)
-$(CP) kernl16b.fi kernl16b.fi~
......@@ -296,16 +308,16 @@ primitives.b: primitives
m4 primitives >$@
primitives.i : primitives.b prims2x.fs
$(FORTHK) prims2x.fs -e "s\" primitives.b\" ' output-c process-file bye" >$@
$(FORTHK) -p . prims2x.fs -e "s\" primitives.b\" ' output-c process-file bye" >$@
prim_labels.i : primitives.b prims2x.fs
$(FORTHK) prims2x.fs -e "s\" primitives.b\" ' output-label process-file bye" >$@
$(FORTHK) -p . prims2x.fs -e "s\" primitives.b\" ' output-label process-file bye" >$@
aliases.fs: primitives.b prims2x.fs
$(FORTHK) prims2x.fs -e "s\" primitives.b\" ' output-alias process-file bye" >$@
$(FORTHK) -p . prims2x.fs -e "s\" primitives.b\" ' output-alias process-file bye" >$@
primitives.fs: primitives.b prims2x.fs
$(FORTHK) prims2x.fs -e "s\" primitives.b\" ' output-forth process-file bye" >$@
$(FORTHK) -p . prims2x.fs -e "s\" primitives.b\" ' output-forth process-file bye" >$@
version.fs: Makefile.in
echo ": version-string s\" $(VERSION)\" ;" >$@
......@@ -318,18 +330,18 @@ doc.fd: makedoc.fs float.fs search-order.fs glocals.fs environ.fs \
toolsext.fs wordinfo.fs \
vt100.fs colorize.fs see.fs bufio.fs debug.fs history.fs \
doskey.fs vt100key.fs startup.fs assert.fs debugging.fs code.fs
$(FORTHK) -e "s\" doc.fd\"" makedoc.fs startup.fs code.fs -e bye
$(FORTHK) -p . -e "s\" doc.fd\"" makedoc.fs startup.fs code.fs -e bye
crossdoc.fd: $(KERN_SRC) $(FORTH_GEN0)
$(FORTHK) -e 's" mach32l.fs"' main.fs
$(FORTHK) -p . -e 's" mach32l.fs"' main.fs
gforth.texi: gforth.ds primitives.b ds2texi.fs prims2x.fs doc.fd crossdoc.fd
$(FORTHK) ds2texi.fs -e "s\" gforth.ds\" r/o open-file throw ds2texi bye" >$@
$(FORTHK) -p . ds2texi.fs -e "s\" gforth.ds\" r/o open-file throw ds2texi bye" >$@
checkdoc: gforth.ds primitives.b ds2texi.fs prims2x.fs doc.fd crossdoc.fd answords.fs
$(FORTHK) ds2texi.fs answords.fs -e bye
$(FORTHK) -p . ds2texi.fs answords.fs -e bye
gforth.dvi: gforth.texi
gforth.dvi gforth.fns: gforth.texi
$(TEXI2DVI) gforth.texi
gforth.ps: gforth.dvi
......@@ -359,4 +371,4 @@ makefile.dos: mkdosmf.sed Makefile.in
startup.dos: startup.fs Makefile.in
sed -e "s/\\\\ include doskey/include doskey/g" \
-e "s/include vt100key/\\\\ include vt100key/g" <$< >$@
\ No newline at end of file
-e "s/include vt100key/\\\\ include vt100key/g" <startup.fs >startup.dos
......@@ -32,7 +32,7 @@ end-struct sourcepos
: sourcepos, ( -- )
\ record the current source position HERE
loadfilename# @ , loadline @ , ;
loadfilename# @ , sourceline# , ;
: get-sourcepos ( a-addr -- c-addr u n )
\ c-addr u is the filename, n is the line number
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment