Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jun 2015 14:23:21 GMT
From:      clord@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r287721 - in soc2015/clord/head/sys/contrib/ficl: . contrib ficlplatform softcore
Message-ID:  <201506291423.t5TENL8k010321@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: clord
Date: Mon Jun 29 14:23:21 2015
New Revision: 287721
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=287721

Log:
  Revert wrong Ficl 4 import

Deleted:
  soc2015/clord/head/sys/contrib/ficl/Makefile
  soc2015/clord/head/sys/contrib/ficl/bit.c
  soc2015/clord/head/sys/contrib/ficl/callback.c
  soc2015/clord/head/sys/contrib/ficl/compatibility.c
  soc2015/clord/head/sys/contrib/ficl/contrib/
  soc2015/clord/head/sys/contrib/ficl/dictionary.c
  soc2015/clord/head/sys/contrib/ficl/double.c
  soc2015/clord/head/sys/contrib/ficl/extras.c
  soc2015/clord/head/sys/contrib/ficl/ficlcompatibility.h
  soc2015/clord/head/sys/contrib/ficl/ficldll.def
  soc2015/clord/head/sys/contrib/ficl/ficldll.dsp
  soc2015/clord/head/sys/contrib/ficl/ficlexe.dsp
  soc2015/clord/head/sys/contrib/ficl/ficllib.dsp
  soc2015/clord/head/sys/contrib/ficl/ficllocal.h
  soc2015/clord/head/sys/contrib/ficl/ficlplatform/
  soc2015/clord/head/sys/contrib/ficl/ficltokens.h
  soc2015/clord/head/sys/contrib/ficl/hash.c
  soc2015/clord/head/sys/contrib/ficl/lzcompress.c
  soc2015/clord/head/sys/contrib/ficl/lzuncompress.c
  soc2015/clord/head/sys/contrib/ficl/main.c
  soc2015/clord/head/sys/contrib/ficl/primitives.c
  soc2015/clord/head/sys/contrib/ficl/softcore/
  soc2015/clord/head/sys/contrib/ficl/system.c
  soc2015/clord/head/sys/contrib/ficl/utility.c
  soc2015/clord/head/sys/contrib/ficl/word.c
Modified:
  soc2015/clord/head/sys/contrib/ficl/   (props changed)
  soc2015/clord/head/sys/contrib/ficl/ReadMe.txt
  soc2015/clord/head/sys/contrib/ficl/ficl.h
  soc2015/clord/head/sys/contrib/ficl/fileaccess.c
  soc2015/clord/head/sys/contrib/ficl/float.c
  soc2015/clord/head/sys/contrib/ficl/prefix.c
  soc2015/clord/head/sys/contrib/ficl/search.c
  soc2015/clord/head/sys/contrib/ficl/stack.c
  soc2015/clord/head/sys/contrib/ficl/tools.c
  soc2015/clord/head/sys/contrib/ficl/vm.c

Modified: soc2015/clord/head/sys/contrib/ficl/ReadMe.txt
==============================================================================
--- soc2015/clord/head/sys/contrib/ficl/ReadMe.txt	Mon Jun 29 13:48:44 2015	(r287720)
+++ soc2015/clord/head/sys/contrib/ficl/ReadMe.txt	Mon Jun 29 14:23:21 2015	(r287721)
@@ -1,5 +1,5 @@
-FICL 4.1.0
-October 2010
+FICL 3.03
+April 2002
 
 ________
 OVERVIEW
@@ -10,22 +10,18 @@
 Command Language".
 
 For more information, please see the "doc" directory.
-For release notes, please see "doc/releases.html".
+For release notes, please see "doc/ficl_rel.html".
 
 ____________
 INSTALLATION
 
 Ficl builds out-of-the-box on the following platforms:
-	* NetBSD, FreeBSD: use "Makefile".
-	* Linux: use "Makefile.linux", but it should work with
-	  "Makefile" as well.
+	* Linux: use "Makefile.linux".
+	* RiscOS: use "Makefile.riscos".
 	* Win32: use "ficl.dsw" / "ficl.dsp".
-To port to other platforms, we suggest you start with the generic
-"Makefile" and the "unix.c" / "unix.h" platform-specific implementation
-files.  (And please--feel free to submit your portability changes!)
-
-(Note: Ficl used to build under RiscOS, but we broke everything
-for the 4.0 release.  Please fix it and send us the diffs!)
+To port to other platforms, be sure to examine "sysdep.h", and
+we suggest you start with the Linux makefile.  (And please--feel
+free to submit your portability changes!)
 
 ____________
 FICL LICENSE

Modified: soc2015/clord/head/sys/contrib/ficl/ficl.h
==============================================================================
--- soc2015/clord/head/sys/contrib/ficl/ficl.h	Mon Jun 29 13:48:44 2015	(r287720)
+++ soc2015/clord/head/sys/contrib/ficl/ficl.h	Mon Jun 29 14:23:21 2015	(r287721)
@@ -4,17 +4,17 @@
 ** Author: John Sadler (john_sadler@alum.mit.edu)
 ** Created: 19 July 1997
 ** Dedicated to RHS, in loving memory
