programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Re: new to customizing forth....

From: Jeff <jma_at_mfire.com>
Date: Sat, 29 Nov 2003 08:47:19 -0700

Hello Roger,

Saturday, November 29, 2003, 8:15:40 AM, you wrote:

RL> thanks jeff, it worked, except when the values list is split into different
RL> lines.... would it have to do with the way the PARSE parses until it finds
RL> spaces(BL)? can it be programmed to reckognize carriage returns as
RL> delimeters too?

Yes, but I hate reworking the Forth interpreter. Not that it can't be
done easily, but I find whenever I go about to do this, there was a
much easier way to do what I wanted that presented itself later.

RL> on the side i tried to make another word like it called VARIABLES:

RL> : variables: ( -- )
RL> begin bl parse
RL> 2dup s" }" compare while
RL> variable
RL> repeat 2drop ;

It doesn't work because of the way the interpreter works. PARSE will
read in the next name to be created, and when VARIABLE attempts to it
will fail (because the name was already PARSE'd).

You can get around this by saving and restoring the >IN variable
(which keeps track of where in the input stream you are). Just
modifying you code a little:

: VARIABLES: ( -- )
   BEGIN >IN @ BL PARSE
      2DUP S" }" COMPARE WHILE
         ROT >IN ! VARIABLE
   REPEAT 3DROP ;

--
Best regards,
 Jeff                            mailto:jma_at_mfire.com
----------------------------------------------------------------------
sftalk_at_forth.com      The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users.  For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Sat Nov 29 2003 - 07:55:05 PST

This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 03:04:34 PST