[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



Hi,
I use MCL 2.0b1p3 on a Mac II fx under System 7.0.
I am porting an application developed under MCL 1.3.2 which made use
of _postevent traps:

(defparameter *my-event-number* 12)
(_PostEvent :check-error :A0 *my-event-number* :D0 1 :D0))

This used to work under MCL 1.3.2.  Now, with MCL 2.0b1p3:

? (#_postevent *my-event-number* 123)
> Error: Argument 12 is not of type macptr.
> While executing: ccl::%register-trap
> Type Command-. to abort.

Then I tried this:

? (%stack-block ((e-n-ptr 2))
  (%put-word e-n-ptr *my-event-number* 0)
  (#_postevent e-n-ptr 123))
0

This seems to work, but the Eventrecord.What field of
*current-event* holds a strange value, probably related to the
address in stack of e-n-ptr (see full trancript below).

BTW, I suspect that some details have changed from System 6 to
System 7, as event code 15 (which used to be application defined)
now is fired when I switch from MCL to Finder and viceversa;
unfortunately, I still haven't got a copy of Inside Macintosh for
System 7 ...

Any help ?  Thanks.

---------------------------------------------------------------------
----

Welcome to Macintosh Common Lisp Version 2.0b1p3!
? (setf *autoload-traps* t)
t
? (defparameter *my-event-number* 12)
*my-event-number*
? (defun wait-event ()
    (let ((what (rref *current-event* Eventrecord.what)))
      (unless (< what 12)                 ; application defined
        (format t "Event code = ~d~%" what)))
    nil)
wait-event
? (setf *eventhook* #'wait-event)
#<Compiled-function wait-event #x445806>
? (%stack-block ((e-n-ptr 2))
    (%put-word e-n-ptr *my-event-number* 0)
    (#_postevent e-n-ptr 123))
0
Event code = 10312
? (%stack-block ((e-n-ptr 2))
    (%put-word e-n-ptr 13 0)         ; changing the event code ...
    (#_postevent e-n-ptr 123))
0
Event code = 10312                   ; ... this does not change.
? (%stack-block ((dummy 2)           ; changing the address of
e-n-ptr ...
                 (e-n-ptr 2))
    (declare (ignore dummy))
    (%put-word e-n-ptr *my-event-number* 0)
    (#_postevent e-n-ptr 123))
0
Event code = 10280                   ; ... this changes!

-----------------------------------------------------------
Luigi Sarti                              tel: +39 10 308883
Istituto per le Tecnologie Didattiche               3621108
Consiglio Nazionale delle Ricerche                   302574
via all'Opera Pia, 11                    fax: +39 10 310466
16145  GENOVA - ITALY       e-mail: sarti@itd.itd.ge.cnr.it
-----------------------------------------------------------