[comp.sys.mac] article about jGNEFilter in Mac

kkim@uiucdcsb.cs.uiuc.edu (08/19/87)

  i tried to e-mail him the following only to fail.  could you (jwhitnel) 
please post/send your e-mail address?  my system could not recognize 'csib'.

0.  thanks for your helpful comments.

1.  what c compiler are you using here? (lightspeec, mpw, aztec, etc).
also, are "pascal Boolean myGetNextEvent" and "CallPascalW" available in some
specific C compiler only OR are they available in most C compilers in 
general?

2.  you did not use any assembly language.  do you think that you can patch
a trap without any assembly language?  somebody said that we need it a 
little in general to patch a trap?

3.  you did not mention how to put the patch on the application heap.  
could you pleae explain it a little more?  it seems that we need to
create a CODE resource, isn't it?

4.  some procedure/variable names used are defined externally:

    myGetNextEvent in the initialization code, and
    oldGetNextEvent in the patch itself.
    
i want to know how to make externally defined procedure names available
in a procedure/function.

5. i can understand where initialization/termination codes should be 
placed within a Desk Acc.  However, i cannot imagine how / where to put
the patch itself ?

OpenRoutine of Desk Acc: /* initlization code */
>     oldGetNextEvent = NGetTrapAddr( GNE_TRAP );
>     NSetTrapAddr( myGetNextEvent );
> 
CloseRoutine of Desk Acc: /* termination code. */
>      SetTrapAddr( GNE_TRAP, oldGetNextEvent );

???????? how / where to put the following code??????

> /* This is the patch itself, parameters must match GetNextEvent */
> pascal Boolean myGetNextEvent( event, mask )
> EventRecord *event;
> int mask; {
>     Boolean retCode;
> 
>     /* First call real GetNextEvent to get the event.  CallPascalW calls
>     ** indirectly a pascal function from C.  Your glue may differ here
>     */
>     retCode = CallPascalW( event, mask, oldGetNextEvent );
>     if ( retCode )
>     {
> 	/* We have an event, so preprocess it */
>     }
> 
>     return( retCode );
> }
> 
> Jerry Whitnell
> Communication Solutions, Inc. 

Kyongsok KIM

Dept. of Computer Science; Univ. of Illinois at Urbana-Champaign

arpanet/csnet: kkim@b.cs.uiuc.edu
usenet/uucp  : {seismo, pur-ee, ihnp4}!uiucdcs!kkim

kkim@uiucdcsb.cs.uiuc.edu (08/21/87)

  everybody is welcome to make any comments about my previous response
(actually questions).  thanks in advance.

k kim