( Title: Quick and Dirty Execution Arrays File: qdexeca-pfe.fs Author: David N. Williams License: LGPL Version: 0.6.3 Last revision: October 3, 2004 ) \ Copyright (C) 1996, 2001, 2002 David N. Williams ( This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or at your option any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. Please see the file POLITENESS included with this distribution. This code modifies the M680x0 ^Forth, September 22, 1996, version of qdexeca.fs to work with pfe. ) loadm execution variable pdepth : { ( -- ) depth pdepth ! ; : {{ ( -- ) { ; : }# ( -- n ) depth pdepth @ - ; : }}# ( -- n ) }# ; : }create-execs ( "name" xt_0 xt_1 ... xt_n-1 -- ) \ does: ( i*x i -- j*x ) ( Define a one-dimensional array of execution tokens. The data field consists of xt_0 xt_1 ... xt_n-1. At run time, the defined word fetches the i-th execution token and executes it. ) create-exec postpone (i-exec) }# ( n) here swap ( first n) cells dup allot over + -1 cells + ( first last) DO i ! -1 cells +LOOP ; : }}create-execs ( "name" xt_00 xt_01 ... xt_[n-1][n-1] -- ) \ does: ( i*x i j -- j*x ) ( Define a square array of execution tokens. The data field consists of dim xt_00 xt_01 ... xt_[n-1][n-1]. At run time, the defined word fetches the ij-th execution token and executes it. ) create-exec postpone (ij-exec) }}# ( n^2) dup isqrt ( n) , ( n^2) here swap ( first n^2) cells dup allot over + -1 cells + ( first last) DO i ! -1 cells +LOOP ; 0 [IF] \ Test : .1 1 . ; : .2 2 . ; : .3 3 . ; : .4 4 . ; { ' .1 ' .2 ' .3 ' .4 }create-execs dots cr .( Enter 0, 1, 2, or 3 followed by "dots".) {{ ' .1 ' .2 ' .3 ' .4 }}create-execs 2x2dots cr .( Or enter 0 or 1, another 0 or 1, followed by "2x2dots".) [THEN]