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

Re: How to make 2Value?

From: Rick VanNorman <rick_at_neverslow.com>
Date: Wed, 7 Feb 2007 08:48:06 -0600

Charles,

Your solution works -- but not if you compile a DLL using it. The correct
answer compiles the literal of the XT returned by ' and at runtime executes
>BODY to guarantee that the address referenced is correct.

Try this:

: 2TO ( a b "name" -- )
   ' STATE @ IF
         POSTPONE LITERAL
         POSTPONE >BODY
         POSTPONE 2!
   ELSE
>BODY 2!
   THEN ; IMMEDIATE

On 2/7/07, Charles Melice <3d_at_forthcad.com> wrote:
>
> Now, the unified, "state-smart" definition :
>
> : 2TO ( a b "name" -- )
> ' >body
> state @ IF
> postpone literal
> postpone 2!
> ELSE
> 2!
> THEN ; immediate
>
----------------------------------------------------------------------
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 - 06:48:51 PST

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