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

How to make 2Value?

From: Morten A. Steien <morten.steien_at_chello.no>
Date: Wed, 07 Feb 2007 13:59:20 +0100

I would like to make a double version of VALUE and TO.

Usage:
> 1 2 2Value Test
Test will now return 1 2 on the stack.
> 3 4 2To Test
Test will now return 3 4 on the stack.
> : BB 5 6 2To Test ;
> BB
Test will now return 5 6 on the stack.

The last example is not working.
Currently I have done this:

: 2Value ( n n <name> -- | -- n n )
   Create , , Does> Dup Cell + @ Swap @ ;

: 2To! ( n n Add -- )
   Swap Over ! Cell + ! ;

: 2To' ( n n <name> -- )
   ' >Body Postpone Literal Postpone 2To! ; Immediate

: 2To ( n n <name> -- )
   ' >Body 2To! ;

2To works in interperetive mode
2To' works inside : definitions

My problem is that I am not able to combine 2To and 2To' in one word
that will work both outside and inside of : definitions.
Can somebody help me understand what to do? (And preferably why :)

--
Regards,
Morten A. Steien
----------------------------------------------------------------------
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 Wed Feb 07 2007 - 04:58:15 PST

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