home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / lisp / mcl / 1339 < prev    next >
Encoding:
Internet Message Format  |  1992-08-29  |  3.2 KB

  1. Path: sparky!uunet!sun-barr!ames!data.nas.nasa.gov!taligent!apple!cambridge.apple.com!jwbaxter@halcyon.halcyon.com
  2. From: jwbaxter@halcyon.halcyon.com
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re: register-trap
  5. Message-ID: <199208280837.AA18100@halcyon.com>
  6. Date: 28 Aug 92 08:38:03 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 52
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10. Original-To: dkozak@db.cray.com(Darryn Kozak)
  11. Original-Cc: info-mcl@cambridge.apple.com
  12.  
  13. >   I have some questions regarding the definition of fsopen below.  
  14. >   1. How do you know what registers to use for arg's?
  15. >   2. How do you know what registers to use for the selector?
  16. >   3. How do you know what registers to use for return values?
  17.   In the case of this trap (_HFSDispatch), as near as I can tell from New
  18. Inside Macintosh: Files, you "just know".  But...this is a very common
  19. pattern:  A0 containing a pointer to a parameter block, a selector (when
  20. used) in D0, and D0 being set to an error code result.  (The older Inside
  21. Macs were a little more explicit.  If you have to construct one of these
  22. and don't "know", copy another one.
  23. >
  24. >   4. Which routine will be called: OpenDF, PBHOpenDF or
  25. >      PBOpenDF? (and why?)
  26. PBHOpenDF.  OpenDF doesn't exist.  (That is, OpenDF is a creature of
  27. higher-level languages, which take their parameters, stuff them into a
  28. (surprise) parameter block, and make the PB... call (and then do the right
  29. thing with the return value, which sometimes is to stash it somewhere, and
  30. sometimes is simply to return it (by moving it onto the stack in Pascal,
  31. and perhaps, but not here, moving it to a different register in C). 
  32. But...there is no OpenDF routine in the ROM to call.  NIM: Files makes no
  33. mention of PBOpenDF, by the way (consistent with the rest NIM: Files, which
  34. doesn't cover MFS volumes).  Afterthought:  it seems to me that the
  35. difference between PBHOpenDF and PBOpenDF, if there is a difference, is
  36. flagged in the "other bit" (10 or 9) of the trap word.  Don't bet the farm
  37. on that one.
  38.  
  39. >   5. Why is only one arg. (pb) supplied when OpenDF takes 3,
  40. >      PBOpenDF takes 2, and PBHOpenDF takes 2.
  41.     The asynch parameter (a boolean) is an oddity, which gets stuffed into
  42. one of the bits of the trap code (bit 9 or 10...I'd have to check).  Why
  43. the Mac team did this one this way back in the early 1980s, I've never
  44. really known.  It's "magic".  Some other parameters are treated like this,
  45. too (eg, the case sensitive and diacritical sensitive flags in the
  46. EqualString utility call).
  47.  
  48. >
  49. >   6. What is the error code -50?  (I assume it means the trap call
  50. >      is not available.)
  51. error code -50 is "paramater error".  I'm not sure under what conditions,
  52. if any, this trip will produce it.
  53. >
  54. >   7. Is this stuff documented somewhere?
  55. New Inside Macintosh: Files will become the standard reference.  For now,
  56. IM-VI will do until you get the new book (you NEED the new series of
  57. books...many of the Tech Notes are being absorbed into them and will be
  58. discontinued as Tech Notes).  IM-V or IV can be helpful in some areas like
  59. which register is used for what.
  60.  
  61. --------------
  62. John W. Baxter   jwbaxter@halcyon.com   My incorrect opinions are my
  63. own...someone else probably supplied my one correct opinion.
  64. I'd really rather be sailing.
  65.