home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / mac / programm / 19882 < prev    next >
Encoding:
Internet Message Format  |  1992-12-15  |  2.8 KB

  1. Path: sparky!uunet!comp.vuw.ac.nz!waikato.ac.nz!ldo
  2. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: PPC Sessions, or Any ports in this storm?
  5. Message-ID: <1992Dec16.172127.12835@waikato.ac.nz>
  6. Date: 16 Dec 92 17:21:27 +1300
  7. References: <1ghueaINNnuf@flop.ENGR.ORST.EDU>
  8. Distribution: world
  9. Organization: University of Waikato, Hamilton, New Zealand
  10. Lines: 46
  11.  
  12. In article <1ghueaINNnuf@flop.ENGR.ORST.EDU>, kempkec@mist.CS.ORST.EDU (Christopher Kempke) writes:
  13. >
  14. > First a simple question:  Can I assume that PPC Session reference numbers
  15. > are unique to a running application?
  16.  
  17. I think that session and port numbers are unique systemwide, not just to an
  18. application. I've been doing some messing about with PPC from HyperCard,
  19. and several times I've made some mistake in a script, tried quitting HyperCard
  20. and going back in, and failed to open my port because it was already open.
  21.  
  22. Remember the PPC Toolbox can be used from interrupt level and INIT code, not
  23. necessarily by an application. I don't think it knows anything about
  24. application contexts; that knowledge belongs to higher layers, like the
  25. High-Level Event and AppleEvent Managers.
  26.  
  27. > Worse, the ReadParam and WriteParam (why the name change from send/receive
  28. > to write/read, guys?) don't include the port reference number.  The
  29. > only thing I can consistently get is the session reference number, and
  30. > of course there's two big problems with that:  a) it's not documented to
  31. > be unique, so I can't necessarily map it back to the port number, and
  32. > b) there's no obvious way to convert them, short of building a table myself
  33. > as I open the sessions, and c) the session reference number is not even
  34. > listed as being a readable value in the completion procedure, so potentially
  35. > in a later system it could be corrupted or overwritten by the time it reaches
  36. > the completion routine.
  37.  
  38. I haven't heard of any cases where the system altered a field where there
  39. was only a right-arrow next to its description. I trust this is still true
  40. with the PPC Toolbox. (He said with a straight face.)
  41.  
  42. > Is there really no way to do this?   I _can't_ be the only person who
  43. > needs to send data from the application to its own completion routines.
  44. > Can I?
  45.  
  46. One common technique is to make the PPC parameter block part of a larger
  47. structure that you know about. You can put whatever information you like in
  48. the fields following it.
  49.  
  50. There's another technique I like to use (because it also works in more
  51. difficult situations), but it involves generating code at run-time, which
  52. upsets some squeamish types. :-)
  53.  
  54. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  55. Computer Services Dept                     fax: +64-7-838-4066
  56. University of Waikato            electric mail: ldo@waikato.ac.nz
  57. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
  58.