embedded systems developers tools, cross compilers
  Home  |   SwiftX Archive  |   SwiftForth Archive  |

Re: Conditional compilation

From: Ron Oliver <roliver_at_openesque.com>
Date: Mon, 17 Nov 2003 16:08:08 -0500 (EST)

On Mon, 17 Nov 2003, David Graham wrote:

> I am using SwiftX 3.1.13 for the HC12. Why would the following [IF]
> statements generate "[IF] Stack Empty" messages:
>
> -1 EQU BARRVER
> BarrVer [IF] 1 [THEN]
> BarrVer 0= [IF] 0 [THEN]

Are these instances within a colon definition; e.g.:

-1 EQU BarrVer

: ?BARRVER ( -- n )
   BarrVer [IF] 1 [THEN]
   ( ... )
   BarrVer 0= [IF] 0 [THEN] ;

In the above example, BarrVer will be compiled as a literal, so [IF]
doesn't have a value to operate on at compile time. You'd need to
write this as shown below to get what you want:

: ?BARRVER ( -- n )
   [ BarrVer ] [IF] 1 [THEN]
   ( ... )
   [ BarrVer 0= ] [IF] 0 [THEN] ;

-- 
Ron Oliver <roliver_at_openesque.com>
----------------------------------------------------------------------
swiftx_at_forth.com          The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe" to swiftx-request_at_forth.com
For list command help, send subject "help" to swiftx-request_at_forth.com
Message archives are located at http://www.forth.com/archive/swiftx
----------------------------------------------------------------------
This list is a forum for SwiftX users.  For product support and bug 
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Mon Nov 17 2003 - 13:14:29 PST

This archive was generated by hypermail 2.2.0 : Fri Dec 05 2008 - 03:04:22 PST