-** $Id: ficl.h,v 1.25 2010/10/03 09:52:12 asau Exp $
-********************************************************************
-**
+** $Id: ficl.h,v 1.18 2001/12/05 07:21:34 jsadler Exp $
+*******************************************************************/
+/*
 ** Copyright (c) 1997-2001 John Sadler (john_sadler@alum.mit.edu)
 ** All rights reserved.
 **
 ** Get the latest Ficl release at http://ficl.sourceforge.net
 **
-** I am interested in hearing from anyone who uses Ficl. If you have
+** I am interested in hearing from anyone who uses ficl. If you have
 ** a problem, a success story, a defect, an enhancement request, or
-** if you would like to contribute to the Ficl release, please
+** if you would like to contribute to the ficl release, please
 ** contact me by email at the address above.
 **
 ** L I C E N S E  and  D I S C L A I M E R
@@ -68,7 +68,7 @@
 ** in a multitasking system. Unlike Forth, Ficl's outer interpreter
 ** expects a text block as input, and returns to the caller after each
 ** text block, so the "data pump" is somewhere in external code. This
-** is more like TCL than Forth, which usually expects to be at the center
+** is more like TCL than Forth, which usually expcets to be at the center
 ** of the system, requesting input at its convenience. Each Ficl virtual 
 ** machine can be bound to a different I/O channel, and is independent
 ** of all others in in the same address space except that all virtual
@@ -116,10 +116,10 @@
 ** system. For example, INT16 is a short on some compilers and an
 ** int on others. Check the default CELL alignment controlled by
 ** FICL_ALIGN. If necessary, add new definitions of ficlMalloc, ficlFree,
-** ficlLockDictionary, and ficlCallbackDefaultTextOut to work with your
-** operating system.  Finally, use testmain.c as a guide to installing the
-** Ficl system and one or more virtual machines into your code. You do not
-** need to include testmain.c in your build.
+** ficlLockDictionary, and ficlTextOut to work with your operating system.
+** Finally, use testmain.c as a guide to installing the Ficl system and 
+** one or more virtual machines into your code. You do not need to include
+** testmain.c in your build.
 **
 ** T o   D o   L i s t
 **
@@ -130,514 +130,118 @@
 **
 ** F o r   M o r e   I n f o r m a t i o n
 **
-** Web home of Ficl
+** Web home of ficl
 **   http://ficl.sourceforge.net
 ** Check this website for Forth literature (including the ANSI standard)
 **   http://www.taygeta.com/forthlit.html
 ** and here for software and more links
 **   http://www.taygeta.com/forth.html
-*/
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <limits.h>
-#include <setjmp.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/*
-** Put all your local defines in ficllocal.h,
-** rather than editing the makefile/project/etc.
-** ficllocal.h will always ship as an inert file.
-*/
-#include "ficllocal.h"
-
-
-
-
-#if defined(FICL_ANSI)
-	#include "ficlplatform/ansi.h"
-#elif defined(_WIN32)
-	#include "ficlplatform/win32.h"
-#elif defined (FREEBSD_ALPHA)
-	#include "ficlplatform/alpha.h"
-#elif defined(unix) || defined(__unix__) || defined(__unix)
-	#include "ficlplatform/unix.h"
-#else /* catch-all */
-	#include "ficlplatform/ansi.h"
-#endif /* platform */
-
-
-
-/*
-**
-** B U I L D   C O N T R O L S
-**
-** First, the FICL_WANT_* settings.
-** These are all optional settings that you may or may not
-** want Ficl to use.
-**
-*/
-
-/*
-** FICL_WANT_MINIMAL
-** If set to nonzero, build the smallest possible Ficl interpreter.
-*/
-#if !defined(FICL_WANT_MINIMAL)
-#define FICL_WANT_MINIMAL          (0)
-#endif
-
-#if FICL_WANT_MINIMAL
-#define FICL_WANT_SOFTWORDS        (0)
-#define FICL_WANT_FILE             (0)
-#define FICL_WANT_FLOAT            (0)
-#define FICL_WANT_USER             (0)
-#define FICL_WANT_LOCALS           (0)
-#define FICL_WANT_DEBUGGER         (0)
-#define FICL_WANT_OOP              (0)
-#define FICL_WANT_PLATFORM         (0)
-#define FICL_WANT_MULTITHREADED    (0)
-#define FICL_WANT_EXTENDED_PREFIX  (0)
-
-#define FICL_ROBUST                (0)
-
-#endif /* FICL_WANT_MINIMAL */
-
-
-/*
-** FICL_WANT_PLATFORM
-** Includes words defined in ficlCompilePlatform
-** (see ficlplatform/win32.c and ficlplatform/unix.c for example)
-*/
-#if !defined (FICL_WANT_PLATFORM)
-#define FICL_WANT_PLATFORM (0)
-#endif /* FICL_WANT_PLATFORM */
-
-
-/*
-** FICL_WANT_COMPATIBILITY
-** Changes Ficl 4 at compile-time so it is source-compatible
-** with the Ficl 3 API.  If you are a new user to Ficl you
-** don't need to worry about this setting; if you are upgrading
-** from a pre-4.0 version of Ficl, see doc/upgrading.html for
-** more information.
-*/
-#if !defined FICL_WANT_COMPATIBILITY
-#define FICL_WANT_COMPATIBILITY (0)
-#endif /* !defined FICL_WANT_COMPATIBILITY */
-
-
-
-/*
-** FICL_WANT_LZ_SOFTCORE
-** If nonzero, the softcore words are stored compressed
-** with patent-unencumbered Lempel-Ziv '77 compression.
-** This results in a smaller Ficl interpreter, and adds
-** only a *tiny* runtime speed hit.
-**
-** As of version 4.0.27, all the runtime code for the decompressor
-** is 688 bytes on a single-threaded release build, but saves 14179
-** bytes of data.  That's a net savings of over 13k!  Plus, it makes
-** the resulting executable harder to hack :)
 **
-** On my 850MHz Duron machine, decompression took 0.00384 seconds
-** if QueryPerformanceCounter() can be believed... it claims that it
-** took 13765 cycles to complete, and that my machine runs 3579545
-** cycles/second.
+** Obvious Performance enhancement opportunities
+** Compile speed
+** - work on interpret speed
+** - turn off locals (FICL_WANT_LOCALS)
+** Interpret speed 
+** - Change inner interpreter (and everything else)
+**   so that a definition is a list of pointers to functions
+**   and inline data rather than pointers to words. This gets
+**   rid of vm->runningWord and a level of indirection in the
+**   inner loop. I'll look at it for ficl 3.0
+** - Make the main hash table a bigger prime (HASHSIZE)
+** - FORGET about twiddling the hash function - my experience is
+**   that that is a waste of time.
+** - Eliminate the need to pass the pVM parameter on the stack
+**   by dedicating a register to it. Most words need access to the
+**   vm, but the parameter passing overhead can be reduced. One way
+**   requires that the host OS have a task switch callout. Create
+**   a global variable for the running VM and refer to it in words
+**   that need VM access. Alternative: use thread local storage. 
+**   For single threaded implementations, you can just use a global.
+**   The first two solutions create portability problems, so I
+**   haven't considered doing them. Another possibility is to
+**   declare the pVm parameter to be "register", and hope the compiler
+**   pays attention.
 **
-** Contributed by Larry Hastings.
-*/
-#if !defined (FICL_WANT_LZ_SOFTCORE)
-#define FICL_WANT_LZ_SOFTCORE (1)
-#endif /* FICL_WANT_LZ_SOFTCORE */
-
-
-/*
-** FICL_WANT_FILE
-** Includes the FILE and FILE-EXT wordset and associated code.
-** Turn this off if you do not have a file system!
-** Contributed by Larry Hastings
 */
