[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: SVSPIRE@SANDIA.GOV
- Subject: Re: PGetAppleTalkInfo
- From: CAMPER@AppleLink.Apple.COM (Camper, Dan)
- Date: 14 Apr 94 17:41 GMT
- Cc: INFO-MCL@CAMBRIDGE.APPLE.COM
> Date: Thu, 7 Apr 1994 17:10:56 -0600 (MDT)
> From: Shannon V Spires <email@example.com>
> Subject: How do you call pgetappletalkinfo?
> Ok guys and gals, I'm at the end of my rope here.
> I'm trying to create a globally-unique symbol name;
> global across a network of Macs running MCL. Sort
> of a global-gensym, if you will. One way to do this
> is to just concatenating a local gensym onto some unique
> identifier for my local Macintosh. The problem is
> getting that unique identifier for my local Mac. The
> way I'm trying to do this is to get the Appletalk
> address of this machine, which is always unique. So
> I'm trying to call pgetappletalkinfo to get the
> Appletalk address of this machine. Here's the code:
> ; This deftrap definition is from the Appletalk.lisp
> ; interfaces file (it's Not in ROM).
> (deftrap _pgetappletalkinfo ((thepbptr (:pointer :mppparamblock)) (async
> (:no-trap :signed-integer)
> (:no-trap #x0))
> ; Here's my code:
> (defun get-my-appletalk-address ()
> "Returns my appletalk address."
> (let ((address nil))
> (rlet ((pb :MPPParamBlock
> :version 1
> :laLength 6
> :linkAddr (%null-ptr)
> :zoneName (%null-ptr)))
> (#_PGetAppleTalkInfo pb nil)
> (setq address (pref pb MPPParamBlock.ourAddr))
> But when I try to eval the definition, I get this error:
> > Error: value 0 is not of the expected type SEQUENCE.
> > While executing: EXPAND-TRAP
> > Type Command-. to abort.
> We haven't even gotten to the point of actually calling
> the function. If I ever do get there, what goes in the
> csCode field of the MPPParamBlock? IM says "PGetAppleTalkInfo"
> and then refuses to define what this constant is.
> Any clues anybody?
I couldn't get PGetAppleTalkInfo to work, but there may be another way: Use
the value returned from #'machine-instance (which will be either the Mac name
or the User name) in combination with the zone name. You can use the following
function to pull the zone name:
(defun get-my-zone ()
(let ((zone-name "")
(%stack-block ((zone-buffer 33))
(rlet ((xpb :XPPParamBlock
(%put-byte zone-buffer 0)
(rarset xpb 0 :XPPParamBlock.zipInfoField 0)
(rarset xpb 0 :XPPParamBlock.zipInfoField 1)
(#_GetMyZone xpb #$false)
; GetMyZone seems to be async no matter what, so loop
(loop while (= (pref xpb :XPPParamBlock.ioResult) 1))
(setf result (pref xpb :XPPParamBlock.ioResult))
(cond ((= result #$noErr)
(setf zone-name (%get-string zone-buffer)))
((= result #$noBridgeErr)
(setf zone-name "*"))
(setf zone-name "Uknown Zone")))))
Hope this helps!