|  | 
 
Index 
 ANS
 API
 Debugger
 Download
 Licensing
 Links
 Locals
 OOP In Ficl
 Parse Steps
 Release History
 Upgrading To 4.0
 
 |  | 
 
 
First official release of new engine as Ficl 4!  Hooray!
ficlDictionarySee()now takes aficlCallback,
so it knows where to print to. This is because ficlWin only
sets a per-VM callback, which should work.
ficlSystemCreate()now passes in the system correctly
into the dictionaries it creates, which lets dictionaries know what
system they're a part of.
ficlCompatibility: Forgot to add the errorTextOutto theficl_systemstructure (though I'd remembered to add it to
theficl_vmstructure). This caused theficl_systemmembers aftertextOutto not line up with their equivalentficlSystemmembers, which did bad things.  (The bad thing
in particular was callingficlDictionaryResetSearchOrder()resulted in diddling thevm->linkmember, which strangely
enough resulted in double-freeing the stacks.)
Added ficlStackWalk(), which walks a stack from top
to bottom and calls your specified callback with each successive
element.  Cleaned up stack-printing functions as a result.
Changed MULTICALLso you can explicitly specify the vtable.
Changed XClasses so it explicitly specifies the vtable for
non-virtual classes.  This means you can now call a virtual
method when you've SUPERed an object and you'll
get the method you wanted.
XClasses improvement: when removing a thunked method, remove
the thunk variable too.  Added xClass.removeMember()to support this.
XClasses now generates runtime stack-check code (_DEBUGonly) for functions thunked from C to Ficl.
FICL_WANT_PLATFORMis now0by default.
It is now set to1in the appropriateficlplatform/*.h.
softcore/win32.fr ENVIRONMENT? COMPARE needed to be case-insensitive.
Whoops!  Setting FICL_PLATFORM_2INTEGERto 0
didn't compile.  It now does, and works fine, as proved by
theansiplatform.
Another whoops: contrib/xclasses/xclasses.py assumed that "(a prefix
version ofS") defined.  Switched toS", which is safer. 
 
Cleaned up some FICL_definitions.  Now allFICL_HAVE_*constants
(and some other odds and ends) have been moved toFICL_PLATFORM_.
Whoops!  Setting FICL_PLATFORM_2INTEGERto 0 didn't
compile.  It now does, and works fine, as proved by
the"ansi"platform.
Another whoops: contrib/xclasses/xclasses.pyassumed that"(a prefix
version ofS") defined.  Switched toS", which is safer.
Added ficlDictionarySetConstantString().  'Cause I needed it for:
Removed the "WIN32"ENVIRONMENT?setting, and added"FICL_PLATFORM_OS"and"FICL_PLATFORM_ARCHITECTURE"in its place.  These are both strings.
Updatedsoftcore/win32.frto match.
Compatibility: improved ficlTextOut()behavior.  It makes life slightly
less convenient for some users, but should be an improvement overall.
The change:ficlTextOut()is now a compatibility-layer function that
calls straight through tovmTextOut().  Lots of old code callsficlTextOut()(naughty!).  It's now explicit that you must set thetextOutfunction
by hand if you use a custom one... which is a good habit to get in to anyway.
Improved the documentation regarding upgrading, ficllocals.h, and compile-time
constants.
Fixed doc/source/generate.pyso it gracefully fails to copy over read-only
files.
Got rid of every #ifdefin the sources.  We now consistently use#if defined()everywhere.  Similarly, got rid of all platform-switched#ifcode (except for the
compatibility layer, sigh). 
 
Documentation totally reworked and updated.
oldnamesrenamed tocompatibility.
And improved, so that now Ficl 4 is basically a drop-in
replacement for Ficl 3. 
 
Did backwards-compatibility testing.  Ficl now drops in, more or less,
with all the old Ficl-3.03-using projects I had handy.
Got Ficl compiling and running fine on Linux.
Weaned LZ77 code from needing htonl()/ntohl().
Moved all the primitives defined in "testmain.c" to their own file,
"extras.c", and gave it its own global entry point.
Renamed "testmain.c" to just plain "main.c".
Renamed "softwords" directory to "softcore".  More symmetrical.
Renamed "softcore\softcore.bat" to "make.bat".  Added support for "CLEAN".
 
 
Added runtime jump-to-jump peephole optimization in the new
switch-threaded VM.
Fixed INCLUDE-FILEso it rethrows an exception in the
subordinate evaluation.
Added a separate errorOutfunction toficlCallback(),
so under Windows you can have a jolly popup window to
rub your nose in your failings. 
 
Namespace policing complete.  There are now no external symbols
which do not start with the word ficl.
Removed ficlVmExec(), renamedficlVmExecC()toficlVmExecuteString(), changed it to take aficlString().
This is deliberate subterfuge on my part; I suspect most
people who currently callficlVmExec() / ficlVmExecC()should be callingficlVmEvaluate(). 
 
First pass at support for "oldnames", and namespace policing.
 
 
First alpha release of Ficl 4.0 rewrite.  Coded, for better
or for worse, by Larry Hastings.
Ficl is smaller, faster, more powerful,
and easier to use than ever before.  (Or your money back!)
Rewrote Ficl's virtual machine; Ficl now runs nearly 3x faster out-of-the-box.
The new virtual machine is of the "big switch statement" variety.
Renamed most (probably all) external Ficl functions and data structures.
They now make sense and are (gasp!) consistent.
Retooled double-cell number support to take advantage of platforms
which natively support double-cell-sized integers.  (Like most modern
32-bit platforms.)
Locals and VALUEs are now totally orthogonal; they can be  single- or
double-cell, and use the float or data stack. TO automatically supports all variants.
The "softcore" words can now be stored compressed, with a (current)
savings of 11k.  Decompression is nigh-instantaneous.  You can choose
whether or not you want softcore stored compressed at compile-time.
Reworked Win32 build process.  Ficl now builds out-of-the-box on Win32
as a static library, as a DLL, and as a command-line program,
in each of the six possible runtime variants (Debug,Release x Singlethreaded,
Multithreaded,Multithreaded DLL).
There's very likely other wonderful things that I've long forgotten
about.  If you notice them, feel free to remind me  :)
 
 
Bugfix for floating-point numbers.  Floats in compiled code were simply broken.
New words: randomandseed-random
Bugfix: includednever closed its file.
Bugfix: includewas notIMMEDIATE.
Un-hid the OO words parse-method,lookup-method, andfind-method-xt, as there are perfectly legitimate reasons why you might want to use them.
Changed the prefix version of .(to beIMMEDIATEtoo.
Fixed comment in Python softcore builder.
Put the doc directory back in to the distribution.  (It was missing from 3.02... where'd it go?)
 
 
Added support for nEnvCells(number of environment cells) toFICL_SYSTEM_INFO.
Consolidated contextandpExtendpointers ofFICL_SYSTEMVM'spExtendpointer is initialized from the copy inFICL_SYSTEMupon VM creation.
Added ficl-robustenvironment variable.
Added FW_ISOBJECTword type.
Bugfix: environment?was ignoring the length of the supplied string.
Portability cleanup in fileaccess.c.
Bugfix in ficlParsePrefix: if the prefix dictionary isn't in the wordlist, the word being examined cannot be a prefix, so return failure.
SEEimprovements:SEE(and consequentlyDEBUG) have improved source listings with instruction offsets.
It's turned off with the preprocessor, but we have the beginnings of a switch-threaded implementation of the inner loop.
Added objectifyand?objectfor use by OO infrastructure.
my=[detects object members (using?object) and assumes all other members leave class unchanged.
Removed MEMORY-EXTenvironment variable (there is no such wordset).
Ficlwin changes:
Ficlwin character handling is more robust
Ficlwin uses multi-system constructs (see ficlthread.c)
Documentation changes:
Corrected various bugs in docs. 
Added ficl-ized version of JV Noble's Forth Primer
Ficl OO tutorial expanded and revised. Thanks to David McNab for his demo and suggestions.
 
 
Major contributionss by Larry Hastings (larry@hastings.org):
FILE wordset (fileaccess.c)
ficlEvaluate wrapper for ficlExec
ficlInitSystemEx makes it possible to bind selectable properties to VMs at create time
Python version of softcore builder ficl/softwords/softcore.py
Environment contains ficl-version (double)
?number handles trailing decimal point per DOUBLE wordset spec
Fixed broken .env (thanks to Leonid Rosin for spotting this goof)
Fixed broken floating point words that depended on evaluation order of stack pops.
env-constant
env-2constant
dictHashSummary is now commented out unless FICL_WANT_FLOAT (thanks to Leonid Rosin again)
Thanks to David McNab for pointing out that .( should be IMMEDIATE. Now it is.
 
 
Fixed broken oo.fr by commenting out vcall stuff using FICL_WANT_VCALL. Vcall is still broken.
 
 
Added pSys parameter to most ficlXXXX functions for multiple system support. Affected functions:
dictLookupLoc renamed to ficlLookupLoc after addition of pSys param
ficlInitSystem returns a FICL_SYSTEM*
ficlTermSystem
ficlNewVM
ficlLookup
ficlGetDict
ficlGetEnv
ficlSetEnv
ficlSetEnvD
ficlGetLoc
ficlBuild
Fixed off-by-one bug in ficlParsePrefix
Ficl parse-steps now work correctly - mods to interpret()
Made tools.c:isAFiclWord more selective
Tweaked makefiles and code to make gcc happy under linux
Vetted all instances of LVALUEtoCELL to make sure they're working on CELL sized operands 
(for 64 bit compatibility)
 
 
Debugger changes:
New debugger command "x" to execute the rest of the command line as ficl
New debugger command "l" lists the source of the innermost word being debugged
If you attempt to debug a primitive, it gets executed rather than doing nothing
R.Sdisplays the stack contents symbolicallyDebugger now operates correctly under ficlwin, although ficlwin's key handling leaves a lot to be desired. 
SEElisting enhanced for use with the debuggerAdded Guy Carver's changes to oo.fr for VTABLE support
float.cwords f> and >f to move floats to and from the param stack, analogous to >r and r>LOOKUP- Surrogate precompiled parse step for ficlParseWord (this step is hard 
  coded inINTERPRET)License text at top of source files changed from LGPL to BSD by request
Win32 console version now handles exceptions more gracefully rather than crashing - uses win32
structured exception handling.
Fixed BASE bug from 2.05 (was returning the value rather than the address) 
Fixed ALLOT bug - feeds address units to dictCheck, which expects Cells. Changed dictCheck
to expect AU. 
Float stack display word renamed to f.s from .f to be consistent with r.s and .s
 
 
General
HTML documentation extensively revised
Incorporated Alpha (64 bit) patches from the freeBSD team.
Split SEARCH and SEARCH EXT words from words.c to search.c
2LOCALS defined in Johns Hopkins local syntax now lose the first '2:' in their names.
Simple step debugger (see tools.c)
The text interpreter is now extensible - this is accomplished through the use
of ficlAddParseStep().FICL_MAX_PARSE_STEPSlimits the number of parse steps
(default: 8). You can write a precompiled parse step (seeficlParseNumber) and
append it to the chain, or you can write one in ficl and useADD-PARSE-STEPto append it. Default parse steps are initialized inficlInitSystem. You can list
the parse steps withparse-order ( -- ).There is now a FICL_SYSTEM structure. This is a transitional release - version 3.0
will alter several API prototypes to take this as a parameter, allowing multiple
systems per process (and therefore multiple dictionaries). For those who use ficl
under a virtual memory O/S like Linux or Win NT, you can just create multiple ficl
processes (not threads) instead and save youself the wait.
Fixes for improved command line operation in testmain.c (Larry Hastings)
Numerous extensions to OO facility, including a new allot methods, ability
to catch method invocations (thanks to Daniel Sobral again)
Incorporated Alpha (64 bit) patches contributed by Daniel Sobral and the freeBSD team
Ficl is now 64 bit friendly! UNS32 is now FICL_UNS.
Split SEARCH and SEARCH EXT words from words.c to search.c
ABORT" now complies with the ANS (-2 THROWs)
Floating point support contributed by Guy Carver (Enable FICL_WANT_FLOAT in sysdep.h).
Win32 vtable model for objects (Guy Carver)
Win32 dll load/call suport (Larry Hastings)
Prefix support (Larry Hastings) (prefix.c prefix.fr FICL_EXTENDED_PREFIX) makes it 
easy to extend the parser to recignize prefixes like 0x and act on them. Use show-prefixes
to see what's defined.
Cleaned up initialization sequence so that it's all in ficlInitSystem, and so that 
a VM can be created successfully before the dictionary is created
 
Bug fixes
ABORT"
now works correctly (I promise!)
REFILL works
better
ALLOT's
use of dictCheck corrected (finally)
 
New words
2r@ 2r> 2>r
(CORE EXT)
2VARIABLE
(DOUBLE)
ORDER
now lists wordlists by name
.S now
displays all stack entries on one line, like a stack comment
wid-get-name  
given a wid, returns the address and count of its name. If no name, count
is 0
wid-set-name 
set optional wid name pointer to the \0 terminated string address specified.
ficl-named-wordlist creates
a ficl-wordlist and names it. This is now used in vocabulary and
ficl-vocabulary 
last-word  returns the
xt of the word being defined or most recently defined.
q@ and q!
operate on quadbyte quantities for 64 bit friendliness
 
New OO stuff
ALLOT  (class method)
ALLOT-ARRAY (class method)
METHOD define method names globally
MY=> early bind a method call to "this" class
MY=[ ] early bind a string of method calls to "this" class and
obj members
C-> late bind method invocation with CATCH
Metaclass method resume-class and instance word suspend-class
create mutually referring classes. Example in string.fr
Early binding words are now in the instance-vars wordlist, not visible
unless defining a class.
Support for refs to classes with VTABLE methods (contributed by Guy Carver). Guy writes:
My next favorite change is a set of VCALL words that allow me
to call C++ class virtual methods from my forth classes.  This
is accomplished by interfacing with the VTABLE of the class.  The
class instance currently must be created on the C++ side.
C++ places methods in the VTABLE in order of declaration in the
header file.  To use this in FICL one only needs to ensure
that the VCALL: declerations occur in the same order.  I use this
quite a bit to interface with the C++ classes.  When I need access
to a method I make sure it is virtual (Even if it ultimately will
not be).  I use Visual C++ 6.0 and have not tested this under
any other compiler but I believe VTABLE implementation is standard.
 
Here is an example of how to use VCALL:
C++ class declaration 
class myclass
{
public:
  myclass();
  virtual ~myclass();
  virtual void Test( int iParam1 );
  virtual int Test( int iParam1, char cParam2 );
  virtual float Test();
};
ficl class declaration
object subclass myfclass hasvtable   \ hasvtable adds 4 to the offset to
                                   \  accommodate for the VTABLE pointer.
0 VCALL: Destructor()      \ VCALL: ( ParamCount -- )
1 VCALL: Test(int)         \ Test takes 1 int parameter.
2 VCALLR: iTest(int,char)  \ iTest takes 2 parameters and returns an int.  
0 VCALLF: fTest()          \ fTest takes no parameters and returns a float.
end-class
MyCAddress                 \ Primitive to return a pointer to a "myclass" instance.
myfclass -> ref dude       \ This makes the MyCAddress pointer a myfclass
                          \  instance with the name "dude".
1234 dude -> Test(int)     \ Calls the virtual method Test.
1234 1 dude -> iTest(int,char) .  \ Calls iTest and emits the returned int.
dude -> fTest() f.         \ Calls fTest and emits the returned float.
 
 
ficlwin
Catches exceptions thrown by VM in ficlThread (0 @ for example) rather
than passing them off to the OS. 
 
ficl bugs vanquished
Fixed leading delimiter bugs in s" ." .( and ( (reported by Reuben Thomas)
Makefile tabs restored (thanks to Michael Somos)
ABORT" now throws -2 per the DPANS (thanks to Daniel Sobral for sharp eyes
again) 
ficlExec does not print the prompt string unless (source-id == 0)
Various fixes contributed by the FreeBSD team.
 
ficl enhancements
Words.c: modified ficlCatch to use vmExecute and vmInnerLoop (request of
Daniel Sobral) Added vmPop and vmPush functions (by request of Lars Krueger
) in vm.c These are shortcuts to the param stack. (Use LVALUEtoCELL to
get things into CELL form) 
Added function vmGetStringEx with a flag to specify whether or not to skip
lead delimiters
Added non-std word: number?
Added CORE EXT word AGAIN (by request of Reuben Thomas) 
Added double cell local (2local) support
Augmented Johns Hopkins local syntax so that locals whose names begin with
char 2 are treated as 2locals (OK - it's goofy, but handy for OOP)
C-string class revised and enhanced - now dynamically sized
C-hashstring class derived from c-string computes hashcode too.
 
 
This is the first version of Ficl that includes contributed code. Thanks
especially to Daniel Sobral, Michael Gauland for contributions and bug
finding.
New words:
Bugs Fixed: 
Ficlwin Enhancements
Bug fix in isNumber(): used to treat chars between 'Z' and 'a' as valid
in base 10... (harmless, but weird)
ficlExec pushes the ip and interprets at the right times
so that nested calls to ficlExec behave the way you'd expect them to.
evaluate respects count parameter, and also passes exceptional
return conditions back out to the calling instance of ficlExec.
VM_QUIT now clears the locals dictionary in ficlExec.
 
Ficl Enhancements
File Menu: recent file list and Open now load files.
Text ouput function is now faster through use of string caching. Cache
flushes at the end of each line and each time ficlExec returns.
Edit/paste now behaves more reasonably for text. File/open loads the specified
file.
Registry entries specify dictionary and stack sizes, default window placement,
and whether or not to create a splitter for multiple VMs. See HKEY_CURRENT_USER/Software/CodeLab/ficlwin/Settings
 
This version includes changes to make it 64 bit friendly. This unfortunately
meant that I had to tweak some core data types and structures. I've tried
to make this transparent to 32 bit code, but a couple of things got renamed.
INT64 is now DPINT. UNS64 is now DPUNS. FICL_INT and FICL_UNS are synonyms
for INT32 and UNS32 in 32 bit versions, but a are obsolescent. Please use
the new data types instead. Typed stack operations on INT32 and UNS32 have
been renamed because they operate on CELL scalar types, which are 64 bits
wide on 64 bit systems. Added BITS_PER_CELL, which has legal values of
32 or 64. Default is 32.
ficl.c: Added ficlExecXT() - executes an xt completely before returning,
passing back any exception codes generated in the process. Normal exit
code is VM_INNEREXIT.
ficl.c: Added ficlExecC() to operate on counted strings as opposed to zero
terminated ones.
ficlExec pushes ip and executes interpret at the right times so that nested
calls to ficlExec behave the way you'd expect them to.
ficlSetStackSize() allows specification of stack size at run-time (affects
subsequent invocations of ficlNewVM()).
vm.c: vmThrow() checks for (pVM->pState != NULL) before longjmping it.
vmCreate nulls this pointer initially. 
EXCEPTION wordset contributed by Daniel Sobral of FreeBSD
MEMORY-ALLOC wordset contributed by Daniel Sobral, too. Added class methods
alloc
and alloc-array in softwords/oo.fr to allocate objects from the
heap.
Control structure match check upgraded (thanks to Daniel Sobral for this
suggestion). Control structure mismatches are now errors, not warnings,
since the check accepts all syntactally legal constructs.
Added vmInnerLoop() to vm.h. This function/macro factors the inner 
interpreter out of ficlExec so it can be used in other places. Function/macro
behavior is conditioned on INLINE_INNER_LOOP in sysdep.h. Default: 1 unless
_DEBUG is set. In part, this is because VC++ 5 goes apoplectic when trying
to compile it as a function. See 
comments in vm.c
EVALUATE respects the count parameter, and also passes exceptional return
conditions back out to the calling instance of ficlExec.
VM_QUIT clears locals dictionary in ficlExec()
Added Michael Gauland's ficlLongMul and ficlLongDiv and support routines
to math64.c and .h. These routines are coded in C, and are compiled only
if PORTABLE_LONGMULDIV == 1 (default is 0).
Added definition of ficlRealloc to sysdep.c (needed for memory allocation
wordset). If your target OS supports realloc(), you'll probably want to
redefine ficlRealloc in those terms. The default version does ficlFree
followed by ficlMalloc.
testmain.c: Changed gets() in testmain to fgets() to appease the security
gods.
testmain: msec renamed to ms in
line with the ANS
softcore.pl now removes comments & spaces at the start and end of lines.
As a result: sizeof (softWords) == 7663 bytes (used to be 20000) 
and consumes 11384 bytes of dictionary when compiled
Deleted license paste-o in readme.txt (oops).
 
 
New words:
Bugs Fixed 
Enhancements (IMHO)
forget now adjusts the dictionary pointer to remove the name of
the word being forgotten (name chars come before the word header in ficl's
dictionary)
:noname used to push the colon control marker and its execution
token in the wrong order
source-id now behaves correctly when loading a file.
refill returns zero at EOF (Win32 load). Win32 load
command continues to be misnamed. Really ought to be called included,
but does not exactly conform to that spec either (because included
expects a string signature on the stack, while Ficl's load
expects a filename upon invocation). The "real" LOAD is a BLOCK
word.
 
dictUnsmudge no longer links anonymous definitions into the dictionary
oop is no longer the default compile wordlist at startup, nor
is it in the search order. Execute also oop definitions
to use Ficl OOP.
Revised oo.fr extensively to make more use of early binding
Added meta - a constant that pushes the address of metaclass.
See oo.fr for examples of use.
Added classes: c-ptr  c-bytePtr  c-2bytePtr  c-cellPtr
These
classes model pointers to non-object data, but each knows the size of its
referent.
 
 
Bug fix: (local) used to leave a value on the stack between the
first and last locals declared. This value is now stored in a static.
Added new local syntax with parameter re-ordering. See
description below. (No longer compiled in version 2.02, in favor of
the Johns Hopkins syntax)
 
 
New ANS Forth words: TOOLS and part of TOOLS EXT, SEARCH
and SEARCH EXT, LOCALS and LOCALS EXT word sets, additional
words from CORE EXT, DOUBLE, and STRING. (See the function
ficlCompileCore in words.c for an alphabetical list by word set).
Simple USER variable support - a user variable is a virtual machine
instance variable. User variables behave as VARIABLEs in all other
respects.
Object oriented syntax extensions (see below)
Optional stack underflow and overflow checking in many CORE words (enabled
when FICL_ROBUST >= 2)
Various bug fixes
 |