-#if !defined (FICL_WANT_FILE)
-#define FICL_WANT_FILE (1)
-#endif /* FICL_WANT_FILE */
 
 /*
-** FICL_WANT_FLOAT
-** Includes a floating point stack for the VM, and words to do float operations.
-** Contributed by Guy Carver
-*/
-#if !defined (FICL_WANT_FLOAT)
-#define FICL_WANT_FLOAT (1)
-#endif /* FICL_WANT_FLOAT */
-
-/*
-** FICL_WANT_DEBUGGER
-** Inludes a simple source level debugger
-*/
-#if !defined (FICL_WANT_DEBUGGER)
-#define FICL_WANT_DEBUGGER (1)
-#endif /* FICL_WANT_DEBUGGER */
-
-/*
-** FICL_EXTENDED_PREFIX
-** Enables a bunch of extra prefixes in prefix.c
-** and prefix.fr (if included as part of softcore.c)
-*/
-#if !defined FICL_WANT_EXTENDED_PREFIX
-#define FICL_WANT_EXTENDED_PREFIX (0)
-#endif /* FICL_WANT_EXTENDED_PREFIX */
-
-/*
-** FICL_WANT_USER
-** Enables user variables: per-instance variables bound to the VM.
-** Kind of like thread-local storage. Could be implemented in a 
-** VM private dictionary, but I've chosen the lower overhead
-** approach of an array of CELLs instead.
-*/
-#if !defined FICL_WANT_USER
-#define FICL_WANT_USER (1)
-#endif /* FICL_WANT_USER */
-
-/* 
-** FICL_WANT_LOCALS
-** Controls the creation of the LOCALS wordset
-** and a private dictionary for local variable compilation.
-*/
-#if !defined FICL_WANT_LOCALS
-#define FICL_WANT_LOCALS (1)
-#endif /* FICL_WANT_LOCALS */
-
-/*
-** FICL_WANT_OOP
-** Inludes object oriented programming support (in softwords)
-** OOP support requires locals and user variables!
-*/
-#if !defined (FICL_WANT_OOP)
-#define FICL_WANT_OOP ((FICL_WANT_LOCALS) && (FICL_WANT_USER))
-#endif /* FICL_WANT_OOP */
-
-/*
-** FICL_WANT_SOFTWORDS
-** Controls inclusion of all softwords in softcore.c.
-*/
-#if !defined (FICL_WANT_SOFTWORDS)
-#define FICL_WANT_SOFTWORDS (1)
-#endif /* FICL_WANT_SOFTWORDS */
-
-/*
-** FICL_WANT_MULTITHREADED
-** Enables dictionary mutual exclusion wia the
-** ficlLockDictionary() system dependent function.
-**
-** Note: this implementation is experimental and poorly
-** tested. Further, it's unnecessary unless you really
-** intend to have multiple SESSIONS (poor choice of name
-** on my part) - that is, threads that modify the dictionary
-** at the same time.
-*/
-#if !defined FICL_WANT_MULTITHREADED
-#define FICL_WANT_MULTITHREADED (0)
-#endif /* FICL_WANT_MULTITHREADED */
-
-
-/*
-** FICL_WANT_OPTIMIZE
-** Do you want to optimize for size, or for speed?
-** Note that this doesn't affect Ficl very much one way
-** or the other at the moment.
-** Contributed by Larry Hastings
-*/
-#define FICL_OPTIMIZE_FOR_SPEED  (1)
-#define FICL_OPTIMIZE_FOR_SIZE   (2)
-#if !defined (FICL_WANT_OPTIMIZE)
-#define FICL_WANT_OPTIMIZE FICL_OPTIMIZE_FOR_SPEED
-#endif /* FICL_WANT_OPTIMIZE */
-
-
-/*
-** FICL_WANT_VCALL
-** Ficl OO support for calling vtable methods.  Win32 only.
-** Contributed by Guy Carver
-*/
-#if !defined (FICL_WANT_VCALL)
-#define FICL_WANT_VCALL (0)
-#endif /* FICL_WANT_VCALL */
-
-
-
-/*
-** P L A T F O R M   S E T T I N G S
-**
-** The FICL_PLATFORM_* settings.
-** These indicate attributes about the local platform.
-*/
-
-
-/*
-** FICL_PLATFORM_OS
-** String constant describing the current hardware architecture.
-*/
-#if !defined (FICL_PLATFORM_ARCHITECTURE)
-#define FICL_PLATFORM_ARCHITECTURE    "unknown"
-#endif
-
-/*
-** FICL_PLATFORM_OS
-** String constant describing the current operating system.
-*/
-#if !defined (FICL_PLATFORM_OS)
-#define FICL_PLATFORM_OS              "unknown"
-#endif
-
-/*
-** FICL_PLATFORM_HAS_2INTEGER
-** Indicates whether or not the current architecture
-** supports a native double-width integer type.
-** If you set this to 1 in your ficlplatform/ *.h file,
-** you *must* create typedefs for the following two types:
-**        ficl2Unsigned
-**        ficl2Integer
-** If this is set to 0, Ficl will implement double-width
-** integer math in C, which is both bigger *and* slower
-** (the double whammy!).  Make sure your compiler really
-** genuinely doesn't support native double-width integers
-** before setting this to 0.
-*/
-#if !defined (FICL_PLATFORM_HAS_2INTEGER)
-#define FICL_PLATFORM_HAS_2INTEGER    (0)
-#endif
-
-/*
-** FICL_PLATFORM_HAS_FTRUNCATE
-** Indicates whether or not the current platform provides
-** the ftruncate() function (available on most UNIXes).
-** This function is necessary to provide the complete
-** File-Access wordset.
-**
-** If your platform does not have ftruncate() per se,
-** but does have some method of truncating files, you
-** should be able to implement ftruncate() yourself and
-** set this constant to 1.  For an example of this see
-** "ficlplatform/win32.c".
-*/
-#if !defined (FICL_PLATFORM_HAS_FTRUNCATE)
-#define FICL_PLATFORM_HAS_FTRUNCATE (0)
-#endif
-
-
-/*
-** FICL_PLATFORM_INLINE
-** Must be defined, should be a function prototype type-modifying
-** keyword that makes a function "inline".  Ficl does not assume
-** that the local platform supports inline functions; it therefore
-** only uses "inline" where "static" would also work, and uses "static"
-** in the absence of another keyword.
-*/
-#if !defined FICL_PLATFORM_INLINE
-#define FICL_PLATFORM_INLINE static
-#endif /* !defined FICL_PLATFORM_INLINE */
-
-/*
-** FICL_PLATFORM_EXTERN
-** Must be defined, should be a keyword used to declare
-** a function prototype as being a genuine prototype.
-** You should only have to fiddle with this setting if
-** you're not using an ANSI-compliant compiler, in which
-** case, good luck!
-*/
-#if !defined FICL_PLATFORM_EXTERN
-#define FICL_PLATFORM_EXTERN extern
-#endif /* !defined FICL_PLATFORM_EXTERN */
-
-
-
-/*
-** FICL_PLATFORM_BASIC_TYPES
-**
-** If not defined yet, 
-*/
-#if !defined(FICL_PLATFORM_BASIC_TYPES)
-typedef char ficlInteger8;
-typedef unsigned char ficlUnsigned8;
-typedef short ficlInteger16;
-typedef unsigned short ficlUnsigned16;
-typedef long ficlInteger32;
-typedef unsigned long ficlUnsigned32;
-
-typedef ficlInteger32 ficlInteger;
-typedef ficlUnsigned32 ficlUnsigned;
-typedef float ficlFloat;
-
-#endif /* !defined(FICL_PLATFORM_BASIC_TYPES) */
-
-
-
-
-
-
-
-/*
-** FICL_ROBUST enables bounds checking of stacks and the dictionary.
-** This will detect stack over and underflows and dictionary overflows.
-** Any exceptional condition will result in an assertion failure.
-** (As generated by the ANSI assert macro)
-** FICL_ROBUST == 1 --> stack checking in the outer interpreter
-** FICL_ROBUST == 2 also enables checking in many primitives
-*/
-
-#if !defined FICL_ROBUST
-#define FICL_ROBUST (2)
-#endif /* FICL_ROBUST */
-
-
-
-/*
-** FICL_DEFAULT_STACK_SIZE Specifies the default size (in CELLs) of
-** a new virtual machine's stacks, unless overridden at 
-** create time.
-*/
-#if !defined FICL_DEFAULT_STACK_SIZE
-#define FICL_DEFAULT_STACK_SIZE (128)
-#endif
-
-/*
-** FICL_DEFAULT_DICTIONARY_SIZE specifies the number of ficlCells to allocate
-** for the system dictionary by default. The value
-** can be overridden at startup time as well.
-*/
-#if !defined FICL_DEFAULT_DICTIONARY_SIZE
-#define FICL_DEFAULT_DICTIONARY_SIZE (12288)
-#endif
-
-/*
-** FICL_DEFAULT_ENVIRONMENT_SIZE specifies the number of cells
-** to allot for the environment-query dictionary.
-*/
-#if !defined FICL_DEFAULT_ENVIRONMENT_SIZE
-#define FICL_DEFAULT_ENVIRONMENT_SIZE (512)
-#endif
-
-/*
-** FICL_MAX_WORDLISTS specifies the maximum number of wordlists in 
-** the dictionary search order. See Forth DPANS sec 16.3.3
-** (file://dpans16.htm#16.3.3)
-*/
-#if !defined FICL_MAX_WORDLISTS
-#define FICL_MAX_WORDLISTS (16)
-#endif
-
-/*
-** FICL_MAX_PARSE_STEPS controls the size of an array in the FICL_SYSTEM structure
-** that stores pointers to parser extension functions. I would never expect to have
-** more than 8 of these, so that's the default limit. Too many of these functions
-** will probably exact a nasty performance penalty.
-*/
-#if !defined FICL_MAX_PARSE_STEPS
-#define FICL_MAX_PARSE_STEPS (8)
-#endif
-
-/*
-** Maximum number of local variables per definition.
-** This only affects the size of the locals dictionary,
-** and there's only one per entire ficlSystem, so it
-** doesn't make sense to be a piker here.
-*/
-#if (!defined(FICL_MAX_LOCALS)) && FICL_WANT_LOCALS
-#define FICL_MAX_LOCALS (64)
-#endif
-
-/*
-** The pad is a small scratch area for text manipulation. ANS Forth
-** requires it to hold at least 84 characters.
-*/
-#if !defined FICL_PAD_SIZE
-#define FICL_PAD_SIZE (256)
-#endif
-
-/* 
-** ANS Forth requires that a word's name contain {1..31} characters.
+** Revision History:
+** 
+** 15 Apr 1999 (sadler) Merged FreeBSD changes for exception wordset and
+** counted strings in ficlExec. 
+** 12 Jan 1999 (sobral) Corrected EVALUATE behavior. Now TIB has an
+** "end" field, and all words respect this. ficlExec is passed a "size"
+** of TIB, as well as vmPushTib. This size is used to calculate the "end"
+** of the string, ie, base+size. If the size is not known, pass -1.
+**
+** 10 Jan 1999 (sobral) EXCEPTION word set has been added, and existing
+** words has been modified to conform to EXCEPTION EXT word set. 
+**
+** 27 Aug 1998 (sadler) testing and corrections for LOCALS, LOCALS EXT,
+**  SEARCH / SEARCH EXT, TOOLS / TOOLS EXT. 
+**  Added .X to display in hex, PARSE and PARSE-WORD to supplement WORD,
+**  EMPTY to clear stack.
+**
+** 29 jun 1998 (sadler) added variable sized hash table support
+**  and ANS Forth optional SEARCH & SEARCH EXT word set.
+** 26 May 1998 (sadler) 
+**  FICL_PROMPT macro
+** 14 April 1998 (sadler) V1.04
+**  Ficlwin: Windows version, Skip Carter's Linux port
+** 5 March 1998 (sadler) V1.03
+**  Bug fixes -- passes John Ryan's ANS test suite "core.fr"
+**
+** 24 February 1998 (sadler) V1.02
+** -Fixed bugs in <# # #>
+** -Changed FICL_WORD so that storage for the name characters
+**  can be allocated from the dictionary as needed rather than 
+**  reserving 32 bytes in each word whether needed or not - 
+**  this saved 50% of the dictionary storage requirement.
+** -Added words in testmain for Win32 functions system,chdir,cwd,
+**  also added a word that loads and evaluates a file.
+**
+** December 1997 (sadler)
+** -Added VM_RESTART exception handling in ficlExec -- this lets words
+**  that require additional text to succeed (like :, create, variable...)
+**  recover gracefully from an empty input buffer rather than emitting
+**  an error message. Definitions can span multiple input blocks with
+**  no restrictions.
+** -Changed #include order so that <assert.h> is included in sysdep.h,
+**  and sysdep is included in all other files. This lets you define
+**  NDEBUG in sysdep.h to disable assertions if you want to.
+** -Make PC specific system dependent code conditional on _M_IX86
+**  defined so that ports can coexist in sysdep.h/sysdep.c
 */
