home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / lisp / mcl / 1331 < prev    next >
Encoding:
Text File  |  1992-08-27  |  2.6 KB  |  71 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!usc!elroy.jpl.nasa.gov!ames!data.nas.nasa.gov!taligent!apple!cambridge.apple.com!dkozak@db.cray.com
  2. From: dkozak@db.cray.com (Darryn Kozak)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: register-trap
  5. Message-ID: <9208272204.AA25373@db.cray.com>
  6. Date: 27 Aug 92 22:04:26 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 59
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10. Original-To: info-mcl@cambridge.apple.com
  11.  
  12.  
  13.    I have some questions regarding the definition of fsopen below.  
  14.    It is from the MCL 2.0f library/interface.lisp file, the file that 
  15.    defines "not in ROM" toolbox and os routines from Inside Macintosh".
  16.    In particular I'm interested in the call to ccl:register-trap.  Acording
  17.    to Inside Mac. Volume VI, _HFSDispatch is trap #xA060.  ":a0 pb" 
  18.    indicates that pb (the address of a :hparamblockrec) is put in register 
  19.    :a0 as an argument to the call.  ":d0 26" indicates that 26 is to be put
  20.    into register :d0.  The 26 is the selector (hex 1A), which, according to 
  21.    Inside Mac again, selects one of the three routines OpenDF, PBHOpenDF or
  22.    PBOpenDF. And "(:signed-integer :d0)" indicate the type of return value
  23.    and where it will come from.  My questions now are:
  24.  
  25.    1. How do you know what registers to use for arg's?
  26.  
  27.    2. How do you know what registers to use for the selector?
  28.  
  29.    3. How do you know what registers to use for return values?
  30.  
  31.    4. Which routine will be called: OpenDF, PBHOpenDF or
  32.       PBOpenDF? (and why?)
  33.  
  34.    5. Why is only one arg. (pb) supplied when OpenDF takes 3,
  35.       PBOpenDF takes 2, and PBHOpenDF takes 2.
  36.  
  37.    6. What is the error code -50?  (I assume it means the trap call
  38.       is not available.)
  39.  
  40.    7. Is this stuff documented somewhere?
  41.  
  42.  
  43.    ; Returns two values instead of taking a var parameter
  44.    ; 1) The refnum or NIL if error
  45.    ; 2) The error code.
  46.    (defun fsopen (filename vrefnum)
  47.      (with-pstring-arg (namep filename)
  48.        (ccl:rlet ((pb :hparamblockrec))
  49.      (setf (ccl:rref pb :hparamblockrec.ionameptr) namep
  50.            (ccl:rref pb :hparamblockrec.iovrefnum) vrefnum
  51.            (ccl:rref pb :hparamblockrec.ioMisc) (ccl:%null-ptr)
  52.            (ccl:rref pb :hparamblockrec.ioPermssn) 0
  53.            (ccl:rref pb :hparamblockrec.ioVersNum) 0)
  54.      (let* ((err (ccl:register-trap #xA060 :a0 pb :d0 26 (:signed-integer :d0)))
  55.         refnum)
  56.        (if (eql err -50)
  57.          (setq err (#_Open pb)))
  58.        (setq refnum (ccl:rref pb :hparamblockrec.iorefnum))
  59.        (values (unless (eql refnum -1) refnum) err)))))
  60.  
  61.  
  62.        Thanks,
  63.  
  64.        dk
  65.  
  66.    --
  67.        Darryn J Kozak            Cray Research Park
  68.        dkozak@cray.com            655E Lone Oak Drive
  69.        (612) 683-3610            Eagan, MN  55121
  70.        FAX (612) 683-3099        USA
  71.