home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / mac / programm / 12772 < prev    next >
Encoding:
Text File  |  1992-07-21  |  2.8 KB  |  57 lines

  1. Path: sparky!uunet!cs.utexas.edu!sun-barr!apple!apple!keith@taligent.com
  2. From: keith@taligent.com (Keith Rollin)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Gestalt glue is redundant!
  5. Message-ID: <70287@apple.Apple.COM>
  6. Date: 21 Jul 92 17:40:05 GMT
  7. References: <28086@goofy.Apple.COM> <1992Jul11.063540.11834@usenet.ins.cwru.edu> <5cWy03MV36Pd00@amdahl.uts.amdahl.com> <BrEo5w.Bt4@world.std.com> <c6n403hY3dcZ00@amdahl.uts.amdahl.com>
  8. Sender: daemon@Apple.COM
  9. Organization: Taligent
  10. Lines: 45
  11.  
  12. In article <c6n403hY3dcZ00@amdahl.uts.amdahl.com>, jsp@uts.amdahl.com (James
  13. Preston) writes:
  14. > I disagree when you say that it is not the responsibility of the THINK C
  15. > documentation to talk about something like the Gestalt glue code.  In the
  16. > first place (and I'm sure I don't need to remind Rich of this), THINK C
  17. > is not just a C compiler, it is a Macintosh development environment.
  18. > Therefore, its documentation certainly should talk about the interface
  19. > between the application program and the Mac toolbox.  More importantly,
  20. > in this particular case, calling the glue code is something that the compiler
  21. > does _behind the programmer's back._  It doesn't matter where that glue
  22. > code comes from, be it Apple or anywhere else; the point is that the code
  23. > generator does not see my call to Gestalt and emit a call to directly to
  24. > Gestalt.  It emits code to call the glue code.  I agree that it is a good
  25. > thing to do, but certainly any such behind the back calling must be
  26. > documented by the product that does so, which in this case is THINK C.
  27.  
  28. I must agree with Paul in disagreeing with you here. First of all, this is
  29. nothing new, and you never complained until now. There are many, many routines
  30. that are glue routines that appear no differently that direct trap calls. Take a
  31. look at Inside Mac. Any routine marked as Not In ROM is a glue routine.
  32. Additionally, until MPW 3.1, almost every OS routine was also a glue routine in
  33. order to convert from a register based convention into a stack based based
  34. calling convention. (This has been now changed with the use of inline code and
  35. #pragma parameter). Finally, there are several calls provided as glue for C
  36. programmers that convert C strings into Pascal strings before calling the
  37. ToolBox or OS.
  38.  
  39. Secondly, calling the Gestalt glue is definitely not an idiosyncracy of the code
  40. generator. If anything, you've got it the wrong way around. In C, something with
  41. the following form:
  42.  
  43.         myErr = Gestalt(selector, &result);
  44.  
  45. is a function call (or a macro, I suppose), and results in the compiler calling
  46. a function linked with your application. Anything else, such as inserting a trap
  47. number, is the exceptional case. The code generator is just doing what the
  48. headers tell it to, and in the normal case, the headers tell the compiler to
  49. generate a function call.
  50.  
  51. --
  52. Keith Rollin
  53. Phantom Programmer
  54. Taligent, Inc.
  55.  
  56.