[ColorForth] Question regarding if
- Subject: [ColorForth] Question regarding if
- From: Kristopher Johnson <kristopher_d_johnson@xxxxxxxxx>
- Date: Fri, 12 Jul 2002 07:39:01 -0700 (PDT)
The ? (question-mark) word will test the top-of-stack and set CPU flags.
So you may be able to write your word like
: tst ? if 1 ; then 2 ;
(I can't test this myself.)
-- Kris
--- Alex Thiel <alex.lists@xxxxxxxxxx> wrote:
> Hello,
>
> I want to write a word that test the TOS for a non-zero value. I have tried
>
> : tst if 1 ; then 2 ;
> : foo 0 tst 1 tst ;
>
> Execution of foo leaves 0 2 1 2 on the stack, i.e. pushing a constant does
> not
> seem to affect the flags. Is this expected behavior?
>
> As a workaround I do
> : tst 0 or if 1 ; then 2 ;
>
> Does anyone have a better idea?
>
> Cheers,
>
> Alex
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
------------------------
To Unsubscribe from this list, send mail to Mdaemon@xxxxxxxxxxxxxxxxxx with:
unsubscribe ColorForth
as the first and only line within the message body
Problems - List-Admin@xxxxxxxxxxxxxxxxxx
Main ColorForth site - http://www.colorforth.com
Wiki page http://kristopherjohnson.net/wiki/ColorForth
ColorForth index http://www.users.qwest.net/~loveall/c4index.htm