-#if !defined FICL_NAME_LENGTH
-#define FICL_NAME_LENGTH       (31)
-#endif
 
-/*
-** Default size of hash table. For most uniform
-** performance, use a prime number!
-*/
-#if !defined FICL_HASH_SIZE
-	#define FICL_HASH_SIZE (241)
+#ifdef __cplusplus
+extern "C" {
 #endif
 
-
-/*
-** Default number of USER flags.
-*/
-#if (!defined(FICL_USER_CELLS)) && FICL_WANT_USER
-#define FICL_USER_CELLS (16)
-#endif
-
-
-
-
-
+#include "sysdep.h"
+#include <limits.h> /* UCHAR_MAX */
 
 /*
 ** Forward declarations... read on.
 */
-struct ficlWord;
-typedef struct ficlWord ficlWord;
-struct ficlVm;
-typedef struct ficlVm ficlVm;
-struct ficlDictionary;
-typedef struct ficlDictionary ficlDictionary;
-struct ficlSystem;
-typedef struct ficlSystem ficlSystem;
-struct ficlSystemInformation;
-typedef struct ficlSystemInformation ficlSystemInformation;
-struct ficlCallback;
-typedef struct ficlCallback ficlCallback;
-struct ficlCountedString;
-typedef struct ficlCountedString ficlCountedString;
-struct ficlString;
-typedef struct ficlString ficlString;
-
-
-/*
-** System dependent routines:
-** Edit the implementations in your appropriate ficlplatform/ *.c to be
-** compatible with your runtime environment.
-**
-** ficlCallbackDefaultTextOut sends a zero-terminated string to the 
-**   default output device - used for system error messages.
-**
-** ficlMalloc(), ficlRealloc() and ficlFree() have the same semantics
-**   as the functions malloc(), realloc(), and free() from the standard C library.
-*/
-FICL_PLATFORM_EXTERN void  ficlCallbackDefaultTextOut(ficlCallback *callback, char *text);
-FICL_PLATFORM_EXTERN void *ficlMalloc (size_t size);
-FICL_PLATFORM_EXTERN void  ficlFree   (void *p);
-FICL_PLATFORM_EXTERN void *ficlRealloc(void *p, size_t size);
-
-
-
-
-
+struct ficl_word;
+typedef struct ficl_word FICL_WORD;
+struct vm;
+typedef struct vm FICL_VM;
+struct ficl_dict;
+typedef struct ficl_dict FICL_DICT;
+struct ficl_system;
+typedef struct ficl_system FICL_SYSTEM;
+struct ficl_system_info;
+typedef struct ficl_system_info FICL_SYSTEM_INFO;
 
 /* 
 ** the Good Stuff starts here...
 */
-#define FICL_VERSION    "4.1.0"
-
+#define FICL_VER        "3.03"
+#define FICL_VER_MAJOR  3
+#define FICL_VER_MINOR  3
 #if !defined (FICL_PROMPT)
-#define FICL_PROMPT		"ok> "
+#define FICL_PROMPT "ok> "
 #endif
 
 /*
@@ -650,250 +254,76 @@
 #define FICL_BOOL(x) ((x) ? FICL_TRUE : FICL_FALSE)
 
 
-#if !defined FICL_IGNORE     /* Macro to silence unused param warnings */
-#define FICL_IGNORE(x) (void)x
-#endif /*  !defined FICL_IGNORE */
-
-
-
-
-#if !defined NULL
-#define NULL ((void *)0)
-#endif
-
-
-/*
-** Jiggery-pokery for the FICL_WANT_COMPATIBILITY compatibility layer.
-** Even if you're not using it, compatibility.c won't compile properly
-** unless FICL_WANT_COMPATIBILITY is turned on.  Hence, we force it to
-** always be turned on.
-*/
-#ifdef FICL_FORCE_COMPATIBILITY
-#undef FICL_WANT_COMPATIBILITY
-#define FICL_WANT_COMPATIBILITY (1)
-#endif /* FICL_FORCE_COMPATIBILITY */
-
-
-
-
-
 /*
-** 2integer structures
-*/
-#if FICL_PLATFORM_HAS_2INTEGER
-
-#define FICL_2INTEGER_SET(high, low, doublei) ((doublei) = (ficl2Integer)(((ficlUnsigned)(low)) | (((ficl2Integer)(high)) << FICL_BITS_PER_CELL)))
-#define FICL_2INTEGER_TO_2UNSIGNED(doublei) ((ficl2Unsigned)(doublei))
-
-#define FICL_2UNSIGNED_SET(high, low, doubleu) ((doubleu) = ((ficl2Unsigned)(low)) | (((ficl2Unsigned)(high)) << FICL_BITS_PER_CELL))
-#define FICL_2UNSIGNED_GET_LOW(doubleu) ((ficlUnsigned)(doubleu & ((((ficl2Integer)1) << FICL_BITS_PER_CELL) - 1)))
-#define FICL_2UNSIGNED_GET_HIGH(doubleu) ((ficlUnsigned)(doubleu >> FICL_BITS_PER_CELL))
-#define FICL_2UNSIGNED_NOT_ZERO(doubleu) ((doubleu) != 0)
-#define FICL_2UNSIGNED_TO_2INTEGER(doubleu) ((ficl2Integer)(doubleu))
-
-#define FICL_INTEGER_TO_2INTEGER(i, doublei) ((doublei) = (i))
-#define FICL_UNSIGNED_TO_2UNSIGNED(u, doubleu) ((doubleu) = (u))
-
-#define ficl2IntegerIsNegative(doublei) ((doublei) < 0)
-#define ficl2IntegerNegate(doublei)     (-(doublei))
-
-#define ficl2IntegerMultiply(x, y) (((ficl2Integer)(x)) * ((ficl2Integer)(y)))
-#define ficl2IntegerDecrement(x) (((ficl2Integer)(x)) - 1)
-
-#define ficl2UnsignedAdd(x, y) (((ficl2Unsigned)(x)) + ((ficl2Unsigned)(y)))
-#define ficl2UnsignedSubtract(x, y) (((ficl2Unsigned)(x)) - ((ficl2Unsigned)(y)))
-#define ficl2UnsignedMultiply(x, y) (((ficl2Unsigned)(x)) * ((ficl2Unsigned)(y)))
-#define ficl2UnsignedMultiplyAccumulate(u, mul, add)  (((u) * (mul)) + (add))
-#define ficl2UnsignedArithmeticShiftLeft(x)  ((x) << 1)
-#define ficl2UnsignedArithmeticShiftRight(x) ((x) >> 1)
-#define ficl2UnsignedCompare(x, y)  ficl2UnsignedSubtract(x, y)
-#define ficl2UnsignedOr(x, y) ((x) | (y))
-
-#else /* FICL_PLATFORM_HAS_2INTEGER */
-
-typedef struct
-{
-    ficlUnsigned high;
-    ficlUnsigned low;
-} ficl2Unsigned;
-
-typedef struct
-{
-    ficlInteger high;
-    ficlInteger low;
-} ficl2Integer;
-
-
-#define FICL_2INTEGER_SET(hi, lo, doublei)  { ficl2Integer x; x.low = (lo); x.high = (hi); (doublei) = x; }
-#define FICL_2INTEGER_TO_2UNSIGNED(doublei) (*(ficl2Unsigned *)(&(doublei)))
-
-
-#define FICL_2UNSIGNED_SET(hi, lo, doubleu) { ficl2Unsigned x; x.low = (lo); x.high = (hi); (doubleu) = x; }
-#define FICL_2UNSIGNED_GET_LOW(doubleu)  ((doubleu).low)
-#define FICL_2UNSIGNED_GET_HIGH(doubleu) ((doubleu).high)
-#define FICL_2UNSIGNED_NOT_ZERO(doubleu) ((doubleu).high || (doubleu).low)
-#define FICL_2UNSIGNED_TO_2INTEGER(doubleu) (*(ficl2Integer *)(&(doubleu)))
-
-#define FICL_INTEGER_TO_2INTEGER(i, doublei) { ficlInteger __x = (ficlInteger)(i); FICL_2INTEGER_SET((__x < 0) ? -1L : 0, __x, doublei) }
-#define FICL_UNSIGNED_TO_2UNSIGNED(u, doubleu) FICL_2UNSIGNED_SET(0, u, doubleu)
-
-
-FICL_PLATFORM_EXTERN int                             ficl2IntegerIsNegative(ficl2Integer x);
-FICL_PLATFORM_EXTERN ficl2Integer                    ficl2IntegerNegate(ficl2Integer x);
-
-FICL_PLATFORM_EXTERN ficl2Integer                    ficl2IntegerMultiply(ficlInteger x, ficlInteger y);
-FICL_PLATFORM_EXTERN ficl2Integer                    ficl2IntegerDecrement(ficl2Integer x);
-
-FICL_PLATFORM_EXTERN ficl2Unsigned                   ficl2UnsignedAdd(ficl2Unsigned x, ficl2Unsigned y);
-FICL_PLATFORM_EXTERN ficl2Unsigned                   ficl2UnsignedSubtract(ficl2Unsigned x, ficl2Unsigned y);
-FICL_PLATFORM_EXTERN ficl2Unsigned                   ficl2UnsignedMultiply(ficlUnsigned x, ficlUnsigned y);
-FICL_PLATFORM_EXTERN ficl2Unsigned                   ficl2UnsignedMultiplyAccumulate(ficl2Unsigned u, ficlUnsigned mul, ficlUnsigned add);
-FICL_PLATFORM_EXTERN ficl2Unsigned                   ficl2UnsignedArithmeticShiftLeft( ficl2Unsigned x );
-FICL_PLATFORM_EXTERN ficl2Unsigned                   ficl2UnsignedArithmeticShiftRight( ficl2Unsigned x );
-FICL_PLATFORM_EXTERN int                             ficl2UnsignedCompare(ficl2Unsigned x, ficl2Unsigned y);
-FICL_PLATFORM_EXTERN ficl2Unsigned                   ficl2UnsignedOr( ficl2Unsigned x, ficl2Unsigned y );
-
-#endif /* FICL_PLATFORM_HAS_2INTEGER */
-
-FICL_PLATFORM_EXTERN ficl2Integer                    ficl2IntegerAbsoluteValue(ficl2Integer x);
-
-/*
-** These structures represent the result of division.
-*/
-typedef struct
-{
-    ficl2Unsigned quotient;
-    ficlUnsigned remainder;
-} ficl2UnsignedQR;
-
-typedef struct
-{
-    ficl2Integer quotient;
-    ficlInteger remainder;
-} ficl2IntegerQR;
-
-
-#define FICL_2INTEGERQR_TO_2UNSIGNEDQR(doubleiqr) (*(ficl2UnsignedQR *)(&(doubleiqr)))
-#define FICL_2UNSIGNEDQR_TO_2INTEGERQR(doubleuqr) (*(ficl2IntegerQR *)(&(doubleuqr)))
-
-/*
-** 64 bit integer math support routines: multiply two UNS32s
-** to get a 64 bit product, & divide the product by an UNS32
-** to get an UNS32 quotient and remainder. Much easier in asm
-** on a 32 bit CPU than in C, which usually doesn't support 
-** the double length result (but it should).
-*/
-FICL_PLATFORM_EXTERN ficl2IntegerQR   ficl2IntegerDivideFloored(ficl2Integer num, ficlInteger den);
-FICL_PLATFORM_EXTERN ficl2IntegerQR   ficl2IntegerDivideSymmetric(ficl2Integer num, ficlInteger den);
-
-FICL_PLATFORM_EXTERN ficl2UnsignedQR  ficl2UnsignedDivide(ficl2Unsigned q, ficlUnsigned y);
-
-
-
-
-
-
-/*
-** A ficlCell is the main storage type. It must be large enough
+** A CELL is the main storage type. It must be large enough
 ** to contain a pointer or a scalar. In order to accommodate 
 ** 32 bit and 64 bit processors, use abstract types for int, 
 ** unsigned, and float.
-**
-** A ficlUnsigned, ficlInteger, and ficlFloat *MUST* be the same
-** size as a "void *" on the target system.  (Sorry, but that's
-** a design constraint of FORTH.)
 */
-typedef union ficlCell
+typedef union _cell
 {
-    ficlInteger i;
-    ficlUnsigned u;
+    FICL_INT i;
+    FICL_UNS u;
 #if (FICL_WANT_FLOAT)
-    ficlFloat f;
+    FICL_FLOAT f;
 #endif
     void *p;
     void (*fn)(void);
-} ficlCell;
-
-
-#define FICL_BITS_PER_CELL  (sizeof(ficlCell) * 8)
+} CELL;
 
 /*
-** FICL_PLATFORM_ALIGNMENT is the number of bytes to which
-** the dictionary pointer address must be aligned. This value
-** is usually either 2 or 4, depending on the memory architecture
-** of the target system; 4 is safe on any 16 or 32 bit
-** machine.  8 would be appropriate for a 64 bit machine.
-*/
-#if !defined FICL_PLATFORM_ALIGNMENT
-#define FICL_PLATFORM_ALIGNMENT (4)
-#endif
-
-
-/*
-** FICL_LVALUE_TO_CELL does a little pointer trickery to cast any CELL sized
+** LVALUEtoCELL does a little pointer trickery to cast any CELL sized
 ** lvalue (informal definition: an expression whose result has an
 ** address) to CELL. Remember that constants and casts are NOT
 ** themselves lvalues!
 */
