Added examples/libs/x11/demo-xft-telugu.4th
Updated examples/fsl/fsl-util.4th
Added FEXPM1 and FLNP1 to the Forth dictionary.
Updated version to 1.5.4-3 in Makefile.
Changes to vm-common.s, vm.s, and vm-fast.s:
Renamed US@ to US2@ to indicate return type.
Created macro FETCH in vm.s to avoid internal calls to L_fetch.
Added US and US@ to provide words similar to MS and MS@ but with microsecond time resolution.
** RELEASING kForth 1.5.3 ***
Freshened examples/lists.4th
Freshened examples/syscalls.4th
Revised copyright notice in kforth.cpp.
Applied patch file vmc.diff to vmc.c, from the 1.5.2 updates.
This patch works around a compilation problem exhibited by gcc version >= 4.8, causing the Forth word, "#", to fail.
Revised implementation of COMPILE, to permit its use in interpretation mode
e.g. in code such as,
: myword ... [ ... compile, ... ] ... ;
ANS Forth states that interpretation semantics for COMPILE, are undefined, but Gforth and other Forths support such use.
Changes to implementation of COMPILE, were made in ForthVM.cpp and in ForthWords.h (to declare COMPILE, as a nondeferred word).
create buf 256 allot ' buf execute
should return the address of buf on the stack. However, it causes a seg. fault, because neither CREATE nor ALLOT assign a valid Cfa to the newly created word. Now, the name buf , when executed will return its address properly, and words that are created using CREATE ... DOES> have no problem also; however, a valid Cfa should exist for a word, at least once it has been ALLOTed in kForth.
Revised ForthVM.cpp to fix this issue:
Added GNU MPFR (multiprecision reliable floating point) library interface
Added test files to examples/libs/gmp.
Added libs/gmp directory to provide GNU multiprecision library interface.
Added files in examples/libs/gmp/:
System validation tests for the present kforth executable were conducted.
All system tests pass with the exception of the following:
A new problem was discovered with the test file paranoia.4th, which failed to load properly. The addition of FS. to the kForth dictionary revealed a problem in the Forth source implementation of [ELSE] (in ans-words.4th). The conditional compilation words can become confused by the presence of tab characters in the input stream and fail to recognize the control structure words, for example if a tab character happens to be part of the [THEN] being parsed by [ELSE]. This is a consequence of using BL WORD for parsing, and the parser will have to be improved to ignore all whitespace characters to fix this type of problem. For the moment, tabs were removed from the offending [IF] ... [ELSE] ... [THEN] structure in paranoia.4th.
The present version shows no additional anomalies.
-- implemented F2DUP in vm.s and vm-fast.s (apparently meant to be implemented in 1.5.1, but overlooked). -- freshened the examples files; the Private: / Public: data hiding mechanism in the fsl-util.4th file is restored throughout the fsl examples. -- reserve space for PRECISION in vm-common.s, for later implementation along with SET-PRECISION and corresponding changes to fp output. -- updated kfmacros.h to the version in the pre-1.6.x tree. -- updated Makefile and version number to 1.5.2.
-- updated the following example files: struct-ext.4th, lists.4th, lists-test.4th, gpib.4th, games/strek.4th. -- added new example files: ftran202.4th, ftran-test.4th, fsm2.4th, chr_tbl.4th.
-- revised implementation of +LOOP (L_plusloop in vm.s and vm-fast.s) to provide behavior consistent with Forth-94, rather than the behavior described in Starting Forth (see notes from 2009-12-13). The revised implementation passes all tests in core.4th and coreplus.4th. -- updated curvefit.4th and cg-test.4th in examples/fsl/extras -- We will now freeze development of version 1.5.1 and roll out the release!!
-- revised README file. -- revised syscalls.4th
-- replaced examples/system-test/stringtest.4th with new version (0.5) from Gerry Jackson. -- revised SYSCALL to take up to 6 arguments, which appears to be sufficient to handle the presently known system calls. -- updated examples/syscalls.4th
Fixed two bugs in implementation of SLITERAL.
Verified its behavior w.r.t. persistent and non-persistent strings.
Updated examples/syscalls.4th to provide more system calls.
Added examples/parallel-mm.4th
| modified | examples/syscalls.4th |
| new file | examples/parallel-mm.4th |
-- implemented SLITERAL (CPP_sliteral() in ForthVM.cpp), rather than making it a synonym for 2LITERAL. Therefore, SLITERAL will also work with non-persistent strings, as it should. -- Revised the code for >FLOAT (C_tofloat() in vmc.c) to allow exponent marker to be '+' or '-', in accord with DPANS94. We now pass all of the tests in examples/system-test/to-float-test.4th The above file has also been revised to include some additional tests of >FLOAT. -- We have completed all planned revisions for the release of kForth v1.5.1. After allowing for a couple of days of testing with the recent changes, the new version will be rolled out.
-- Revised the code for COMPARE and SEARCH (C_compare() and C_search() in vmc.c) to change their behavior with respect to zero length strings. COMPARE and SEARCH failed some tests, involving zero length strings, in the stringtest.x module from Gerry Jackson's anstests. The functions have been revised to provide the expected behavior, and the current executables pass the tests in stringtest.4th. -- We still need to fix SLITERAL, but some support code must first be added for searching kForth's string table. -- A problem with the behavior of SET-ORDER has been fixed. SET-ORDER (CPP_setorder() in ForthVM.cpp), per DPANS94, must reset the search order to the minimum search order when the number of searchlists is -1. This was not being done, and the problem was detected with the searchordertest module from anstests. -- A problem with SEARCH-WORDLIST has been fixed (CPP_searchwordlist() in ForthVM.cpp). The word was case sensitive, causing words not to be found. The character string is converted to upper case before the search is performed. The problem was found after failure of a test in the searchordertest module. The current executables pass the tests in searchordertest.4th. -- Both the stringtest.4th and searchordertest.4th modules from Gerry Jackson's anstests have been added to examples/system-test/ -- The test code for >FLOAT in to-float-test.4th has been revised to keep and display an error count, following DNW's practice.
Updated our regression tests for kForth
A major change was to perform all floating point number comparisons using the ttester.4th supplied methods. This brings regress.4th into uniformity with the other test code involving floating point calculations.
Another change was to comment out the tests for M*/ which have a negative third argument -- a condition declared to be ambiguous by DPANS94.
| modified | examples/system-test/regress.4th |
-- removed examples/ftest.4th and used an adapted version of
Gerry Jackson's filetest tester for ANS compatible file
access words. Testing of ANS file access functions, defined
in files.4th is handled now by examples/system-test/filetest.4th
The filetest tester uncovered incompatibilities in our source
implementation of two file access words with the Forth-94
standard. The two words, defined in files.4th, are:
WRITE-FILE and REPOSITION-FILE
The ior result was not guaranteed to be zero on success, as
required by Forth 94. The ior result code for these words
has been fixed in files.4th. In addition, the change to
WRITE-FILE will affect the return value of WRITE-LINE,
also defined in files.4th.
Another problem was found, using filetest.4th, with the
implementation of READ-LINE, which did not return the correct
values if the last line in the file did not terminate with EOL.
This problem has also been fixed.
*** NOTICE ***
The updated module, files.4th, now passes relevant tests in
filetest.4th. However, all previously written kForth source code
making use of files.4th must now be examined for side affects
resulting from the changes to
WRITE-FILE WRITE-LINE READ-LINE REPOSITION-FILE
*** END NOTICE ***
-- also found a problem with our implementation of SLITERAL, again
thanks to ANS Forth test code, stringtest.x, by Gerry Jackson.
Our current implementation of SLITERAL assumes that the string to be
compiled has persistence. This is not always a valid assumption. Our
implementation of SLITERAL must be fixed.
-- Judging from the output of stringtest.4th, we may also have
problems with the implementation of SEARCH and COMPARE with
regards to their behavior with null strings. These problems
are being studied.
-- modified code for LOOP and UNLOOP in vm.s and vm-fast.s.
-- Moved asm-x86-test.4th into the examples/system-test/
subdirectory.
-- Removed signal-test.4th, which has been obsolete for awhile.
-- Updated arcfour.4th, games/tscp.4th, and ttester.4th.
-- Things to do before release:
0) update version number in Makefile to 1.5.1.
1) replace ftest.4th with a more comprehensive
file functions tester, to be placed in the examples/system-test/
subdirectory
2) update lists.4th, 3) verify freshness of files
in examples/benchmarks, examples/fsl, examples/games, and
examples/libs directory
-- Consolidated some changes from 2009-12-13 into the current 1.5.x tree, with corresponding note below. Unified assembly code for floating point arithmetic words ( F+ F- F* F/ ) into vm-common.s -- added F2DROP (change from 2009-12-03).
-- Decided to move the current 1.5.x development tree to the 1.6.x tree, due to the instability of the current development code as of 2010-04-08. The working system we have been using over the past few months has been from the 2009-11-30 development snapshot. Since the code at that point in time has undergone real-world testing for several months now, we consider it to be stable enough for release. Following the 2009-11-30 snapshot, major changes were made to the vm.s and vm-fast.s in the now-named 1.6.x tree. Other changes made between 2009-11-30 and 2010-04-17 are part of the 1.6.x tree. Plan to make a release package by the end of this month. -- Consolidated changes from 2009-12-02 into the current 1.5.x tree (with corresponding note below).
-- modified interpreter "ok" prompt behavior when the VM or compiler returns an error (revised kforth.cpp). It was pointed out by Zbigniew Baniewski that the "ok" prompt, as described in Starting Forth, is a response to previous input to the interpreter, rather than a prompt indicating readiness to accept new input. The DPANS94 wording supports this interpretation of the prompt behavior, so the "ok" is no longer displayed to the console when an error has resulted from input to the interpreter. -- fixed the order of arguments to the syscall() function in C_syscall() in vmc.c so that stack order of args to SYSCALL can be same as order of the args to the corresponding C system call function. -- Updated and renamed syscalls386.4th to syscalls.4th.
-- Studied the problem with failure of kForth on the coreplus
tests, which extends the testing of the Forth-94 compatibility
of +LOOP. Concluded that kForth does not obey the Forth-94
spec, but appears to adhere to the earlier Forth-83 spec, and
is consistent with the behavior described in Leo Brodie's,
Starting Forth. A survey of other free Forth systems shows that
PFE, up to the latest version (0.33.71), also has the same
behavior as kForth (same behavior w.r.t. coreplus tests), while
the following systems pass the coreplus tests: Gforth (0.7.0),
bigforth (2.3), win32forth (0.02.05).
-- The implementation of F/ has been revised to remove the error
checking code for divide by zero. Apparently the test was not
working as intended, and no checking was actually being performed
in the previous versions of kForth. The FPU does not do a signaling
exception anyway on divide by zero, which is what the test was
intended to avert. A floating point divide by zero results in
"+/-inf" or "nan", which may be considered to be the valid result
of a computation.
-- Recently updated Forth source files in the examples/ directory include
3ds-transform.4th
fsl/extras/read_xyfile.4th
games/tscp.4th
system-test/regress.4th
-- implemented line comment word, "\", in assembly source in vm-common.s. Removed its previous definition in vmc.c -- implemented -TRAILING as an intrinsic word in vmc.c; Forth source definition in strings.4th has been removed.
-- The current build has been tested with the system test code, and with several example source files. However, the user is cautioned that anytime such major source changes are made, as described below, there is a high potential for buggy behavior by the Forth environment. In particular, our assembly source files are currently in a state of flux. -- extend our technique of using macros to combine regular and fast implementations to the assembly language portion of the VM. The file vm-common.s now uses several conditionally defined macros, paralleling the C macros, to enable common coding of regular and fast versions of words implemented in assembly source. A number of words have been moved into vm-common.s. The goal is to reduce vm.s and vm-fast.s to skeletal files which need minimal or no maintenance. Another goal is to revise the regular version to keep the data stack ptr in the EBX register, as is done in the fast version. The latter change will provide a substantial (2x) speedup for the regular version. -- further reorganization of the code in ForthVM.cpp, ForthCompiler.cpp and vmc.c. Functions from the cpp files have been moved to vmc.c. New macros, DROP and TOS, have been added to kfmacros.h and are used in the source files to improve clarity. -- updated examples/system-test/fatan2-test.4th
Implemented D2* and D2/ as intrinsic words in vm.s/vm-fast.s.
The Forth source definitions of these words have been removed from ans-words.4th.
| new file | examples/fsl/extras/interp_array.4th |
-- added a minimal wordlist to the search order. Following the
Gforth model, we add the "Root" wordlist containing the following
words:
ORDER SET-ORDER FORTH-WORDLIST FORTH WORDS
The "Root" wordlist will always appear at the base of the
search order. Further modified the behavior of ONLY to
clear the search order and append the Root wordlist, and
modified FORTH to ensure that the Root wordlist is never
removed from the search order.
-- implemented PARSE and reorganized the code. Some functions
have been moved out of ForthCompiler.cpp and ForthVM.cpp
into vmc.c. In particular, functions that need no access to
the system objects (wordlists, searchlist, opcode vectors,
etc.) belong in vmc.c. See the source comments in the
aforementioned files for details.
-- updated Forth files tpf.4th and system-test/regress.4th.
Removed within-test.4th, from which the tests have been moved
to regress.4th.
Revised strings.4th, with more efficient definitions for the words:
-- implemented CPP_tick (ForthVM.cpp) and removed references to earlier implementation of "tick", L_tick (vm.s and vm-fast.s). The new version performs error handling when the ticked word is not found in the search order, rather than simply return an invalid address. -- Updated the library interface files, lib-interface.4th and fcalls-x86.4th, and the examples in examples/libs. All three examples, blas, cftisio, and x11, have updated code. Also updated forth2html.4th and lists.4th. -- Added read_xyfile.4th to examples/fsl/extras/ and 3ds-transform.4th. -- Removed henon.4th and ogy.4th -- these example programs need to be updated to use FSL files; also removed todouble.4th, which is no longer needed since NUMBER? may be used to perform the desired string to signed double conversion.
-- Revised CPP_semicolon (ForthVM.cpp) to report a word re-definition only if the new word name is found in the current compilation wordlist, instead of in the entire search order. -- Updated the x11 library interface and demo files in examples/libs/x11 -- Updated lib-interface.4th, syscalls386.4th, -- Added 3ds.4th, contained development code for reading 3ds files.
-- Updated the x11 library interface files in examples/libs/x11. -- Updated the files four1.4th and polyfit.4th in examples/fsl/extras.
-- Updated lib-interface.4th to handle calls to C functions with no return values. Still need to integrate handling of calls to C functions with no args. -- Updated the x11 library interface files in examples/libs/x11/. Renamed demo files to demoxx.4th.
We now have a simple demo program to illustrate the x11 library interface!
Copied the development files for the x11 interface to examples/libs/
-- copied the development files for the cfitsio libary interface to examples/libs/ -- created development library interface for X Windows (libX11.4th), based on bigForth's x11.fs.
Revised libblas.4th and moved the blas/ subdirectory to examples/libs/
-- finished implementing ALIAS, which now works. We will retain ALIAS in kForth. -- implemented RESIZE. -- need to redo "tick", which is currently implented in vm.s/vm-fast.s. The current "tick" does not do proper error checking. This word will be move to ForthVM.cpp. Stub for CPP_tick() has been added.
-- implemented SET-ORDER and VOCABULARY. -- revised DLOPEN and DLSYM to accept addresses of null-terminated strings, rather than Forth C" counted strings. The conversion from a Forth string to a null-terminated string will now be handled by the Forth source calling DLOPEN/DLSYM, to allow for more flexibility in the type of strings used by the application. -- Revised lib-interface.4th to correspond to changes in DLOPEN/DLSYM mentioned above. -- internal code changes for class and member function definitions, and their use (see ForthCompiler.h and ForthVM.cpp). -- commented out code for ALIAS, which is currently flawed. This word may be removed. -- make snapshot of current 1.5.x dev tree.
-- implemented GET-ORDER. -- revised lib-interface.4th and fcalls-x86.4th -- added BLAS library interface to examples/fsl/extras/blas/ Test code for the BLAS interface needs to be fleshed out. -- continue to develop the CFITSIO library interface; also plan to port the X11 library interface from bigForth (X11.fs).
-- fixed bug with return flag for NUMBER? in vmc.c; fixing this bug fixed the test failures with lists-test.4th. -- implemented ALIAS, but the implementation is flawed. Attempt to mirror the aliased word results in double memory freeing upon BYE. -- A number of internal changes were made to the classes relating to wordlists and vocabularies. -- implemented SEARCH-WORDLIST. -- added stubs for VOCABULARY and RESIZE.
-- Added Gerry Jackson's coreplus tests in the examples/system-test directory (file, coreplus.4th). We fail some of the +LOOP tests; need to investigate. -- We fail several tests in lists-test.4th; need to investigate. This does not happen in kForth v1.4.1. The source files lists.4th and lists-test.4th are the same between v1.4.1 and the 1.5.x dev tree. -- Created lib-interface.4th to provide generic words for working with external shared object libraries. -- The function call interface is in fcalls-x86.4th. For both asm-x86.4th and fcalls-x86.4th, added links to generic files asm.4th and fcalls.4th. -- Need to implement ALIAS and VOCABULARY.
-- Development is now in the 1.5.x tree. Version number is now 1.5.0. -- renamed the README.SNAP file to ChangeLog, which is a more commonly used filename for the type of info contained here. Made README.SNAP a link to this file. Revised the Makefile to include ChangeLog in the archive and snapshot files. -- Added and tested a number of the Search Order words to kForth. The remaining words to be implemented have stubs for the present. In addition to the standard Search Order words and extensions, the word ASSEMBLER is intrinsic in kForth. -- Revised the assembler, asm-x86.4th, to use wordlists. The assembler words now are part of a separate ASSEMBLER wordlist. The examples file, asm-x86-examples.4th, appears to work with the revisions. -- Began a generic function call library for calling external C functions provided by a shared object library. Our test case for the shared object library interface is the CFITSIO library. The kForth interface (.4th files) to CFITSIO are not yet a part of the included examples, but we have demonstrated a simple test program in Forth, translated from the CFITSIO doc, to write a simple FITS format file.
-- The 1.4.x development tree has been closed, and the existing files
have been moved to the 1.5.x tree. This change was made for two
reasons:
1. The number and scope of recent changes necessitated the
the increment.
2. The need for separate Forth and Assembler wordlists is
now critical.
Existing work in the early 1.5.x tree, to implement wordlists,
has been integrated with the latest 1.4.x code.
-- fixed NUMBER? in vmc.c. This word now handles signed numbers of double length. -- fixed several issues with internal implementation of >FLOAT in ForthVM.cpp. >FLOAT now handles strings of blanks and Fortran double precision notation properly. It also checks for the presence of at least one numeric digit in the string. The latter requirement needs to be moved into the function IsFloat() in ForthCompiler.cpp. At present, simply entering "E" in the interpreter results in a floating point conversion to 0E, assuming base is not HEX. -- modified definition of [ELSE] in ans-words.4th, to make it case insensitive. -- revised strings.4th -- Updated version number to 1.4.7.
Revised dltest.4th.
This example now works, and illustrates how to open a shared object library, find the address of a library function, and call the function. The test illustrates use of the cos() function from the 32-bit C math library, libm.so.
Exported L_dnegate for use by C_numberquery
The word NUMBER? is currently in the midst of revision and does not work.
-- fixed a long-standing bug in the number interpreter which
took as valid input a digit larger than permitted by BASE,
e.g.
BINARY 3
returned 0 instead of a dictionary search error message.
The problem is fixed in the recently factored function,
isBaseDigit(), in ForthCompiler.cpp.
-- added definition of WITHIN in vm.s and vm-fast.s, and removed its Forth source defn. from ans-words.4th. Began a test file, within-test.4th, to test the new assembly language implementation. The tests for WITHIN will later be merged into regress.4th. -- added definition of /STRING in vm.s and vm-fast.s, and removed its Forth source defn. from strings.4th. -- revised examples: asm-x86.4th, syscalls386.4th, struct.4th, todouble.4th, minispread.4th -- revised system-test module, regress.4th.
-- added an interface to dynamic link libraries (shared object libraries). The following words have been added: DLOPEN, DLERROR, DLSYM, DLCLOSE Their source is defined in vmc.c. A test program, dltest.4th, is provided in the examples subdirectory. While the actual function calling word may be defined in assembler, using asm-x86.4th, it would be better to define an intrinsic word that would set up the stack pointer and call the function. -- The example file, syscalls386.4th, needs revision, since the word SYSCALL has been intrinsic to kForth since version 1.4.1. The assembly language interface, which is specific to 32-bit x86, is no longer needed.
-- made >NUMBER intrinsic (in ForthVM.cpp). Its Forth source definition has been removed from ans-words.4th. -- consolidated C macros in file kfmacros.h, and updated dependencies in Makefile; also updated version number to 1.4.6. -- began revising NUMBER? (in vmc.c) to work properly with double numbers.
-- added placeholder opcodes in fbc.h for:
>NUMBER WITHIN SPACE BLANK /STRING -TRAILING
PARSE ZDROP ZDUP ZSWAP ZOVER Z@
Z! Z+ Z- Z* Z/
-- revised opcodes in fbc.h for the following words:
NUMBER? DMAX DMIN
-- BLANK is now an intrinsic word (vm.s, vm-fast.s), and
its Forth source definition has been removed from
strings.4th.
Freshened example .4th files.
Many files, particularly in the fsl/ subdirectory were revised and new additions were also made.
Added word FALOG (implementation in vmc.c)
Revised Makefile to update version number to 1.4.5.
Added FLOATS and FLOAT+ as intrinsic words.
added erf-wc.4th in examples/fsl/extras
Made some mods to kForth.cpp to fix picky compiler errors with gcc 4.3.x.
2009-05-23
-- added new floating point power function in vmc.c to replace
the call to the math library pow() function, which has unexpected
loss of accuracy for extreme values.
2009-05-03
-- Fixed a bug in L_calladdr (see notes from 2008-03-17),
which was clobbering the stack pointer, in the file
vm-fast.s.
-- Completed modifications to vmc.c so that only one
version is now needed. Removed file vmc-fast.c from
the source package, thereby reducing the maintenance
load by one file. Currently, the only extra file needed
to support the fast version of kForth is vm-fast.s
-- Updated Makefile to remove dependencies on vmc-fast.c,
and incremented version number to 1.4.4.
-- The source package is now in a buildable state once again.
Both kforth and kforth-fast execute the system test files
with the same results as v1.4.1 (see notes from 2007-08-01).
-- Freshened the following files in examples/: ttester.4th
-- Added the following files in examples/: fatan2-test.4th
2008-07-07
-- revised ForthCompiler.cpp to remove dependency on
the type stack, by recoding the function IsInt().
This file now becomes common between the regular
and fast versions of kForth. The file ForthCompiler-fast.cpp
has been removed from the fast/ directory.
-- revised ForthVM.cpp to perform conditional compilation
for type stack code. This change removes the need for a
separate ForthVM-fast.cpp, and thereby reduces our
effort needed to maintain the code.
-- removed the fast/ directory altogether. The remaining
files which are distinct for the fast version of kForth
have been move up one level from fast/ -- these are
vmc-fast.c and vm-fast.s.
-- updated the Makefile to reflect new directory structure
(no fast/ subdirectory) and to pass a switch to the
compiler to control the version of kForth (regular or
fast) being built. The version nuber was updated to 1.4.3.
2008-07-04
-- fixed problem with WORD (see notes from 2007-11-27).
This fix necessitated a global change in the handling
of pTIB (in ForthVM.cpp and ForthCompiler.cpp). Some
validation of the revised system was performed using
the Forth programs in the examples/ directory.
-- revised fsl-util.4th; freshened cg-test.4th; removed
ftester.4th.
2008-03-30
-- fixed stack behavior of >FLOAT. According to DPANS94,
>FLOAT should treat a string of blank characters as
a valid conversion of floating point zero. We don't
yet have this behavior.
-- added 2LITERAL, SLITERAL, and FLITERAL as intrinsic
words. These words are all synonyms in kForth. Removed
Forth source defn of 2LITERAL in ans-words.4th, and
defn of SLITERAL in strings.4th.
2008-03-21
-- factored out the intrinsic Forth word list from
ForthCompiler.cpp and ForthCompiler-fast.cpp into
a separate file named ForthWords.h, which is
included by both .cpp files. This simplifies adding
new words to the intrinsic Forth dictionary.
-- While making the above factorization, it was noticed
that the Forth compiler does not need to distinguish
between the regular and the fast versions of kForth.
In fact, the only difference between ForthCompiler.cpp
and ForthCompiler-fast.cpp is a trivial use of the
type-stack (GlobalTp) in the function IsInt(). This
can be easily removed to eliminate the need for two
separate ForthCompilerx.cpp files. We plan to
eliminate ForthCompiler-fast.cpp as well as kforth-fast.cpp
and generate kforth-fast from the ordinary versions
of these files.
-- The word ">FLOAT" has been added as an intrinsic word. This
word is specified in DPANS94. We will use it to recode
some string to floating point conversion words in strings.4th
-- Some words in strings.4th which should be made intrinsic
are BLANK, /STRING, -TRAILING, SLITERAL, and maybe
SCAN and SKIP.
-- From ans-words.4th, SPACE, >NUMBER, and 2LITERAL should be
made intrinsic. In fact, SLITERAL is just a synonym for
2LITERAL. In kForth, FLITERAL is also a synonym for 2LITERAL.
2008-03-18
-- factored out common declarations and data (JumpTable)
from vm.s and vm-fast.s into a new file vm-common.s.
The common file is included by vm.s and vm-fast.s
during assembly, so there is no standalone object file
associated with vm-common.s. This factorization saves
us work in maintaining the Jump Table when we add new
words or remap existing words, since mods only have to be
made in one file.
-- Updated the Makefile(s) to introduce dependency on
vm-common.s for building vm.o and vm-fast.o. Also added
symbolic link to vm-common.s in the fast/ directory.
2008-03-17
-- modified the method in which intrinsic words with
opcodes > 255 are compiled and executed, using the
new OP_CALLADDR opcode. The new method is considerably
more efficient than the older method. This change
required code changes in ForthVM.cpp (OpenForth() and
CPP_postpone()), and in ForthCompiler.cpp (ForthCompiler()
and the new function CompileWord()). Implemented
L_calladdr in vm.s.
-- In order to accomodate the OP_CALLADDR opcode, the
opcode for FORGET (in fbc.h) was moved outside the
range 0--255, and some opcodes between 260 to 274
have been remapped (changes in fbc.h and the JumpTable
in vm.s).
-- Fixed POSTPONE for words with opcodes > 255 (CPP_postpone()
in ForthVM.cpp).
-- Added INCLUDED as an intrinsic word (CPP_included() in
ForthVM.cpp), in anticipation of new Forth 200x requirements.
Also removed its Forth source definition from files.4th.
-- Added 2CONSTANT and 2VARIABLE as intrinsic words. The
corresponding Forth source definitions were removed from
ans-words.4th.
-- Corresponding changes to the kforth-fast source are
being made, but not yet complete.
2007-11-30
-- Revised the Makefile to copy the "examples" subdirectory
into the archive and snapshot files.
-- Updated version number in Makefile to 1.4.2.
-- Freshened the "examples/fsl" subdirectory, which is
undergoing rapid revision.
2007-11-27
-- Applied a patch to fix handling of relative paths by INCLUDE,
with respect to the default directory specified by the
shell environment variable KFORTH_DIR. Previously, if KFORTH_DIR
was specified, an include statement such as
INCLUDE fsl/fsl-util
would fail to load the file at $KFORTH_DIR/fsl/fsl-util (if
no file existed at the current path "fsl/"). This behavior
has been fixed, and allows us to use a subdirectory structure
for the .4th files within the default directory.
-- Moved the Forth example programs into their own subdirectory,
"examples". The examples are being organized, by category,
into their own subdirectory structure.
-- Freshened the Forth Scientific Library (FSL) files, and
associates files, which are now organized in "examples/fsl".
-- Discovered bug in implementation of WORD. Its behavior is
inconsistent with corresponding implementation in other Forth
systems when the delimiter character is not a space. The
code below illustrates the problem:
: test bl word count type [char] " word count type ;
( a) test hello world" \ prints "helloworld"
( b) test hello world" \ prints "helloworld"
( c) test hello world" \ prints "hello world"
The output from cases ( b) and ( c) are not the same as
for other systems. The output should be
( b) "hello world"
( c) "hello world"
kForth's WORD is ignoring the first character in the input
stream when it is a space and the delimiter is not a space.
This problem will be further diagnosed and fixed, presently.
2007-10-05
-- Applied patches to files vm.s and vm-fast.s to change the
definition of MOVE to use memmove instead of memcpy. Although
the older definition of MOVE passed the Hayes' tests and the
kForth regression tests under Linux, it failed its regression
tests under Windows/cygwin. The patches make the definition
consistent for the two platforms.
2007-08-01
-- Updated utils.4th
-- Updated version number in Makefile to 1.4.1
-- Commented some tests of F>D in regress.4th. The x86 version
uses the native floating point to double conversion instruction
provided by its FPU. We will address the inconsistency between
the expected results for the corner cases and the actual output
from the FPU at a later date.
-- Updated code for UTM/ in vm-fast.s to match code in vm.s.
-- Implemented UTS/MOD and STS/REM in vm-fast.s. Both kforth
and kforth-fast give identical results for divtest.4th and
regress.4th.
-- We still fail some corner case tests for STS/REM and have
an inconsistency between the ppc and x86 versions for M*/
with a negative divisor. However, these are not considered
to be serious enough problems to postpone the long-delayed
release of kForth 1.4.1 for x86-linux.
2007-07-01
-- Implemented UTS/MOD in vm.s. The two words UTS/MOD and UTM/
share common code, with UTS/MOD being the more general word.
The current implementation passes the tests in divtest.4th,
but the code needs to be better factored (logically, UTM/ should
call UTS/MOD).
-- Implemented STS/REM in vm.s. This word currently fails a few
of the corner-case tests in divtest.4th. Analysis in progress.
2007-02-19
-- Fixed problems with L_utmslash in vm.s. Previously, the word
"M*/", which uses "UTM/", failed some tests. The problems arose
from improper handling of the carry flag during arithmetic in
"UTM/".
-- Added checks for divide by zero and division overflow errors in
L_utmslash and L_umslashmod, in the file vm.s.
-- Added checks for divide by zero in L_fmslashmod, L_smslashrem,
L_mod, and L_slashmod, in the file vm.s. The changes for MOD
and /MOD are carried over from patches to kForth 1.3.2.
-- Corresponding changes, to those described above, have been made
for L_utmslash, L_umslashmod, L_fmslashmod, L_smslashrem, L_mod,
and L_slashmod, in the file vm-fast.s.
-- Added word "#!" in ForthCompiler.cpp and fast/ForCompiler-fast.cpp
This word is synonymous with "\" and allows a .4th file to be
used as an executable shell script.
-- Updated core.4th to the version from the ppc-osx 1.4.x distribution.
-- Other .4th files which have been updated are:
asm-x86.4th, fft1d.4th, primes.4th
-- Added the following .4th files:
expint.4th, elip.4th, logistic.4th, horner.4th, gamma.4th,
pcylfun.4th, crc-32-x86.4th, ioctl.4th, struct-ext.4th,
cg.4th, cg-test.4th, notes.4th, queens.4th, speech.4th,
syscalls386.4th, grating.4th, mersenne.4th, ran-next.4th,
sl.4th, corewars.4th, arcfour.4th
-- Removed the following obsolete .4th files:
nigpib.4th
-- Only known remaining tasks for synchronization with the ppc-osx 1.4.x
distribution are to add the words UTS/MOD and STS/REM, and to
provide consistent behavior for M*/ when it is used with a negative
divisor (behavior of M*/ with use of a negative divisor is undefined
in DPANS94, but we wish to have consistent behavior between the ppc
and x86 code).
2006-11-02
-- Recoded the floating point zero comparison words to remove
conditional branching: F0= F0<
-- Added the fp zero comparison word F0>
-- Above changes were made in both vm.s and vm-fast.s. Both
kforth and kforth-fast pass all of the fp comparison tests
in regress.4th.
-- Updated installation instructions in README file. Also include
instructions in README for customizing Emacs to provide syntax
highlighting for .4th files.
-- Revised Makefile to add gforth.el file to the snapshot and
archive files.
-- Updated the following Forth code examples: fsl-util.4th,
lufact.4th, backsub.4th, gaussj.4th, shellsrt.4th,
regfalsi.4th
-- Added the following Forth code examples: strek.4th, sudoku.4th,
pispigot.4th, qm8.4th, naacb.4th, hilbert.4th, invm.4th,
dets.4th, gpib.4th, fft-x86.4th, curvefit-fsl.4th, and
gfit-fsl2.4th.
2006-07-22
-- Major recoding of vm-fast.s (for kforth-fast) has been completed.
This revision allows nearly all Forth primitives in vm-fast.s to
assume that the stack pointer is loaded in the EBX register.
The changes to keep the stack pointer in EBX imposes additional
new rules for coding Forth primitives in vm-fast.s; these rules
are given in the comments. The net result is about a 17% speedup
w.r.t the previous snapshot for kforth-fast 1.4.0.
-- Updated vm-fast.s with all recent changes to vm.s, described
in the last snapshot.
-- Thorough testing of the revised kforth-fast has not been done;
however, it passes the tests in core.4th (except for SOURCE)
and works with the benchmarks. A few of the other Forth programming
examples have been tested and found to work also.
2006-06-12
-- Fixed error reporting for CPP_include() in ForthVM.cpp and
ForthVM-fast.cpp. When no default source directory is specified
in the environment variable KFORTH_DIR, and an attempt is made to
load a non-existent file using INCLUDE, the load failed silently
without an error message. This has been fixed.
-- Fixed problem with terminal echo setting being turned off if
COLD was executed. Restoration of terminal settings has been
moved from CPP_bye() to CloseForth() in ForthVM.cpp and in
ForthVM-fast.cpp.
-- Updated regress.4th with latest version from DNW, which includes
revised tests for SP@ and RP@ plus tests for SP! and RP!.
-- Updated Makefile to add sample *.dat files to the archive and
snapshot files.
2006-05-30
-- Recoded CMOVE in vm.s and vm-fast.s. CMOVE now passes dnw's tests
in regress.4th. The earlier implementation appears to be consistent
with the ANS Forth word MOVE.
-- Made MOVE an intrinsic word, using the previous implementation of CMOVE.
MOVE passes the Hayes' core tests, but still needs to be rigorously tested.
-- Commented out the source level definition of MOVE in ans-words.4th.
2006-05-02
-- Finished coding DS* DMIN and DMAX in vm.s. Added several
new macros to facilitate these changes: DLT FDUP FSWAP
FOVER _ABS and TNEG.
-- Used macro FREL_DYADIC in vm.s to consolidate the code
for all dyadic floating point relational operators:
F<> F= F< F> F<= and F>=
No conditional jumps are needed for these operators.
-- The above changes have not yet been applied to vm-fast.s.
2006-04-28
-- Revised code for "D=", "D<", and "D0=" to remove conditional jumps.
-- Created macro STOD in vm.s and vm-fast.s, and used this macro to
recode "S>D" and "M+". The problem with "M+" has been fixed and
it now passes its tests in dbltest.4th.
-- Revised code for "D<" to fix problem caused by using DMINUS. The
logic is the same as that used in DNW's vm-osxppc.s. "D<" now passes
its tests in dbltest.4th.
-- Added code for "DU<" in vm.s and vm-fast.s. This word passes its
tests in dbltest.4th. All issues with failures in dbltest.4th have
now been resolved.
-- Revised code for "F<>", "F=", and "F<" to remove conditional jumps.
Still need to revise the remaining floating point relational operators.
-- Remaining tasks are to fix "UTM/", and add the following words:
UTS/MOD STS/REM DS* DMIN DMAX F0>
-- Analyze unexpected failure of tests from DNW's regress.4th
under x86-linux:
CMOVE CMOVE> FILL ERASE
INCORRECT RESULT: { pad 5 + pad DO i c@ LOOP -> 1 1 1 1 1 }
SP@ RP@ 2R@ 2>R 2R>
INCORRECT RESULT: { sp@ dup @ = -> true }
INCORRECT RESULT: { 3 RP@1 -> 3 }
2006-04-23
-- Revised vm.s and vm-fast.s to recode the relational operators
"=", "<>", "<", ">", "<=", ">=", "0=", "0<>", "0<", and "0>" to
remove conditional jumps. I was able to use the x86 SETx instruction
to form the TRUE/FALSE values. Also factored the code for the above
words into two macros: REL_DYADIC and REL_ZERO, which reduces the
size of the code and improves consistency and readability.
-- The above change resulted in approximately 5% increase in speed
as measured with tscp.4th and the regular kforth. Have not
benchmarked the improvement in kforth-fast yet.
-- Further revised vm.s and vm-fast.s to factor the macros _AND, _OR,
_XOR, into another macro, LOGIC_DYADIC. This change further improves
the readability and consistency of the code.
-- Updated hmac-md5.4th and replaced test-lists.4th with lists-test.4th.
2006-04-19
-- Updated vm-fast.s to add fix for M/ which was implemented earlier in
vm.s. The fix was not documented in the comments in vm.s, so a comment
was added.
-- Added the intrinsic word SYSCALL (C_syscall in vmc.c and vmc-fast.c) to
provide a method for calling low-level system functions.
2006-04-15
-- Updated vmc.c and fast/vmc-fast.c with recent patches to fix the signals interface.
A test program, signal-test.4th, is included to show the problem and test the fix.
Problem:
-------
If a Forth word is installed as a signal handler, when the OS executes the
handler, the stack state is in an unpredictable condition, i.e. the switch
may have occured during the middle of execution of a word. This can cause
the handler to overwrite intermediate operands on the stack.
Fix:
---
The stack states are preserved and restored upon entry to and exit from the
handler. The stack pointers are copied, then offset by a fixed amount towards
the top so that, effectively, the handler uses its own separate stack. After
the Forth handler is executed, the original stack pointers are restored.
-- Updated the Makefile to fix "make snapshot" so that it will preserve soft
links in the fast/ subdirectory.
-- Copied updated tests from DNW's ppc-osx port: divtest.4th, dbltest.4th, and
regress.4th.
For divtest.4th, we must do the following:
* Fix L_utmslash in vm.s
* Implement UTS/MOD, STS/REM, DS* in vm.s
For dbltest.4th, the following must be done:
* Fix M+ in vm.s
* Fix D< in vm.s
* Implement DU< in vm.s
For regress.4th, the following must be done:
* Implement DMIN and DMAX as native words; retire these words
in ans-words.4th.
* Add "F0>"? -- apparently added to the kForth intrinsic dictionary
by DNW in the osx-ppc port.
2006-04-12
-- Modifications for consistency with latest snapshot of David Williams' ppc-osx
port, with stubs added in vm.s for division words implemented by DNW in the ppc
version which are not yet available in the x86 version.
-- Updated ForthVM.cpp and ForthVM-fast.cpp for automatic endian handling in
OpsCompileByte().
2006-04-01
-- Includes updates for vm.s and vm-fast.s, which use the EBP register to hold
the virtual IP.
-- Includes updates for asm-x86.4th and asm-x86-examples.4th.
-- Merges some additions by David N. Williams (DNW) from the Mac OS/X
development code in the files fbc.h, ForthCompiler.h, ForthCompiler.cpp,
ForthVM.h, and ForthVM.cpp
-- Revised the Makefile. Use DNW's method for making a development snapshot,
"make snapshot" with changes described in README.SNAP. The file names for
the archive and snapshot files have been changed to be of the form:
kforth-cpu-os-version.tar.gz (archive)
kforth-cpu-os-builddate.tar.gz (snapshot)
-- New .4th files:
fpu-x86.4th
div-test.4th
-- Made UTM/ a visible word (see L_utmslash in vm.s) for testing. The current
implementation fails some tests devised by David Williams (see div-test.4th).
-- There appears to be a bug with the code "POSTPONE :". An initial attempt
to fix this was not successfull, and the fix is commented out in ForthVM.cpp.
Further study is needed.