![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

Thanks for the feedback Matt. I appreciate you taking the time to review my
code.
A couple of explanations:
> First it looks like you may be ignoring the void returned by
> DrawInsert.
Although Rick explained void, it hasn't always been that way (See the function
Sleep for SF "legacy" handling of void).
> Second, the DUP OF words ENDOF structure is interesting.
A simple technique I use to "clean up" the selector in the case statement
"default" behavior. This allows altering the stack balance without keeping
track of the selector. Although the phrase DUP OF TRUE ENDOF could be
easily written as SWAP TRUE, I prefer the DUP OF ENDOF technique if the stack
changes get any more complex.
> Third, the IF ELSE THEN in the DL_BEGINDRAG action is not stack
> balanced,
Yep, things got messy! Actually, the code never made it this far (I had a lot
of debug code in while I was chasing this problem).
> is doomed to stack over or underflow ( I suspect over).
Right again - almost. It would overflow if this was a traditional FORTH
program. What makes things tricky in Windows is (jump in and clarify Rick) that
for every windows message, a stack frame is created and then destroyed after the
message is processed. Any minor Forth stack problems disappear. When testing,
one has to verify stack correctness for each message since a stack imbalance is
not cumulative. For example, try adding
100 0 DO I LOOP 0 ( res ) to the end of a message. The stack frame mechanism
seems much less tolerant to underflows, only a couple (Rick?) of words.
> I hope this helps.
>
> Matt
>
I've posted a (working) Drag Listbox example to the SF FAQ at:
http://www.neverslow.com/cgi-bin/swiftforth?file=132
Again, thanks for your help,
Mike
Received on Mon Nov 06 2000 - 16:34:02 PST
This archive was generated by hypermail 2.2.0 : Thu Nov 20 2008 - 03:04:28 PST