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

SwiftForth PARSE-WORD

From: Bee <200309_at_scshop.com>
Date: Mon, 28 May 2007 20:38:00 -0700

The word PARSE-WORD does not exist in SwiftForth and the pharse:

BL WORD COUNT POSTPONE SLITERAL

fails because WORD moves a string to HERE and then SLITERAL
comes along and clobbers it.

And BL PARSE POSTPONE SLITERAL is not useful because it does not
skip leading delimiters.

So... I wrote a PARSE-WORD to move the string to a temporary buffer
and then call SLITERAL.

[DEFINED] POCKET 0= [IF] \ defined in swiftforth
CREATE POCKET 256 CHARS ALLOT \ for systems without POCKET
[THEN]

: PARSE-WORD ( 'ccc' -- ca u )
   BL WORD COUNT >R POCKET R@ CHARS MOVE POCKET R> ;

Is there a word like PARSE-WORD that already exists in SwiftForth?

I also wrote PARSE-WORD in terms of PARSE

: PARSE-WORD ( 'ccc' -- ca u ) 0 BEGIN DROP BL PARSE ?DUP UNTIL ;

--
Bill Muench
Santa Cruz, California
----------------------------------------------------------------------
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 Mon May 28 2007 - 20:39:42 PDT

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