-#define FICL_LVALUE_TO_CELL(v) (*(ficlCell *)&v)
+#define LVALUEtoCELL(v) (*(CELL *)&v)
 
 /*
 ** PTRtoCELL is a cast through void * intended to satisfy the
 ** most outrageously pedantic compiler... (I won't mention 
 ** its name)
 */
-#define FICL_POINTER_TO_CELL(p)    ((ficlCell *)(void *)p)
+#define PTRtoCELL (CELL *)(void *)
+#define PTRtoSTRING (FICL_STRING *)(void *)
 
 /*
-** FORTH defines the "counted string" data type.  This is
-** a "Pascal-style" string, where the first byte is an unsigned
-** count of characters, followed by the characters themselves.
-** The Ficl structure for this is ficlCountedString.
-** Ficl also often zero-terminates them so that they work with the
-** usual C runtime library string functions... strlen(), strcmp(),
-** and the like.  (Belt & suspenders?  You decide.)
-**
-** The problem is, this limits strings to 255 characters, which
-** can be a bit constricting to us wordy types.  So FORTH only
-** uses counted strings for backwards compatibility, and all new
-** words are "c-addr u" style, where the address and length are
-** stored separately, and the length is a full unsigned "cell" size.
-** (For more on this trend, see DPANS94 section A.3.1.3.4.)
-** Ficl represents this with the ficlString structure.  Note that
-** these are frequently *not* zero-terminated!  Don't depend on
-** it--that way lies madness.
+** Strings in FICL are stored in Pascal style - with a count
+** preceding the text. We'll also NULL-terminate them so that 
+** they work with the usual C lib string functions. (Belt &
+** suspenders? You decide.)
+** STRINGINFO hides the implementation with a couple of
+** macros for use in internal routines.
 */
 
