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

RE : SwiftForth PARSE-WORD

From: Charles Melice <3d_at_forthcad.com>
Date: Tue, 29 May 2007 09:07:49 +0200

I remember there is an ANS proposal to have PARSE-NAME :

    : PARSE-NAME ( "name" -- c-addr u ) \ CORE-EXT
         /SOURCE OVER >R BL SKIP DROP R> - >IN +!
         /SOURCE DROP 'TIB @ - IN> ! BL PARSE DUP IN> CELL+ ! ;

Charles

-----Message d'origine-----
De : sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com] De la part de
Bee
Envoyé : mardi 29 mai 2007 5:38
À : sftalk_at_forth.com
Objet : [sftalk] SwiftForth PARSE-WORD

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
----------------------------------------------------------------------
----------------------------------------------------------------------
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 Tue May 29 2007 - 00:08:16 PDT

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