Re: (F.)

From: Rick VanNorman <rvn_at_forth.com>
Date: Fri, 24 Sep 1999 12:20:10 -0700

Forwarded from Richard Rhemrev <RRhemrev_at_research.calcedar.com>

*********** REPLY SEPARATOR ***********

>Hello,
>
>I seem to be having some problem with (F.) in a system callback.
>Here is an example I created that displays this problem. First I made a
>copy of winapp.f. At the bottom of this file I added this test word.
>
>: TEST ( -) 4 PI (F.) 2DROP ; \ this does nothing
>
>I then inserted this word at this point in the WinApp.f program.
>
>[SWITCH AppCommands DROP ( cmd -- )
> M_EXIT RUNS APP-EXIT
> M_ABOUT RUNS TEST \ AboutApp
>SWITCH]
>
>Then I load fpmath.f and winapp.f and run AppStart.
>When you select the "About" menu item an error occurs.
>Why is this?
>
>Regards, Richard Rhemrev

The problem is that the numeric data processor (ndp) stack is not
initialized automatically in a callback. Since most folks don't
use floating point math in callbacks, it saves execution time not
to do it unless you need to.

The simplest solution is to use the following for the callback definition

:NONAME ( -- res )
    [DEFINED] NUMERICS [IF] #NS FSTACK [THEN]
    MSG SwitchMsg ; 4 CB: GlWindowProc

(taken from code by Charles Melice).

Rick

.
Received on Fri Sep 24 1999 - 12:20:10 PDT


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 08-Feb-2012. Archive updated nightly.