-struct ficlCountedString
+typedef unsigned char FICL_COUNT;
+#define FICL_STRING_MAX UCHAR_MAX
+typedef struct _ficl_string
 {
-    ficlUnsigned8 length;
+    FICL_COUNT count;
     char text[1];
-};
-
-#define FICL_COUNTED_STRING_GET_LENGTH(cs)  ((cs).length)
-#define FICL_COUNTED_STRING_GET_POINTER(cs) ((cs).text)
+} FICL_STRING;
 
-#define FICL_COUNTED_STRING_MAX  (256)
-#define FICL_POINTER_TO_COUNTED_STRING(p)   ((ficlCountedString *)(void *)p)
-
-struct ficlString
+typedef struct 
 {
-    ficlUnsigned length;
-    char *text;
-};
-
-
-#define FICL_STRING_GET_LENGTH(fs)       ((fs).length)
-#define FICL_STRING_GET_POINTER(fs)      ((fs).text)
-#define FICL_STRING_SET_LENGTH(fs, l)    ((fs).length = (ficlUnsigned)(l))
-#define FICL_STRING_SET_POINTER(fs, p)   ((fs).text = (char *)(p))
-#define FICL_STRING_SET_FROM_COUNTED_STRING(string, countedstring) \
-        {(string).text = (countedstring).text; (string).length = (countedstring).length;}
+    FICL_UNS count;
+    char *cp;
+} STRINGINFO;
+
+#define SI_COUNT(si) (si.count)
+#define SI_PTR(si)   (si.cp)
+#define SI_SETLEN(si, len) (si.count = (FICL_UNS)(len))
+#define SI_SETPTR(si, ptr) (si.cp = (char *)(ptr))
 /* 
-** Init a FICL_STRING from a pointer to a zero-terminated string
+** Init a STRINGINFO from a pointer to NULL-terminated string
 */
-#define FICL_STRING_SET_FROM_CSTRING(string, cstring) \
-        {(string).text = (cstring); (string).length = strlen(cstring);}
+#define SI_PSZ(si, psz) \
+            {si.cp = psz; si.count = (FICL_COUNT)strlen(psz);}
+/* 
+** Init a STRINGINFO from a pointer to FICL_STRING
+*/
+#define SI_PFS(si, pfs) \
+            {si.cp = pfs->text; si.count = pfs->count;}
 
 /*
 ** Ficl uses this little structure to hold the address of 
@@ -907,14 +337,14 @@
 ** null-terminated string aware functions find most easy to deal
 ** with.
 ** Notice, though, that nobody really uses this except evaluate,
-** so it might just be moved to ficlVm instead. (sobral)
+** so it might just be moved to FICL_VM instead. (sobral)
 */
 typedef struct
 {
-    ficlInteger index;
+    FICL_INT index;
     char *end;
-    char *text;
-} ficlTIB;
+    char *cp;
+} TIB;
 
 
 /*

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506291423.t5TENL8k010321>