It does not *need* to be inside a class, it just would be much cleaner.
The problem is the callback for the abort procedure needs to be set
after a print DC is set. This would be buried a bit in the code I
omitted for clarity. To work around this, I would define a vector
VARIABLE which would be EXECUTEd inside the class. This vector would be
set, after I instantiate the class object, to a simple non-class
callback.
I was hoping some derivative of [MEMBER] CATCH-MEMBER routines you
posted 7-10-2000
CLASS FOO
: MYWORD -99 THROW ;
: TEST [MEMBER] MYWORD CATCH-MEMBER ;
END-CLASS
Make sense?!?
Mike
-----Original Message-----
From: sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com]On Behalf
Of Rick VanNorman
Sent: Friday, March 30, 2001 3:47 PM
To: sftalk_at_forth.com
Subject: [sftalk] Re: Callback in a Class
The short answer is that you cannot define one in the class
itself. The definition of CB: is not part of the swoop compiler.
Do you really need it to be defined *in* the class?
Rick
*********** REPLY SEPARATOR ***********
On 3/30/2001 at 3:18 PM Mike Ghan wrote:
>What is the proper (if any) way to define a callback inside of a CLASS?
>
>CLASS PRT-FOO
>
> VARIABLE ABORT-PRINT?
>
> \ Classic Printer Abort Procedure
> :NONAME ( hDCprt error -- flag ) \ True = Continue
> 2DROP ( hDC error )
> BEGIN WINMSG 0 0 0 PM_REMOVE :: PeekMessage
> WHILE DISPATCH
> REPEAT ABORT-PRINT? @ NOT ;
> 2 CB: ABORTPROC
>
> : SET-ABORT-PROC
> PRT-DC ABORTPROC :: SetAbortProc DROP ;
>
>END-CLASS
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/sftalk -- check them out!
Received on Fri Mar 30 2001 - 16:56:08 PST
Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!
This archive was generated 09-Feb-2012. Archive updated nightly.