[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: trap return result wierdness
- To: email@example.com (Tim Moore)
- Subject: Re: trap return result wierdness
- From: firstname.lastname@example.org (Bill St. Clair)
- Date: Fri, 4 Sep 1992 17:54:15 -0500
- Cc: info-mcl
>I'm new to MCL and somewhat new to Macintosh programming, so bear with me.
>I was surprised by this result:
>? (%stack-block ((response 4)) (#_gestalt #$gestaltEasyAccessAttr
>I was expecting a negative error number. Do I need to somehow coerce
>the result of the trap into a negative word?
This is a bug in the DEFTRAP for _Gestalt. Below is the fixed definition.
It used to say %get-word instead of %get-signed-word:
(deftrap _gestalt ((selector :ostype) (response (:pointer :signed-long)))
(:no-trap (ccl::%stack-block ((ret 8))
(%put-ptr response (%get-ptr ret 4))
(%get-signed-word ret 2))))
The definition for _replacegestalt needs to be changed in the same way.
If you make this change to the file "ccl:interfaces;gestaltequ.lisp",
remember to (reindex-interfaces).
Probably, noone ever noticed this because all of our code just
says (eql 0 (#_Gestalt ...)).
>Also, is there higher level construct than %stack-block for allocating
>a word or longword of storage?
It's usually done with RLET, which macroexpands into %stack-block:
(rlet ((response :long))
(#_gestalt #$gestaltEasyAccessAttr response))