home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / csmpdigest / csmp-digest-v3-062 < prev    next >
Text File  |  2010-09-21  |  121KB  |  3,559 lines

  1. Received-Date: Tue, 4 Oct 1994 02:13:31 +0100
  2. From: pottier@clipper.ens.fr (Francois Pottier)
  3. Subject: csmp-digest-v3-062
  4. To: csmp-digest@ens.fr
  5. Date: Tue, 4 Oct 1994 02:13:22 +0100 (MET)
  6. X-Mailer: ELM [version 2.4 PL23]
  7. Mime-Version: 1.0
  8. Content-Type: text/plain; charset=ISO-8859-1
  9. Content-Transfer-Encoding: 8bit
  10. Errors-To: listman@ens.fr
  11. Reply-To: pottier@clipper.ens.fr
  12. X-Sequence: 67
  13.  
  14. C.S.M.P. Digest             Tue, 04 Oct 94       Volume 3 : Issue 62
  15.  
  16. Today's Topics:
  17.  
  18.         (Q)Patched Traps and extention conflicts
  19.         HELP: How does one make a GWorld for printing?
  20.         How to call a C type code resource?
  21.         Is there a reasonable alternative to BalloonWriter?
  22.         Need help with MDEF UPP Question
  23.         OpenDoc Development Environments?
  24.         Q: Getting errors out of threads?
  25.         Shared Memory on Mac
  26.         Window Lists
  27.         preloaded CODE resources in fat binaries
  28.  
  29.  
  30.  
  31. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  32. (pottier@clipper.ens.fr).
  33.  
  34. The digest is a collection of article threads from the internet newsgroup
  35. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  36. regularly and want an archive of the discussions.  If you don't know what a
  37. newsgroup is, you probably don't have access to it.  Ask your systems
  38. administrator(s) for details.  If you don't have access to news, you may
  39. still be able to post messages to the group by using a mail server like
  40. anon.penet.fi (mail help@anon.penet.fi for more information).
  41.  
  42. Each issue of the digest contains one or more sets of articles (called
  43. threads), with each set corresponding to a 'discussion' of a particular
  44. subject.  The articles are not edited; all articles included in this digest
  45. are in their original posted form (as received by our news server at
  46. nef.ens.fr).  Article threads are not added to the digest until the last
  47. article added to the thread is at least two weeks old (this is to ensure that
  48. the thread is dead before adding it to the digest).  Article threads that
  49. consist of only one message are generally not included in the digest.
  50.  
  51. The digest is officially distributed by two means, by email and ftp.
  52.  
  53. If you want to receive the digest by mail, send email to listserv@ens.fr
  54. with no subject and one of the following commands as body:
  55.     help                        Sends you a summary of commands
  56.     subscribe csmp-digest Your Name    Adds you to the mailing list
  57.     signoff csmp-digest            Removes you from the list
  58. Once you have subscribed, you will automatically receive each new
  59. issue as it is created.
  60.  
  61. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  62. Questions related to the ftp site should be directed to
  63. scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
  64. digest are available there.
  65.  
  66. Also, the digests are available to WAIS users.  To search back issues
  67. with WAIS, use comp.sys.mac.programmer.src. With Mosaic, use
  68. http://www.wais.com/wais-dbs/comp.sys.mac.programmer.html.
  69.  
  70.  
  71. -------------------------------------------------------
  72.  
  73. >From especkma@halcyon.com (Erik A. Speckman)
  74. Subject: (Q)Patched Traps and extention conflicts
  75. Date: Mon, 19 Sep 1994 14:49:05 -0700
  76. Organization: The Future Fair
  77.  
  78. I am trying to track down the causes of some instabillities in my System
  79. configuration and I would appreciate having a few questions answered.
  80.  
  81. I have used Andrew Welch's Init Tracker to give me a report of what
  82. extensions patch what traps at startup.  I have noticed that a few traps
  83. are patched by multiple extentions.
  84.  
  85. All of the extensions seem to do what they are supposed to so I was
  86. wondering how it works that multiple extentions can patch the same trap? 
  87. Do they each tag some more code like a subroutine call on to the end of the
  88. trap when they each load?
  89.  
  90. The multi-patched trap that catches my attention is: 
  91.  
  92. _Get1IxResource
  93.  
  94. because it is patched by MacTCP DNR, among others and I have been having
  95. problems which end up effecting DNR after the system has been up a while.
  96.  
  97. Thanks.
  98.  
  99. Erik
  100.  
  101.  
  102.  
  103.  
  104.  
  105. ______________________________________________________________________
  106. Erik A. Speckman       Seattle, Washington      Good Brain Doesn't Suck
  107. especkma@reed.edu                                  especkma@halcyon.com
  108.  
  109. +++++++++++++++++++++++++++
  110.  
  111. >From Tony Andreoli <andreoli@owens.ridgecrest.ca.us>
  112. Date: Tue, 20 Sep 1994 01:32:36 GMT
  113. Organization: RidgeNet - SLIP/PPP Internet, Ridgecrest, CA. (619) 371-3501
  114.  
  115. In article <9668AAA35561.106B96@blv-pm1-ip14.halcyon.com> Erik A.
  116. Speckman, especkma@halcyon.com writes:
  117. >All of the extensions seem to do what they are supposed to so I was
  118. >wondering how it works that multiple extentions can patch the same trap? 
  119. >Do they each tag some more code like a subroutine call on to the end of
  120. the
  121. >trap when they each load?
  122.  
  123. My understanding of patch trapping is this:
  124.  
  125. The first thing you do when patching a trap, is go to the trap dispatch
  126. table, and get the address for the code associated with the trap, and
  127. store this value, so you're patch can call it when it's done.  The last
  128. thing you do is set the address of your trap in the address table as the
  129. current address for the related trap.
  130.  
  131. Thus, if extension "A" patches a trap, then extension "B" attempts to
  132. patch the same trap, the execution order will be B -> A -> original trap,
  133. providing of course, that each patch calls the previously set trap
  134. (obtained when the trap was loaded).
  135.  
  136. Hope this makes some sense.
  137.  
  138. Tony Andreoli
  139.  
  140. ---------------------------
  141.  
  142. >From jscho@uclink.berkeley.edu (John S. Cho)
  143. Subject: HELP: How does one make a GWorld for printing?
  144. Date: Tue, 20 Sep 1994 16:43:35 -0800
  145. Organization: University of California, Berkeley
  146.  
  147. How does one change the resolution (from 72dpi to 300dpi or more) on a
  148. GWorld or offscreen bitmap? I need to store drawings into a GWorld to
  149. later be outputed to a printer. The problem I'm having right now is that
  150. all text I draw is being outputed by the printer at 72dpi which makes a
  151. lot of sense since the version saved in the GWorld is also at 72dpi. Is
  152. there a way to keep the resolution and use CopyBits to transfer the
  153. drawing from the GWorld to the printer?
  154.  
  155. Johnny
  156.          ._/ John Seungwon Cho (Koden)       ( "If not today nor yet tomorrow,
  157.         ._/ koden@well.com                    `.   then some other day."
  158.  ._/   ._/ jscho@{uclink,soda,ocf}.berkeley.edu )
  159. ._/._/._/ University of California, Berkeley  .'              - Dream Theater
  160.  
  161. +++++++++++++++++++++++++++
  162.  
  163. >From gurgle@dnai.com (Pete Gontier)
  164. Date: Tue, 20 Sep 1994 17:13:19 -0800
  165. Organization: Integer Poet Software
  166.  
  167. In article <jscho-2009941643350001@de32.reshall.berkeley.edu>,
  168. jscho@uclink.berkeley.edu wrote:
  169.  
  170. > How does one change the resolution (from 72dpi to 300dpi or more) on a
  171. > GWorld or offscreen bitmap? I need to store drawings into a GWorld to
  172. > later be outputed to a printer. The problem I'm having right now is that
  173. > all text I draw is being outputed by the printer at 72dpi which makes a
  174. > lot of sense since the version saved in the GWorld is also at 72dpi. Is
  175. > there a way to keep the resolution and use CopyBits to transfer the
  176. > drawing from the GWorld to the printer?
  177.  
  178. First I feel like I ought to point out that text is handled quite nicely
  179. by most printer drivers such that you don't have to worry about resolution
  180. if you draw the text directly into a printing GrafPort. (The printers that
  181. don't handle text this way are the ones that are no longer on the market
  182. and the ones that don't print any higher than 72 DPI in the first place.
  183. :-) If you don't need high resolution for the rest of your output, allow
  184. me to suggest you defer the text drawing until you are actually printing.
  185. If this can't work for you, read on.
  186.  
  187. Off-screen pixel maps don't really have DPI; they just have dimensions in
  188. terms of pixels. Theoretically, a pixel could be four feet or a single
  189. micron across. However, when you print, a pixel does have dimensions;
  190. namely 72 DPI, as you have discovered. (Monitors are *supposed to be* 72
  191. DPI, but many are not. Also, printers have varying DPI, but for historical
  192. reasons printer drivers almost universally report that they are 72 DPI
  193. unless you go out of your way to obtain the true numbers.) Good news: you
  194. can change the DPI recognized by the driver.
  195.  
  196. Off the top of my head, what you probably want to do is:
  197.  
  198.     a) Figure out the resolution of the current printer with PrGeneral.
  199.     b) Create a pixel map according to the dimensions of the page and
  200.        the resolution of the printer. It's going to be big. :-)
  201.     c) Make sure you set the resolution of the driver when printing.
  202.     b) CopyBits the pixel map into the printing GrafPort. You will probably
  203.        specify a destination rectangle which appears to scale your output,
  204.        but I suspect the printer driver QD bottleneck will know that you've
  205.        tweaked the resolution and do the right thing.
  206.  
  207. In order to make the memory consumption reasonable, you may have to
  208. process the pixel map in bands instead of an entire page at a time.
  209.  
  210. Anyway, I could be wrong about the details of this, but the documentation
  211. for PrGeneral will probably be much more illuminating.
  212.  
  213. -- 
  214.  
  215.  Pete Gontier // CTO, Integer Poet Software // gurgle@dnai.com
  216.  
  217.  "I saw John Norstad with Elvis! And they were varnishing waffles!"
  218.       -- Peter Cohen <flargh@tiac.net>
  219.  
  220. ---------------------------
  221.  
  222. >From ferrari@netaxs.com (Darrell Turner)
  223. Subject: How to call a C type code resource?
  224. Date: Thu, 15 Sep 1994 15:02:39 -0500
  225. Organization: Haha, None here
  226.  
  227. Hi, I'm trying to re-write the DNR.c for Pascal.  As far as I can tell, the
  228. dnrp code resource uses a C type calling convention (register based), so I
  229. must pop my stuff off the stack, and put it into the registers.  I've done
  230. a little of the inline assembly, but I don't know how to put the second to
  231. last paramter in d0( or whatever register C expects the first param to be
  232. in).
  233.  
  234.  function OpenResolverProc (num: longint; fileName: string; dnr: ProcPtr):
  235. OSErr;
  236.  inline
  237.   $205f, $4e90, $3E80; 
  238.  
  239. {$205f   move.l (a7)+,a0        ;dnr: ProcPtr}
  240. {$4e90   jsrs}
  241. {$3e80   puts result in}
  242.  
  243. Thanks for any help you can be!
  244.  
  245. +++++++++++++++++++++++++++
  246.  
  247. >From quinn@cs.uwa.edu.au (Quinn "The Eskimo!")
  248. Date: Fri, 16 Sep 1994 11:04:29 +0800
  249. Organization: Department of Computer Science, The University of Western Australia
  250.  
  251. In article <ferrari-150994150240@slip-55.netaxs.com>, ferrari@netaxs.com
  252. (Darrell Turner) wrote:
  253.  
  254. >Hi, I'm trying to re-write the DNR.c for Pascal.
  255.  
  256. Four solutions to your problem...
  257.  
  258. #1 Use C glue.
  259. #2 Use assembly glue.
  260. #3 Do some horrible kludge using inlines (put the parameters in backwards
  261.    and then use the in-line to clean up the stack)
  262. #4 FTP Peter Lewis' sample code and figure out how he did it.
  263.      ftp://redback.cs.uwa.edu.au//Others/PeterLewis/
  264.  
  265. Personally, I would start at the end of this list and work backwards.
  266.  
  267. Share and Enjoy.
  268. -- 
  269. Quinn "The Eskimo!"        "Scout in a can. Simple, cheap, easy
  270.                             to use and it's expendable!"
  271.  
  272. +++++++++++++++++++++++++++
  273.  
  274. >From ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  275. Date: 16 Sep 94 16:52:02 +1200
  276. Organization: University of Waikato, Hamilton, New Zealand
  277.  
  278. In article <ferrari-150994150240@slip-55.netaxs.com>, ferrari@netaxs.com (Darrell Turner) writes:
  279.  
  280. > Hi, I'm trying to re-write the DNR.c for Pascal.  As far as I can tell, the
  281. > dnrp code resource uses a C type calling convention (register based), so I
  282. > must pop my stuff off the stack, and put it into the registers.  I've done
  283. > a little of the inline assembly, but I don't know how to put the second to
  284. > last paramter in d0( or whatever register C expects the first param to be
  285. > in).
  286. >
  287. >  function OpenResolverProc (num: longint; fileName: string; dnr: ProcPtr):
  288. > OSErr;
  289. >  inline
  290. >   $205f, $4e90, $3E80;
  291. >
  292. > {$205f   move.l (a7)+,a0        ;dnr: ProcPtr}
  293. > {$4e90   jsrs}
  294. > {$3e80   puts result in}
  295.  
  296. The C convention is still stack-based for arguments, not register-based.
  297. The difference from Pascal is that arguments are stacked from right to
  298. left, not left to right, and everything is extended to 32 bits if it's
  299. smaller. Also the caller pops the arguments off the stack, not the callee.
  300. And finally, a result not exceeding 32 bits is returned in D0.
  301.  
  302. Put this all together, and the glue you seek for the above routine (nicely
  303. formatted the way I like it) is
  304.  
  305.     Function OpenResolver
  306.       (
  307.     FileName : String; {?}
  308.     dnr : ProcPtr
  309.       ) : OSErr;
  310.  
  311.     Inline
  312.         $205F,            { move.l (sp)+, a0 }
  313.         $2F3C, $0000, $0001,    { move.l #OPENRESOLVER, -(sp) }
  314.         $4E90,            { jsr (a0) }
  315.         $508F,            { addq.l #8, sp } { pop args }
  316.         $3E80;            { move.w d0, (sp) } { return result }
  317.  
  318. By the way, I'm not sure about the type of the FileName argument: since this
  319. is C code, it probably expects a string with a terminating null, and no
  320. length byte on the front.
  321.  
  322. Hope this helps.
  323.  
  324. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  325. Info & Tech Services Division              fax: +64-7-838-4066
  326. University of Waikato            electric mail: ldo@waikato.ac.nz
  327. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+12:00
  328.  
  329. +++++++++++++++++++++++++++
  330.  
  331. >From calbear@crl.com (Howard H. Fukuda)
  332. Date: 16 Sep 1994 03:01:34 -0700
  333. Organization: CRL Dialup Internet Access    (415) 705-6060  [login: guest]
  334.  
  335. Darrell Turner (ferrari@netaxs.com) wrote:
  336. > Hi, I'm trying to re-write the DNR.c for Pascal.  As far as I can tell, the
  337. > dnrp code resource uses a C type calling convention (register based), so I
  338. > must pop my stuff off the stack, and put it into the registers.  I've done
  339. > a little of the inline assembly, but I don't know how to put the second to
  340. > last paramter in d0( or whatever register C expects the first param to be
  341. > in).
  342. >
  343. >  function OpenResolverProc (num: longint; fileName: string; dnr: ProcPtr):
  344. > OSErr;
  345. >  inline
  346. >   $205f, $4e90, $3E80; 
  347.  
  348. > {$205f   move.l (a7)+,a0        ;dnr: ProcPtr}
  349. > {$4e90   jsrs}
  350. > {$3e80   puts result in}
  351.  
  352. Well, I'm not familiar with DNR.c, but in general C compilers for the 
  353. Macintosh do not put parameters in registers, although D0 is used for the 
  354. return values. Mac C compilers usually push parameters onto the stack 
  355. from right to left. So assuming DNR.C is:
  356.  
  357. short DNR (long num, char *fileName);
  358.  
  359. you can call it with the following assembly language code (MPW Assembler 
  360. source)::
  361.  
  362. CallSomeCode        FUNC                EXPORT
  363. StackFrame          RECORD              {A6Link},DECR
  364. result              DS.W                1
  365. ParamBegin          EQU                 *
  366. num                 DS.L                1
  367. fileName            DS.L                1
  368. dnr                 DS.L                1
  369. ParamSize           EQU                 ParamBegin-*
  370. RetAddr             DS.L                1
  371. A6Link              DS.L                1
  372. LocalSize           EQU                 *
  373.                     ENDR
  374.                     WITH                StackFrame
  375.                     LINK                A6,#LocalSize
  376.                     MOVE.L              fileName(A6),-(SP)
  377.                     MOVE.L              num(A6),-(SP)
  378.                     MOVEA.L             dnr(A6),A0
  379.                     JSR                 (A0)
  380.                     UNLK                A6
  381.                     MOVEA.L             (SP)+,A0
  382.                     LEA                 ParamSize(SP),SP
  383.                     JMP                 (A0)
  384.                     ENDF
  385.  
  386. Which assembles down to:
  387.  
  388. 00000000: 4E56 0000          LINK       A6,#$0000
  389. 00000004: 2F2E 000C          MOVE.L     $000C(A6),-(A7)
  390. 00000008: 2F2E 0010          MOVE.L     $0010(A6),-(A7)
  391. 0000000C: 206E 0008          MOVEA.L    $0008(A6),A0
  392. 00000010: 4E90               JSR        (A0)
  393. 00000012: 4E5E               UNLK       A6
  394. 00000014: 205F               MOVEA.L    (A7)+,A0
  395. 00000016: 4FEF 000C          LEA        $000C(A7),A7
  396. 0000001A: 4ED0               JMP        (A0)
  397.  
  398. If DNR.c is really putting parameters in registers, then just put them in 
  399. the right registers instead of the stack.
  400.  
  401. Howard
  402.  
  403. -- 
  404. - -----------------------------------------------------------------------------
  405. Howard H. Fukuda                                                calbear@crl.com
  406. Macintosh Software Engineer                                         "Go Bears!"
  407. ===============================================================================
  408.  
  409. +++++++++++++++++++++++++++
  410.  
  411. >From calbear@crl.com (Howard H. Fukuda)
  412. Date: 16 Sep 1994 03:31:41 -0700
  413. Organization: CRL Dialup Internet Access    (415) 705-6060  [login: guest]
  414.  
  415. Howard H. Fukuda (calbear@crl.com) wrote:
  416. > Which assembles down to:
  417. >
  418. > 00000000: 4E56 0000          LINK       A6,#$0000
  419. > 00000004: 2F2E 000C          MOVE.L     $000C(A6),-(A7)
  420. > 00000008: 2F2E 0010          MOVE.L     $0010(A6),-(A7)
  421. > 0000000C: 206E 0008          MOVEA.L    $0008(A6),A0
  422. > 00000010: 4E90               JSR        (A0)
  423. > 00000012: 4E5E               UNLK       A6
  424. > 00000014: 205F               MOVEA.L    (A7)+,A0
  425. > 00000016: 4FEF 000C          LEA        $000C(A7),A7
  426. > 0000001A: 4ED0               JMP        (A0)
  427.  
  428. Well, I goofed. I forgot to save the function result, so change:
  429.  
  430. 0000001A: 4ED0               JMP        (A0)
  431.  
  432. to:
  433.  
  434. 0000001A: 3E80               MOVE.W     D0,(A7)
  435. 0000001C: 4ED0               JMP        (A0)
  436.  
  437.  
  438. Howard
  439.  
  440. -- 
  441. - -----------------------------------------------------------------------------
  442. Howard H. Fukuda                                                calbear@crl.com
  443. Macintosh Software Engineer                                         "Go Bears!"
  444. ===============================================================================
  445.  
  446. +++++++++++++++++++++++++++
  447.  
  448. >From gurgle@dnai.com (Pete Gontier)
  449. Date: Fri, 16 Sep 1994 15:18:23 -0800
  450. Organization: Integer Poet Software
  451.  
  452. In article <quinn-1609941104290001@edu-dynamic7.educ.ecel.uwa.edu.au>,
  453. quinn@cs.uwa.edu.au (Quinn "The Eskimo!") wrote:
  454.  
  455. > #3 Do some horrible kludge using inlines (put the parameters in backwards
  456. >    and then use the in-line to clean up the stack)
  457.  
  458. As long as we're considering using something other than Peter Lewis' code,
  459. would it be so difficult to simply add 'pascal' keywords to "dnr.c" and
  460. write an interface file for Pascal? I suppose it would if you didn't have
  461. a C compiler. :-)
  462.  
  463. Anyway, my own suggestion for working with "dnr.c" is either use PL's
  464. stuff or modify the copy of "dnr.c" which comes with the NewsWatcher
  465. source. It evidently has siginificant fixes because, as its comments say,
  466. it was "crap". "I had to hack it to death to get it to work," writes
  467. Norstad. Given that NewsWatcher probably does about as many Mac-hosted DNS
  468. lookups as anything in the world except perhaps Eudora, I wouldn't be
  469. surprised if its "dnr.c" were more reliable.
  470.  
  471. -- 
  472.  
  473.  Pete Gontier // CTO, Integer Poet Software // gurgle@dnai.com
  474.  
  475.  "I saw John Norstad with Elvis! And they were varnishing waffles!"
  476.       -- Peter Cohen <flargh@tiac.net>
  477.  
  478. +++++++++++++++++++++++++++
  479.  
  480. >From gurgle@dnai.com (Pete Gontier)
  481. Date: Fri, 16 Sep 1994 10:42:28 -0800
  482. Organization: Integer Poet Software
  483.  
  484. In article <ferrari-150994150240@slip-55.netaxs.com>, ferrari@netaxs.com
  485. (Darrell Turner) wrote:
  486.  
  487. > Hi, I'm trying to re-write the DNR.c for Pascal.
  488.  
  489. If Peter Lewis hasn't already done this, I'm a monkey's uncle.
  490.  
  491. -- 
  492.  
  493.  Pete Gontier // CTO, Integer Poet Software // gurgle@dnai.com
  494.  
  495.  "I saw John Norstad with Elvis! And they were varnishing waffles!"
  496.       -- Peter Cohen <flargh@tiac.net>
  497.  
  498. +++++++++++++++++++++++++++
  499.  
  500. >From ferrari@netaxs.com (Darrell Turner)
  501. Date: Fri, 16 Sep 1994 23:14:48 -0500
  502. Organization: Haha, None here
  503.  
  504. In article <gurgle-1609941518230001@dynamic-216.dnai.com>, gurgle@dnai.com
  505. (Pete Gontier) wrote:
  506.  
  507. > In article <quinn-1609941104290001@edu-dynamic7.educ.ecel.uwa.edu.au>,
  508. > quinn@cs.uwa.edu.au (Quinn "The Eskimo!") wrote:
  509. > > #3 Do some horrible kludge using inlines (put the parameters in backwards
  510. > >    and then use the in-line to clean up the stack)
  511. > As long as we're considering using something other than Peter Lewis' code,
  512. > would it be so difficult to simply add 'pascal' keywords to "dnr.c" and
  513. > write an interface file for Pascal? I suppose it would if you didn't have
  514. > a C compiler. :-)
  515.  
  516. I have a C compiler, so it's worth a try, what I want to know is, can you
  517. compile a library in C that can be included in your project in Pascal?
  518.  
  519. > Anyway, my own suggestion for working with "dnr.c" is either use PL's
  520. > stuff or modify the copy of "dnr.c" which comes with the NewsWatcher
  521.  
  522. I did start from Newswatcher's dnr.c.  And BTW, I have seen PL's coode, and
  523. he did it via a library, and the code is UGGGGGGGGLY!, but I do appreciate
  524. the result of his programming eforts, I just can't stand to do my own
  525. programming with his libraries.  Magic numbers and everything, hehe... I
  526. want to release my efforts as an alternative to his libraries.
  527.  
  528. > source. It evidently has siginificant fixes because, as its comments say,
  529. > it was "crap". "I had to hack it to death to get it to work," writes
  530. > Norstad. Given that NewsWatcher probably does about as many Mac-hosted DNS
  531. > lookups as anything in the world except perhaps Eudora, I wouldn't be
  532. > surprised if its "dnr.c" were more reliable.
  533.  
  534. I have got OpenResolver, and Close Resolver to work, now i'm working on
  535. StrToAddr, and it's not going too well...
  536.  
  537. +++++++++++++++++++++++++++
  538.  
  539. >From gurgle@dnai.com (Pete Gontier)
  540. Date: Fri, 16 Sep 1994 21:59:33 -0800
  541. Organization: Integer Poet Software
  542.  
  543. In article <ferrari-160994231449@slip-55.netaxs.com>, ferrari@netaxs.com
  544. (Darrell Turner) wrote:
  545.  
  546. > > As long as we're considering using something other than Peter Lewis' code,
  547. > > would it be so difficult to simply add 'pascal' keywords to "dnr.c" and
  548. > > write an interface file for Pascal? I suppose it would if you didn't have
  549. > > a C compiler. :-)
  550. > I have a C compiler, so it's worth a try, what I want to know is, can you
  551. > compile a library in C that can be included in your project in Pascal?
  552.  
  553. Sure. Other way around, too. In MPW it's pretty clear how to do it because
  554. everything resolves to an object file. With the THINK compilers, I seem to
  555. remember you actually have to "Build Library" rather than expecting the
  556. compilers to load each other's project files. (You can use project files
  557. as libraries within THINK C and Symantec C++.) I've never done it with
  558. CodeWarrior, but I'd be surprised if it were not possible. There's also
  559. the possibility of mixing and matching. THINK Pascal and CodeWarrior C/C++
  560. read MPW objects, for example, and THINK C/Symantec C++ have a converter
  561. which allows you to use MPW objects.
  562.  
  563. -- 
  564.  
  565.  Pete Gontier // CTO, Integer Poet Software // gurgle@dnai.com
  566.  
  567.  "I saw John Norstad with Elvis! And they were varnishing waffles!"
  568.       -- Peter Cohen <flargh@tiac.net>
  569.  
  570. +++++++++++++++++++++++++++
  571.  
  572. >From ferrari@netaxs.com (Darrell Turner)
  573. Date: Sat, 17 Sep 1994 11:46:49 -0500
  574. Organization: Haha, None here
  575.  
  576. In article <gurgle-1609942159330001@dynamic-207.dnai.com>, gurgle@dnai.com
  577. (Pete Gontier) wrote:
  578.  
  579. > Sure. Other way around, too. In MPW it's pretty clear how to do it because
  580. > everything resolves to an object file. With the THINK compilers, I seem to
  581. > remember you actually have to "Build Library" rather than expecting the
  582. > compilers to load each other's project files. (You can use project files
  583. > as libraries within THINK C and Symantec C++.) I've never done it with
  584. > CodeWarrior, but I'd be surprised if it were not possible. There's also
  585. > the possibility of mixing and matching. THINK Pascal and CodeWarrior C/C++
  586. > read MPW objects, for example, and THINK C/Symantec C++ have a converter
  587. > which allows you to use MPW objects.
  588.  
  589. I compiled dnr.c into a library, and eventually got it to link with my
  590. project (no link errors).  But it seems to do exactly the same thing (bad
  591. crashes, jumping to wierd places and getting address errors).  I did make
  592. sure to convert the pascal strings to C strings, but it still doesnt
  593. work...
  594.  
  595. +++++++++++++++++++++++++++
  596.  
  597. >From peter.lewis@info.curtin.edu.au (Peter N Lewis)
  598. Date: Sun, 18 Sep 1994 13:02:17 +0800
  599. Organization: NCRPDA, Curtin University
  600.  
  601. In article <ferrari-150994150240@slip-55.netaxs.com>, ferrari@netaxs.com
  602. (Darrell Turner) wrote:
  603.  
  604. >Hi, I'm trying to re-write the DNR.c for Pascal.  As far as I can tell, the
  605.  
  606. Well, that's an easy thing to fix:
  607.    Peter.
  608.  
  609. unit DNR;
  610.  
  611. interface
  612.  
  613.    uses
  614.       TCPTypes;
  615.  
  616.    type
  617.       ResultProcPtr = ProcPtr;
  618. { procedure ResultProc(hip:hostInfoPtr; userdata:ptr); }
  619.       ResultProc2Ptr = ProcPtr;
  620. { procedure ResultProc2(hmxip:HMXInfoPtr; userdata:ptr); }
  621.       EnumResultProcPtr = ProcPtr;
  622. { procedure EnumResultProc(cerp:cacheEntryRecordPtr; userdata:ptr); }
  623.  
  624.    function OpenResolver: OSErr;
  625.    procedure CloseResolver;
  626.    function StrToAddr (host: Str255; var rtnStruct: hostInfo; completion:
  627. ResultProcPtr; userdata: Ptr): OSErr;
  628.    procedure AddrToStr (addr: longInt; var s: str255);
  629.    function EnumCache (completion: EnumResultProcPtr; userdata: ptr): OSErr;
  630.    function AddrToName (addr: longInt; var hi: hostInfo; completion:
  631. ResultProcPtr; userdata: ptr): OSErr;
  632.    function HInfo (host: Str255; var hi: hmxInfoRec; completion:
  633. ResultProc2Ptr; userdata: ptr): OSErr;
  634.    function MXInfo (host: Str255; var mxi: hmxInfoRec; completion:
  635. ResultProc2Ptr; userdata: ptr): OSErr;
  636.  
  637. implementation
  638.  
  639.    uses
  640. {$IFC undefined THINK_Pascal}
  641.       Resources, Errors, Memory, 
  642. {$ENDC}
  643.       Folders;
  644.  
  645.    var
  646.       code: Handle;
  647.  
  648.    procedure GetSystemFolder (var vrn: integer; var dirID: longInt);
  649.    begin
  650.       if FindFolder(kOnSystemDisk, kSystemFolderType, false, vrn, dirID)
  651. <> noErr then begin
  652.          vrn := 0;
  653.          dirID := 0;
  654.       end;
  655.    end;
  656.  
  657.    procedure GetCPanelFolder (var vrn: integer; var dirID: longInt);
  658.    begin
  659.       if FindFolder(kOnSystemDisk, kControlPanelFolderType, false, vrn,
  660. dirID) <> noErr then begin
  661.          vrn := 0;
  662.          dirID := 0;
  663.       end;
  664.    end;
  665.  
  666. { SearchFolderForDNRP is called to search a folder for files that might }
  667. { contain the 'dnrp' resource }
  668.    function SearchFolderForDNRP (ftype, fcreator: OSType; vrn: integer;
  669. dirID: longInt): Handle;
  670.       var
  671.          pb: HParamBlockRec;
  672.          filename: Str63;
  673.          refnum: integer;
  674.          i: integer;
  675.          h: Handle;
  676.          err: OSErr;
  677.    begin
  678.       h := nil;
  679.       i := 1;
  680.       repeat
  681.          pb.ioNamePtr := @filename;
  682.          pb.ioVRefNum := vrn;
  683.          pb.ioDirID := dirID;
  684.          pb.ioFDirIndex := i;
  685.          i := i + 1;
  686.          err := PBHGetFInfoSync(@pb);
  687.          if err = noErr then begin
  688.             if (pb.ioFlFndrInfo.fdType = ftype) &
  689. (pb.ioFlFndrInfo.fdCreator = fcreator) then begin
  690.                SetResLoad(false);
  691.                refnum := HOpenResFile(vrn, dirID, filename, fsRdPerm);
  692.                SetResLoad(true);
  693.                if refnum <> -1 then begin
  694.                   h := Get1IndResource('dnrp', 1);
  695.                   if h <> nil then begin
  696.                      DetachResource(h);
  697.                   end;
  698.                   CloseResFile(refnum);
  699.                end;
  700.             end;
  701.          end;
  702.       until (err <> noErr) or (h <> nil);
  703.       SearchFolderForDNRP := h;
  704.    end;
  705.  
  706.    function SearchForDNRP: Handle;
  707.       var
  708.          h: Handle;
  709.          vrn: integer;
  710.          dirID: longInt;
  711.    begin
  712. { first search Control Panels for MacTCP 1.1 }
  713.       GetCPanelFolder(vrn, dirID);
  714.       h := SearchFolderForDNRP('cdev', 'ztcp', vrn, dirID);
  715.  
  716.       if h = nil then begin
  717. { next search System Folder for MacTCP 1.0.x }
  718.          GetSystemFolder(vrn, dirID);
  719.          h := SearchFolderForDNRP('cdev', 'mtcp', vrn, dirID);
  720.       end;
  721.  
  722.       if h = nil then begin
  723. { then search Control Panels for MacTCP 1.0.x }
  724.          GetCPanelFolder(vrn, dirID);
  725.          h := SearchFolderForDNRP('cdev', 'mtcp', vrn, dirID);
  726.       end;
  727.  
  728.       if h = nil then begin
  729. { finally, look in any open resource file }
  730.          h := Get1IndResource('dnrp', 1);
  731.          if h <> nil then begin
  732.             DetachResource(h);
  733.          end;
  734.       end;
  735.  
  736.       SearchForDNRP := h;
  737.    end;
  738.  
  739.    function CallOpenResolver (code: ptr): OSErr;
  740.    inline
  741.       $205F, $42A7, $4878, $0001, $4E90, $504F, $3E80;
  742.  
  743.    function OpenResolver: OSErr;
  744.       var
  745.          err: OSErr;
  746.    begin
  747.       code := SearchForDNRP;
  748.       if code = nil then begin
  749.          err := resNotFound;
  750.       end
  751.       else begin
  752.          HLock(code);
  753.          err := CallOpenResolver(code^);
  754.          if err <> noErr then begin
  755.             DisposeHandle(code);
  756.             code := nil;
  757.          end;
  758.       end;
  759.       OpenResolver := err;
  760.    end;
  761.  
  762.    procedure CallCloseResolver (code: ptr);
  763.    inline
  764.       $205F, $4878, $0002, $4E90, $584F;
  765.  
  766.    procedure CloseResolver;
  767.    begin
  768.       if code <> nil then begin
  769.          CallCloseResolver(code^);
  770.          DisposeHandle(code);
  771.       end;
  772.    end;
  773.  
  774.    procedure P2C (var name: string);
  775.       var
  776.          len: integer;
  777.    begin
  778.       len := length(name);
  779.       BlockMove(@name[1], @name, len);
  780.       name[len] := chr(0);
  781.    end;
  782.  
  783.    function CallStrToAddr (userdata: ptr; completion: ProcPtr; var
  784. rtnStruct: hostInfo; cname: ptr; code: ptr): OSErr;
  785.    inline
  786.       $205F, $4878, $0003, $4E90, $4FEF, $0014, $3E80;
  787.  
  788.    function StrToAddr (host: Str255; var rtnStruct: hostInfo; completion:
  789. ResultProcPtr; userdata: Ptr): OSErr;
  790.       var
  791.          err: OSErr;
  792.          len: integer;
  793.    begin
  794.       if code = nil then begin
  795.          err := notOpenErr;
  796.       end
  797.       else begin
  798.          P2C(host);
  799.          err := CallStrToAddr(userdata, completion, rtnStruct, @host, code^);
  800.       end;
  801.       StrToAddr := err;
  802.    end;
  803.  
  804.    procedure CallAddrToStr (cstr: ptr; addr: longInt; code: ptr);
  805.    inline
  806.       $205F, $4878, $0004, $4E90, $4FEF, $000C;
  807.  
  808.    procedure AddrToStr (addr: longInt; var s: str255);
  809.       var
  810.          len: integer;
  811.    begin
  812.       if code <> nil then begin
  813.          CallAddrToStr(@s, addr, code^);
  814.          len := 0;
  815.          while (s[len] <> chr(0)) & (len < 255) do begin
  816.             len := len + 1;
  817.          end;
  818.          BlockMove(@s, @s[1], len);
  819.          s[0] := chr(len);
  820.       end;
  821.    end;
  822.  
  823.    function CallEnumCache (userdata: ptr; completion: ProcPtr; code: ptr):
  824. OSErr;
  825.    inline
  826.       $205F, $4878, $0005, $4E90, $4FEF, $000C, $3E80;
  827.  
  828.    function EnumCache (completion: EnumResultProcPtr; userdata: ptr): OSErr;
  829.       var
  830.          err: OSErr;
  831.    begin
  832.       if code = nil then begin
  833.          err := notOpenErr;
  834.       end
  835.       else begin
  836.          err := CallEnumCache(userdata, completion, code^);
  837.       end;
  838.       EnumCache := err;
  839.    end;
  840.  
  841.    function CallAddrToName (userdata: ptr; completion: ProcPtr; var hi:
  842. hostInfo; addr: longInt; code: ptr): OSErr;
  843.    inline
  844.       $205F, $4878, $0006, $4E90, $4FEF, $0014, $3E80;
  845.  
  846.    function AddrToName (addr: longInt; var hi: hostInfo; completion:
  847. ResultProcPtr; userdata: ptr): OSErr;
  848.       var
  849.          err: OSErr;
  850.    begin
  851.       if code = nil then begin
  852.          err := notOpenErr;
  853.       end
  854.       else begin
  855.          err := CallAddrToName(userdata, completion, hi, addr, code^);
  856.       end;
  857.       AddrToName := err;
  858.    end;
  859.  
  860.    function CallHInfo (userdata: ptr; completion: ProcPtr; var hi:
  861. hmxInfoRec; name: ptr; code: ptr): OSErr;
  862.    inline
  863.       $205F, $4878, $0007, $4E90, $4FEF, $0014, $3E80;
  864.  
  865.    function HInfo (host: Str255; var hi: hmxInfoRec; completion:
  866. ResultProc2Ptr; userdata: ptr): OSErr;
  867.       var
  868.          err: OSErr;
  869.    begin
  870.       if code = nil then begin
  871.          err := notOpenErr;
  872.       end
  873.       else begin
  874.          P2C(host);
  875.          err := CallHInfo(userdata, completion, hi, @host, code^);
  876.       end;
  877.       HInfo := err;
  878.    end;
  879.  
  880.    function CallMXInfo (userdata: ptr; completion: ProcPtr; var hi:
  881. hmxInfoRec; name: ptr; code: ptr): OSErr;
  882.    inline
  883.       $205F, $4878, $0008, $4E90, $4FEF, $0014, $3E80;
  884.  
  885.    function MXInfo (host: Str255; var mxi: hmxInfoRec; completion:
  886. ResultProc2Ptr; userdata: ptr): OSErr;
  887.       var
  888.          err: OSErr;
  889.    begin
  890.       if code = nil then begin
  891.          err := notOpenErr;
  892.       end
  893.       else begin
  894.          P2C(host);
  895.          err := CallMXInfo(userdata, completion, mxi, @host, code^);
  896.       end;
  897.       MXInfo := err;
  898.    end;
  899.  
  900. end.
  901.  
  902. unit TCPTypes;
  903.  
  904. { TCPTypes © Peter Lewis, Oct 1991 }
  905. { This source is Freeware }
  906.  
  907. interface
  908.  
  909. {$IFC undefined THINK_Pascal}
  910.    uses
  911.       Types, OSUtils;
  912. {$ENDC}
  913.  
  914. { MacTCP return Codes in the range -23000 through -23049 }
  915.    const
  916.       inProgress = 1;                     { I/O in progress }
  917.  
  918.       ipBadLapErr = -23000;               { bad network configuration }
  919.       ipBadCnfgErr = -23001;           { bad IP configuration error }
  920.       ipNoCnfgErr = -23002;               { missing IP or LAP
  921. configuration error }
  922.       ipLoadErr = -23003;              { error in MacTCP load }
  923.       ipBadAddrErr = -23004;              { error in getting address }
  924.       connectionClosingErr = -23005;         { connection is closing }
  925.       invalidLengthErr = -23006;
  926.       connectionExistsErr = -23007;       { request conflicts with
  927. existing connection }
  928.       connectionDoesntExistErr = -23008;     { connection does not exist }
  929.       insufficientResourcesErr = -23009;     { insufficient resources to
  930. perform request }
  931.       invalidStreamPtrErr = -23010;
  932.       streamAlreadyOpenErr = -23011;
  933.       connectionTerminatedErr = -23012;
  934.       invalidBufPtrErr = -23013;
  935.       invalidRDSErr = -23014;
  936.       invalidWDSErr = -23014;
  937.       openFailedErr = -23015;
  938.       commandTimeoutErr = -23016;
  939.       duplicateSocketErr = -23017;
  940.  
  941. { Error codes from internal IP functions }
  942.       ipDontFragErr = -23032;          { Packet too large to send w/o
  943. fragmenting }
  944.       ipDestDeadErr = -23033;          { destination not responding }
  945.       icmpEchoTimeoutErr = -23035;     { ICMP echo timed-out }
  946.       ipNoFragMemErr = -23036;         { no memory to send fragmented pkt }
  947.       ipRouteErr = -23037;             { can't route packet off-net }
  948.  
  949.       nameSyntaxErr = -23041;
  950.       cacheFaultErr = -23042;
  951.       noResultProcErr = -23043;
  952.       noNameServerErr = -23044;
  953.       authNameErrErr = -23045;
  954.       noAnsErr = -23046;
  955.       dnrErr = -23047;
  956.       outOfMemoryErr = -23048;
  957.  
  958. { connectionState }
  959.    const
  960.       CState_Closed = 0;
  961.       CState_Listening = 2;
  962.       CState_Opening1 = 4;
  963.       CState_Opening2 = 6;
  964.       CState_Established = 8;
  965.       CState_Closing1 = 10;
  966.       CState_Closing2 = 12;
  967.       CState_Closing3 = 16;
  968.       CState_Closing4 = 18;
  969.       CState_Closing5 = 20;
  970.       CState_PleaseClose = 14;
  971.  
  972.    type
  973.       AddrClasses = integer;
  974.    const
  975.       AC_A = 1;
  976.       AC_NS = 2;
  977.       AC_CNAME = 5;
  978.       AC_HINFO = 13;
  979.       AC_MX = 15;
  980.  
  981.    const
  982.       CTRUE = $FF;
  983.       CFALSE = $00;
  984.  
  985.    type
  986.       C_BOOLEAN = signedByte;
  987.       CSTRING = ptr;
  988.       CStr30 = packed array[0..29] of char;
  989.       CStr255 = packed array[0..255] of char;
  990.       ipAddr = longInt;
  991.       ipPort = integer;
  992.       StreamPtr = ptr;
  993.  
  994.    type
  995.       wdsType = record        { Write block for TCP driver. }
  996.             size: integer;          { Number of bytes. }
  997.             buffer: Ptr;            { Pointer to bytes. }
  998.             term: integer;          { Zero for end of blocks. }
  999.          end;
  1000.       wdsPtr = ^wdsType;
  1001.       wdsEntry = record
  1002.             size: integer;          { Number of bytes. }
  1003.             buffer: Ptr;            { Pointer to bytes. }
  1004.          end;
  1005.  
  1006.       hostInfo = record
  1007.             rtnCode: longInt;
  1008.             rtnHostName: str255;
  1009.             addrs: array[1..4] of ipAddr;
  1010.          end;
  1011.       hostInfoPtr = ^hostInfo;
  1012.  
  1013.    type
  1014.       HInfoRec = record
  1015.             cpuType: CStr30;
  1016.             osType: CStr30;
  1017.          end;
  1018.  
  1019.    type
  1020.       MXRec = record
  1021.             preference: integer; { unsigned! }
  1022.             exchange: CStr255;
  1023.          end;
  1024.  
  1025.    type
  1026.       hmxInfoRec = record
  1027.             rtcCode: integer;
  1028.             cname: CStr255;
  1029.             case integer of
  1030.                1: (
  1031.                      addr: array[1..4] of ipAddr;
  1032.                );
  1033.                2: (
  1034.                      hinfo: HInfoRec;
  1035.                );
  1036.                3: (
  1037.                      mx: MXRec;
  1038.                );
  1039.          end;
  1040.       hmxInfoRecPtr = ^hmxInfoRec;
  1041.  
  1042.    type
  1043.       cacheEntryRecord = record
  1044.             cname: CSTRING;
  1045.             typ: integer;
  1046.             class: integer;
  1047.             ttl: longInt;
  1048.             case integer of
  1049.                1: (
  1050.                      name: CSTRING;
  1051.                );
  1052.                2: (
  1053.                      addr: ipAddr;
  1054.                );
  1055.          end;
  1056.       cacheEntryRecordPtr = ^cacheEntryRecord;
  1057.  
  1058.    const { csCodes for the TCP driver: }
  1059.       TCPcsGetMyIP = 15;
  1060.       TCPcsEchoICMP = 17;
  1061.       TCPcsLAPStats = 19;
  1062.       TCPcsCreate = 30;
  1063.       TCPcsPassiveOpen = 31;
  1064.       TCPcsActiveOpen = 32;
  1065. {    TCPcsActOpenWithData = 33;}
  1066.       TCPcsSend = 34;
  1067.       TCPcsNoCopyRcv = 35;
  1068.       TCPcsRcvBfrReturn = 36;
  1069.       TCPcsRcv = 37;
  1070.       TCPcsClose = 38;
  1071.       TCPcsAbort = 39;
  1072.       TCPcsStatus = 40;
  1073.       TCPcsExtendedStat = 41;
  1074.       TCPcsRelease = 42;
  1075.       TCPcsGlobalInfo = 43;
  1076.  
  1077.       UDPcsCreate = 20;
  1078.       UDPcsRead = 21;
  1079.       UDPcsBfrReturn = 22;
  1080.       UDPcsWrite = 23;
  1081.       UDPcsRelease = 24;
  1082.       UDPcsMaxMTUSize = 25;
  1083.       UDPcsStatus = 26;
  1084.       UDPcsMultiCreate = 27;
  1085.       UDPcsMultiSend = 28;
  1086.       UDPcsMultiRead = 29;
  1087.  
  1088.    type
  1089.       TCPEventCode = integer;
  1090.    const
  1091.       TEC_Closing = 1;
  1092.       TEC_ULPTimeout = 2;
  1093.       TEC_Terminate = 3;
  1094.       TEC_DataArrival = 4;
  1095.       TEC_Urgent = 5;
  1096.       TEC_ICMPReceived = 6;
  1097.       TEC_last = 32767;
  1098.  
  1099.    type
  1100.       UDPEventCode = integer;
  1101.    const
  1102.       UDPDataArrival = 1;
  1103.       UDPICMPReceived = 2;
  1104.       lastUDPEvent = 32767;
  1105.  
  1106.    type
  1107.       TCPTerminateReason = integer;
  1108.    const {TCPTerminateReasons: }
  1109.       TTR_RemoteAbort = 2;
  1110.       TTR_NetworkFailure = 3;
  1111.       TTR_SecPrecMismatch = 4;
  1112.       TTR_ULPTimeoutTerminate = 5;
  1113.       TTR_ULPAbort = 6;
  1114.       TTR_ULPClose = 7;
  1115.       TTR_ServiceError = 8;
  1116.       TTR_last = 32767;
  1117.  
  1118.    type
  1119.       ICMPMsgType = integer;
  1120.    const
  1121.       ICMP_NetUnreach = 0;
  1122.       ICMP_HostUnreach = 1;
  1123.       ICMP_ProtocolUnreach = 2;
  1124.       ICMP_PortUnreach = 3;
  1125.       ICMP_FragReqd = 4;
  1126.       ICMP_SourceRouteFailed = 5;
  1127.       ICMP_TimeExceeded = 6;
  1128.       ICMP_ParmProblem = 7;
  1129.       ICMP_MissingOption = 8;
  1130.  
  1131.    type
  1132.       TCPNotifyProc = procPtr;
  1133. { procedure TCPNotifyProc(tcpStream:StreamPtr; event:TCPEventCode;
  1134. userDataPtr:ptr; }
  1135. {                                   terminReason:TCPTerminateReason;
  1136. icmpMsg:ICMPReportPtr); }
  1137.  
  1138.    type
  1139.       TCPIOCompletionProc = procPtr;
  1140. { C procedure TCPIOCompletionProc(iopb:TCPControlBlockPtr); - WHY IS THIS
  1141. A C PROC???? }
  1142.  
  1143.    type
  1144.       UDPNotifyProc = procPtr;
  1145. { procedure UDPProc(udpStream:StreamPtr ;
  1146. eventCode:integer;userDataPtr:ptr; icmpMsg:ICMPReportPtr) }
  1147.  
  1148.    type
  1149.       UDPIOCompletionProc = procPtr;
  1150. { C procedure UDPIOCompletionProc(iopb:UDPiopb Ptr) }
  1151.  
  1152.    type
  1153.       ICMPEchoNotifyProc = ProcPtr;
  1154. { C procedure ICMPEchoNotifyProc(iopb:IPControlBlockPtr) }
  1155. { WARNING: Ignore the docs, its a C proceudre no matter what they say }
  1156.  
  1157.    type
  1158.       ICMPReport = record
  1159.             stream: StreamPtr;
  1160.             localHost: ipAddr;
  1161.             localPort: ipPort;
  1162.             remoteHost: ipAddr;
  1163.             remotePort: ipPort;
  1164.             reportType: ICMPMsgType;
  1165.             optionalAddlInfo: integer;
  1166.             optionalAddlInfoPtr: ptr;
  1167.          end;
  1168.  
  1169.    const
  1170.       NBP_TABLE_SIZE = 20;       { number of NBP table entries }
  1171.       NBP_MAX_NAME_SIZE = 16 + 10 + 2;
  1172.       ARP_TABLE_SIZE = 20;       { number of ARP table entries }
  1173.  
  1174.    type
  1175.       nbpEntry = record
  1176.             ip_address: ipAddr;           { IP address }
  1177.             at_address: longInt;          { matching AppleTalk address }
  1178.             gateway: Boolean;          { TRUE if entry for a gateway }
  1179.             valid: Boolean;               { TRUE if LAP address is valid }
  1180.             probing: Boolean;          { TRUE if NBP lookup pending }
  1181.             age: integer;              { ticks since cache entry verified }
  1182.             access: integer;              { ticks since last access }
  1183.             filler: packed array[1..116] of byte;        { for internal
  1184. use only !!! }
  1185.          end;
  1186.       EnetAddr = record
  1187.             en_hi: integer;
  1188.             en_lo: longInt;
  1189.          end;
  1190.       arpEntry = record
  1191.             age: integer;        { cache aging field }
  1192.             protocol: integer;      { Protocol type }
  1193.             ip_address: ipAddr;     { IP address }
  1194.             en_address: EnetAddr;      { matching Ethernet address }
  1195.          end;
  1196.       AddrXlation = record
  1197.             case integer of
  1198.                0: (
  1199.                      arp_table: ^arpEntry
  1200.                );
  1201.                1: (
  1202.                      nbp_entry: ^nbpEntry
  1203.                )
  1204.          end;
  1205.       LAPStats = record
  1206.             ifType: integer;
  1207.             ifString: CSTRING;
  1208.             ifMaxMTU: integer;
  1209.             ifSpeed: longInt;
  1210.             ifPhyAddrLength: integer;
  1211.             ifPhysicalAddress: CSTRING;
  1212.             addr: AddrXlation;
  1213.             slotNumber: integer;
  1214.          end;
  1215.       IPEchoPB = record
  1216.             dest: ipAddr;           { echo to IP address }
  1217.             data: wdsEntry;
  1218.             timeout: integer;
  1219.             options: Ptr;
  1220.             optLength: integer;
  1221.             icmpCompletion: ICMPEchoNotifyProc;
  1222.             userDataPtr: ptr;
  1223.          end;
  1224.       LAPStatsPB = record
  1225.             lapStatsPtr: ^LAPStats;
  1226.          end;
  1227.       ICMPEchoInfo = record
  1228.             params: array[1..11] of integer;
  1229.             echoRequestOut: longInt;   { time in ticks of when the echo
  1230. request went out }
  1231.             echoReplyIn: longInt;      { time in ticks of when the reply
  1232. was received }
  1233.             data: wdsEntry;      { data received in responce }
  1234.             options: ptr;
  1235.             userDataPtr: ptr;
  1236.          end;
  1237.       IPGetMyIPPB = record
  1238.             ourAddress: ipAddr;        { our IP address }
  1239.             ourNetMask: ipAddr;        { our IP net mask }
  1240.          end;
  1241.  
  1242.       IPControlBlock = record
  1243.             qLink: QElemPtr;
  1244.             qType: INTEGER;
  1245.             ioTrap: INTEGER;
  1246.             ioCmdAddr: Ptr;
  1247.             ioCompletion: TCPIOCompletionProc; {completion routine, or NIL
  1248. if none}
  1249.             ioResult: OSErr; {result code}
  1250.             ioNamePtr: StringPtr;
  1251.             ioVRefNum: INTEGER;
  1252.             ioCRefNum: INTEGER; {device refnum}
  1253.             case csCode : integer of
  1254.                TCPcsGetMyIP: (
  1255.                      getmyip: IPGetMyIPPB;
  1256.                );
  1257.                TCPcsEchoICMP: (
  1258.                      echo: IPEchoPB
  1259.                );
  1260.                9999: (
  1261.                      echoinfo: ICMPEchoInfo
  1262.                );
  1263.                TCPcsLAPStats: (
  1264.                      lapstat: LAPStatsPB
  1265.                );
  1266.          end;
  1267.       IPControlBlockPtr = ^IPControlBlock;
  1268.  
  1269.    type
  1270.       UDPCreatePB = record { for create and release calls }
  1271.             rcvBuff: Ptr;
  1272.             rcvBuffLen: longInt;
  1273.             notifyProc: UDPNotifyProc;
  1274.             localport: ipPort;
  1275.             userDataPtr: ptr;
  1276.             endingPort: ipPort;
  1277.          end;
  1278.  
  1279.    type
  1280.       UDPSendPB = record
  1281.             reserved: integer;
  1282.             remoteIP: ipAddr;
  1283.             remotePort: ipPort;
  1284.             wds: wdsPtr;
  1285.             checkSum: signedByte;
  1286.             sendLength: integer;
  1287.             userDataPtr: ptr;
  1288.             localPort: ipPort;
  1289.          end;
  1290.  
  1291.    type
  1292.       UDPReceivePB = record
  1293.             timeOut: integer;
  1294.             remoteIP: ipAddr;
  1295.             remotePort: ipPort;
  1296.             rcvBuff: ptr;
  1297.             rcvBuffLen: integer;
  1298.             secondTimeStamp: integer;
  1299.             userDataPtr: ptr;
  1300.             destHost: ipAddr;
  1301.             destPort: ipPort;
  1302.          end;
  1303.  
  1304.    type
  1305.       UDPMTUPB = record
  1306.             mtuSize: integer;
  1307.             remoteIP: ipAddr;
  1308.             userDataPtr: ptr;
  1309.          end;
  1310.  
  1311.    type
  1312.       UDPControlBlock = record
  1313.             qLink: QElemPtr;
  1314.             qType: INTEGER;
  1315.             ioTrap: INTEGER;
  1316.             ioCmdAddr: Ptr;
  1317.             ioCompletion: UDPIOCompletionProc;
  1318.             ioResult: OSErr;
  1319.             ioNamePtr: stringPtr;
  1320.             ioVRefNum: integer;
  1321.             ioCRefNum: integer;
  1322.             csCode: integer;
  1323.             udpStream: streamPtr;
  1324.             case integer of
  1325.                UDPcsCreate, UDPcsMultiCreate, UDPcsRelease: (
  1326.                      create: UDPCreatePB
  1327.                );
  1328.                UDPcsWrite, UDPcsMultiSend: (
  1329.                      send: UDPSendPB
  1330.                );
  1331.                UDPcsRead, UDPcsMultiRead: (
  1332.                      receive: UDPReceivePB
  1333.                );
  1334.                UDPcsBfrReturn: (
  1335.                      return: UDPReceivePB
  1336.                );
  1337.                UDPcsMaxMTUSize: (
  1338.                      mtu: UDPMTUPB
  1339.                );
  1340.          end;
  1341.       UDPControlBlockPtr = ^UDPControlBlock;
  1342.  
  1343.    const { Validity Flags }
  1344.       timeOutValue = $80;
  1345.       timeOutAction = $40;
  1346.       typeOfService = $20;
  1347.       precedence = $10;
  1348.  
  1349.    const { TOSFlags }
  1350.       lowDelay = $01;
  1351.       throughPut = $02;
  1352.       reliability = $04;
  1353.  
  1354.    type
  1355.       TCPCreatePB = packed record
  1356.             rcvBuff: ptr;
  1357.             rcvBuffLen: longInt;
  1358.             notifyProc: TCPNotifyProc;
  1359.             userDataPtr: ptr;
  1360.          end;
  1361.  
  1362.       TCPOpenPB = packed record
  1363.             ulpTimeoutValue: byte;
  1364.             ulpTimeoutAction: signedByte;
  1365.             validityFlags: byte;
  1366.             commandTimeoutValue: byte;
  1367.             remoteHost: ipAddr;
  1368.             remotePort: ipPort;
  1369.             localHost: ipAddr;
  1370.             localPort: ipPort;
  1371.             tosFlags: byte;
  1372.             precedence: byte;
  1373.             dontFrag: C_BOOLEAN;
  1374.             timeToLive: byte;
  1375.             security: byte;
  1376.             optionCnt: byte;
  1377.             options: array[0..39] of byte;
  1378.             userDataPtr: ptr;
  1379.          end;
  1380.  
  1381.       TCPSendPB = packed record
  1382.             ulpTimeoutValue: byte;
  1383.             ulpTimeoutAction: signedByte;
  1384.             validityFlags: byte;
  1385.             pushFlag: byte;
  1386.             urgentFlag: C_BOOLEAN;
  1387.             wds: wdsptr;
  1388.             sendFree: longInt;
  1389.             sendLength: integer;
  1390.             userDataPtr: ptr;
  1391.          end;
  1392.  
  1393.       TCPReceivePB = packed record
  1394.             commandTimeoutValue: byte;
  1395.             filler: byte;
  1396.             markFlag: C_BOOLEAN;
  1397.             urgentFlag: C_BOOLEAN;
  1398.             rcvBuff: ptr;
  1399.             rcvBuffLength: integer;
  1400.             rdsPtr: ptr;
  1401.             rdsLength: integer;
  1402.             secondTimeStamp: integer;
  1403.             userDataPtr: ptr;
  1404.          end;
  1405.  
  1406.       TCPClosePB = packed record
  1407.             ulpTimeoutValue: byte;
  1408.             ulpTimeoutAction: signedByte;
  1409.             validityFlags: byte;
  1410.             userDataPtrX: ptr;   { Thats mad!  Its not on a word boundary!
  1411. Parhaps a documentation bug??? }
  1412.          end;
  1413.  
  1414.       HistoBucket = packed record
  1415.             value: integer;
  1416.             counter: longInt;
  1417.          end;
  1418.  
  1419.    const
  1420.       NumOfHistoBuckets = 7;
  1421.  
  1422.    type
  1423.       TCPConnectionStats = packed record
  1424.             dataPktsRcvd: longInt;
  1425.             dataPktsSent: longInt;
  1426.             dataPktsResent: longInt;
  1427.             bytesRcvd: longInt;
  1428.             bytesRcvdDup: longInt;
  1429.             bytesRcvdPastWindow: longInt;
  1430.             bytesSent: longInt;
  1431.             bytesResent: longInt;
  1432.             numHistoBuckets: integer;
  1433.             sentSizeHisto: array[1..NumOfHistoBuckets] of HistoBucket;
  1434.             lastRTT: integer;
  1435.             tmrRTT: integer;
  1436.             rttVariance: integer;
  1437.             tmrRTO: integer;
  1438.             sendTries: byte;
  1439.             sourceQuenchRcvd: byte;
  1440.          end;
  1441.       TCPConnectionStatsPtr = ^TCPConnectionStats;
  1442.  
  1443.       TCPStatusPB = packed record
  1444.             ulpTimeoutValue: byte;
  1445.             ulpTimeoutAction: signedByte;
  1446.             unused: longInt;
  1447.             remoteHost: ipAddr;
  1448.             remotePort: ipPort;
  1449.             localHost: ipAddr;
  1450.             localPort: ipPort;
  1451.             tosFlags: byte;
  1452.             precedence: byte;
  1453.             connectionState: byte;
  1454.             filler: byte;
  1455.             sendWindow: integer;
  1456.             rcvWindow: integer;
  1457.             amtUnackedData: integer;
  1458.             amtUnreadData: integer;
  1459.             securityLevelPtr: ptr;
  1460.             sendUnacked: longInt;
  1461.             sendNext: longInt;
  1462.             congestionWindow: longInt;
  1463.             rcvNext: longInt;
  1464.             srtt: longInt;
  1465.             lastRTT: longInt;
  1466.             sendMaxSegSize: longInt;
  1467.             connStatPtr: TCPConnectionStatsPtr;
  1468.             userDataPtr: ptr;
  1469.          end;
  1470.  
  1471.       TCPAbortPB = packed record
  1472.             userDataPtr: ptr;
  1473.          end;
  1474.  
  1475.       TCPParam = packed record
  1476.             tcpRTOA: StringPtr;
  1477.             tcpRTOMin: longInt;
  1478.             tcpRTOMax: longInt;
  1479.             tcpMaxSegSize: longInt;
  1480.             tcpMaxConn: longInt;
  1481.             tcpMaxWindow: longInt;
  1482.          end;
  1483.       TCPParamPtr = ^TCPParam;
  1484.  
  1485.       TCPStats = packed record
  1486.             tcpConnAttempts: longInt;
  1487.             tcpConnOpened: longInt;
  1488.             tcpConnAccepted: longInt;
  1489.             tcpConnClosed: longInt;
  1490.             tcpConnAborted: longInt;
  1491.             tcpOctetsIn: longInt;
  1492.             tcpOctetsOut: longInt;
  1493.             tcpOctetsInDup: longInt;
  1494.             tcpOctetsRetrans: longInt;
  1495.             tcpInputPackets: longInt;
  1496.             tcpOutputPkts: longInt;
  1497.             tcpDupPkts: longInt;
  1498.             tcpRetransPkts: longInt;
  1499.          end;
  1500.       TCPStatsPtr = ^TCPStats;
  1501.  
  1502.       StreamPtrArray = array[1..1000] of StreamPtr;
  1503.       StreamPtrArrayPtr = ^StreamPtrArray;
  1504.  
  1505.       TCPGlobalInfoPB = packed record
  1506.             tcpParamp: TCPParamPtr;
  1507.             tcpStatsp: TCPStatsPtr;
  1508.             tcpCDBTable: StreamPtrArrayPtr;
  1509.             userDataPtr: ptr;
  1510.             maxTCPConnections: integer;
  1511.          end;
  1512.  
  1513.       TCPControlBlock = record
  1514.             qLink: QElemPtr;
  1515.             qType: INTEGER;
  1516.             ioTrap: INTEGER;
  1517.             ioCmdAddr: Ptr;
  1518.             ioCompletion: TCPIOCompletionProc; {completion routine, or NIL
  1519. if none}
  1520.             ioResult: OSErr; {result code}
  1521.             ioNamePtr: StringPtr;
  1522.             ioVRefNum: INTEGER;
  1523.             ioCRefNum: INTEGER; {device refnum}
  1524.             csCode: integer;
  1525.             tcpStream: StreamPtr;
  1526.             case integer of
  1527.                TCPcsCreate: (
  1528.                      create: TCPCreatePB
  1529.                );
  1530.                TCPcsActiveOpen, TCPcsPassiveOpen: (
  1531.                      open: TCPOpenPB;
  1532.                );
  1533.                TCPcsSend: (
  1534.                      send: TCPSendPB;
  1535.                );
  1536.                TCPcsNoCopyRcv, TCPcsRcvBfrReturn, TCPcsRcv: (
  1537.                      receive: TCPReceivePB;
  1538.                );
  1539.                TCPcsClose: (
  1540.                      close: TCPClosePB;
  1541.                );
  1542.                TCPcsAbort: (
  1543.                      abort: TCPAbortPB;
  1544.                );
  1545.                TCPcsStatus: (
  1546.                      status: TCPStatusPB;
  1547.                );
  1548.                TCPcsGlobalInfo: (
  1549.                      globalInfo: TCPGlobalInfoPB
  1550.                );
  1551.          end;
  1552.       TCPControlBlockPtr = ^TCPControlBlock;
  1553.  
  1554. implementation
  1555.  
  1556. end.
  1557. -- 
  1558. Peter N Lewis <peter.lewis@info.curtin.edu.au> - Macintosh TCP fingerpainter
  1559. FTP my programs from redback.cs.uwa.edu.au:Others/PeterLewis/ or
  1560. amug.org:pub/peterlewis/ or nic.switch.ch:software/mac/peterlewis/
  1561.  
  1562. ---------------------------
  1563.  
  1564. >From woody@alumni.caltech.edu (William Edward Woody)
  1565. Subject: Is there a reasonable alternative to BalloonWriter?
  1566. Date: 13 Sep 1994 05:13:29 GMT
  1567. Organization: California Institute of Technology, Alumni Association
  1568.  
  1569.  
  1570. Pretty much what the subject line says.
  1571.  
  1572. Thus far I'm aware of three ways to write balloon help.
  1573. First, there's writing a resource script and compile that
  1574. with MPW's rez; and while that's marginally okay, (1) rez
  1575. cannot be compiled inside of CW (I have to use the toolserver),
  1576. and (2) rez scripts are a pain if the person who is writing
  1577. them is not a Macintosh programmer.
  1578.  
  1579. The second way is to use BalloonWriter. That'd be okay,
  1580. except the existing one is buggier than hell, won't even
  1581. run on a Quadra, and Apple seemed to have dropped it like
  1582. a hot potato.
  1583.  
  1584. The third way is apparently through Resourcerer. And
  1585. somehow I don't see paying $300 when for 99% of the
  1586. resources, I'm perfectly happy with ResEdit.
  1587.  
  1588. Is there another alternative I'm not aware of?
  1589.  
  1590. Or will Apple bother to finish BalloonWriter and at least
  1591. fix the bugs that prevent it from running on my Quadra 700?
  1592.  
  1593.                         - Bill
  1594. -- 
  1595. o William Edward Woody      | "I'm shying from the light
  1596.   In Phase Consulting      |  I always loved the night
  1597.   337 West California #4  |  And now you offer me eternal darkness"
  1598.   Glendale, CA 91203      |          - Depeche Mode, "One Caress"
  1599.  
  1600. +++++++++++++++++++++++++++
  1601.  
  1602. >From oster@netcom.com (David Phillip Oster)
  1603. Date: Tue, 13 Sep 1994 17:14:43 GMT
  1604. Organization: Netcom Online Communications Services (408-241-9760 login: guest)
  1605.  
  1606.  
  1607. I don't like BalloonWriter, because it puts the help text in the body
  1608. of the 'hmnu' and 'hdlg' resources, and since there is so much repetition,
  1609. it is better to indirect from the 'hmnu' and 'hdlg' resources to STR#s,
  1610. so you can just reference multiple instances of the same string.
  1611.  
  1612. I've written a program, called Balloony that works as follows:
  1613. you drop the application on to it. It makes a applicationHelp.r file that
  1614. contains 'hmnu' and 'hdlg' resources for all menus and dialogs, indirected
  1615. to dummy STR#s that are initialized with the menu text and the DITL text.
  1616. if you use CNTL resources, it indirects through to them and puts their title
  1617. string in the STR#. If there is no title, it uses a generic string like:
  1618. "icon" or "pict".  Having the help text in STR#s makes internationalization
  1619. easier.
  1620.  
  1621. I will license a single user copy to you for $20.00, if you are interested,
  1622. or you can always write your own.
  1623. -- 
  1624. - ------- oster@netcom.com ----------
  1625. "Wendy, you were born a ninja princess, but you were kidnapped by a
  1626. band of tax accountants who raised you as their own." -- Ninja C.P.A.
  1627.  
  1628. +++++++++++++++++++++++++++
  1629.  
  1630. >From Paul Ferguson <pferguson@kaleida.com>
  1631. Date: 14 Sep 1994 20:38:12 GMT
  1632. Organization: Kaleida Labs, Inc.
  1633.  
  1634. In article <osterCw2vwK.7x4@netcom.com> David Phillip Oster, oster@netcom.com
  1635. writes:
  1636. > [... Balloony ...]
  1637. > I will license a single user copy to you for $20.00, if you are interested,
  1638. > or you can always write your own.
  1639.  
  1640. Why not release it as shareware?  It sounds like a handy little
  1641. utility.
  1642.  
  1643. --fergy
  1644.  
  1645. - ------------------------------------------------------------------
  1646.   Paul Ferguson         | "It's a sick world, I'm a happy guy..."
  1647.   pferguson@kaleida.com |  
  1648. - ------------------------------------------------------------------
  1649.  
  1650. +++++++++++++++++++++++++++
  1651.  
  1652. >From peter.lewis@info.curtin.edu.au (Peter N Lewis)
  1653. Date: Fri, 16 Sep 1994 14:54:29 +0800
  1654. Organization: NCRPDA, Curtin University
  1655.  
  1656. In article <353cdp$7h3@gap.cco.caltech.edu>, woody@alumni.caltech.edu
  1657. (William Edward Woody) wrote:
  1658.  
  1659.  
  1660. >Thus far I'm aware of three ways to write balloon help.
  1661. >First, there's writing a resource script and compile that
  1662. >with MPW's rez; and while that's marginally okay, (1) rez
  1663. >cannot be compiled inside of CW (I have to use the toolserver),
  1664. >and (2) rez scripts are a pain if the person who is writing
  1665. >them is not a Macintosh programmer.
  1666.  
  1667. This can be simplified a fair bit using Perl to parse a high level
  1668. format.  This is what I do, and it automates most of the process.
  1669.  
  1670. **** High level balloon help data for Anarchie
  1671. DIALOG 200 Archie
  1672.  
  1673. 1.1 Click this to begin the search.
  1674.  
  1675. 2.1 Click this to close the window without starting a search.
  1676.  
  1677. 4.1 Click this to save this query into a bookmark document.
  1678.  
  1679. 5.3 Use this popup menu to select a server from a list of common servers.
  1680. 5.4 Use this popup menu to select a server from a list of common servers.
  1681.  
  1682. 6.1 Type the name of the Archie server to query here. Alternatively you
  1683. can select a server from the popup menu.
  1684.  
  1685. 7.1 Type the text of your query here.
  1686.  
  1687. 8.1 Click this to use a sub-string matching query.
  1688. 8.3 The query will be a simple sub-string match. It will return any entry
  1689. whose name contains the Find string.
  1690. 9.1 Click this to use a pattern matching query.
  1691. 9.3 The Find string is interpreted as a pattern and the query returns
  1692. entries that match the pattern. * matches any sequences of characters, ?
  1693. matches any single character.
  1694. 10.1 Click this to use a regular expression matching query.
  1695. 10.3 The Find string is interpreted as a regular expression and the query
  1696. returns entries that match the regex. Regexes are too complicated to
  1697. explain here.
  1698.  
  1699. 11.1 The query will be case-insensitive, thus ≥Frog≤, ≥frog≤ and ≥FROG≤
  1700. will be considered the same.
  1701. 11.3 The query will be case-sensitive, thus ≥frog≤ and ≥FROG≤ will be
  1702. considered different.
  1703.  
  1704. 12.1 Type the maximum number of matching entries to be returned by the
  1705. query here.
  1706.  
  1707. END-DIALOG
  1708.  
  1709. DIALOG 500 Preferences Dialog
  1710.  
  1711. 1.1 Click this to save the preferences.
  1712.  
  1713. 2.1 Click this to discard any changes you have made since you last saved
  1714. the preferences.
  1715.  
  1716. 4.1 Type your Email address here. This address is used as the password
  1717. when you log into anonymous FTP servers.
  1718.  
  1719. 5.1 Type the name of your prefered Info-Mac mirror site (host:path
  1720. format). Alternatively you can select a server from the popup menu.
  1721.  
  1722. 6.3 Use this popup menu to select an Info-Mac mirror from a list of mirrors.
  1723. 6.4 Use this popup menu to select an Info-Mac mirror from a list of mirrors.
  1724.  
  1725. 7.1 Type the name of your prefered UMich mirror site (host:path format).
  1726. Alternatively you can select a server from the popup menu.
  1727.  
  1728. 8.3 Use this popup menu to select an UMich mirror from a list of mirrors.
  1729. 8.4 Use this popup menu to select an UMich mirror from a list of mirrors.
  1730.  
  1731. 9.3 Select the face of the font you wish to use in new windows.
  1732. 9.4 Select the face of the font you wish to use new windows.
  1733.  
  1734. 10.1 Type the size (in points) of the font you wish to use in new windows here.
  1735.  
  1736. 11.1 Anarchie will not open a blank Find window when it is launched.
  1737. 11.3 Anarchie will open a blank Find window when it is launched.
  1738.  
  1739. 12.1 Anarchie will not open the bookmark listing window when it is launched.
  1740. 12.3 Anarchie will open the bookmark listing window when it is launched.
  1741.  
  1742. 13.1 Click this to specify the folder in which to place downloaded files.
  1743.  
  1744. 14.1 Anarchie will not decode fetched files.
  1745. 14.3 Anarchie will use StuffIt Expander to decode fetched files.
  1746.  
  1747. 15.1 Click here to use normal FTP when transferring files.
  1748. 15.3 Normal (anonymous) FTP will be used when transferring files.
  1749. 16.1 Click here to use the specified Alex server when transferring files.
  1750. 16.3 The specified Alex server will be used when transferring files.
  1751. 17.1 Click here to use the specified proxy firewall when transferring files.
  1752. 17.3 The specified firewall will be used when transferring files.
  1753. 18.1 Click here to use the specified SOCKS firewall when transferring files.
  1754. 18.3 The specified SOCKS firewall will be used when transferring files.
  1755.  
  1756. 19.1 Type the address of your preferred Alex server here.
  1757.  
  1758. 20.1 Type the address of your personal, very own, favourite proxy firewall
  1759. server here.
  1760.  
  1761. 21.1 Type the address of your personal, very own, favourite SOCKS firewall
  1762. server here.
  1763.  
  1764. 22.1 This displays the country code of the country in which Anarchie
  1765. thinks you are located. Anarchie uses this to calculate the distance value
  1766. in listing windows.
  1767. 22.2 This displays the country code of the country in which Anarchie
  1768. thinks you are located. Anarchie uses this to calculate the distance value
  1769. in listing windows.
  1770.  
  1771. 23.1 You have not paid for this copy of ≥Anarchie≤.
  1772. 23.3 You have paid for this copy of ≥Anarchie≤. Thanks!!!
  1773.  
  1774. END-DIALOG
  1775.  
  1776. DIALOG 600 FTP
  1777.  
  1778. 1.1 Click this button to fetch the file or listing.
  1779. 1.2 This buttons fetches the specified file or listing. Not available
  1780. because you have not specified a valid host and path, or you donπt have
  1781. enough free memory.
  1782.  
  1783. 2.1 Click this button to close the window without fetching a file or listing.
  1784.  
  1785. 4.1 Click this button to save this fetch command into a bookmark document.
  1786. 4.2 This button saves this fetch command into a bookmark document. Not
  1787. available because you have not specified a valid host and path.
  1788.  
  1789. 5.1 Type a host name here eg ≥redback.cs.uwa.edu.au≤.
  1790. 6.1 Type a path here eg ≥/ComSci/ReadMeAboutRedback≤.
  1791. 7.1 Type a username here eg ≥fred≤.  Leave the field blank for anonymous FTP.
  1792. 8.1 Type a password here eg ≥oihhlkhu≤.  Leave the field blank for
  1793. anonymous FTP.  Characters will be displayed as ≥Ä≤.
  1794.  
  1795. 9.1 Click here if the path leads to a directory. command-1 is a shortcut
  1796. for this.
  1797. 9.3 The specified path should lead to directory. If the path leads to file
  1798. then you will get a listing window with just that file in it.
  1799. 10.1 Click here if the path leads to a file. command-2 is a shortcut for this.
  1800. 10.3 The specified path should lead to a file. If the path leads to a
  1801. directory then you will get an error.
  1802. 11.1 Click here if the path leads to a text file you wish to view.
  1803. command-3 is a shortcut for this.
  1804. 11.3 The specified path should lead to a text file. If the path leads to a
  1805. directory then you will get an error.
  1806. 12.1 Click here to try indexing the ftp site (type a search string into
  1807. the second field). command-4 is a shortcut for this.
  1808. 12.3 The specified index string will be used to search the ftp site (if it
  1809. supports SITE INDEX).
  1810.  
  1811. END-DIALOG
  1812.  
  1813. DIALOG 2004 Find
  1814.  
  1815. 1.1 Click this button to find an entry in the listing.
  1816.  
  1817. 2.1 Click this button to close the window without finding anything.
  1818.  
  1819. 4.1 Type in the text to search for.
  1820.  
  1821. 5.1 Only the first entry will be found.
  1822. 5.3 All matching entries swill be selected.
  1823.  
  1824. END-DIALOG
  1825.  
  1826. MENU 129 File
  1827.  
  1828. 0 xxxx,,,File
  1829. 1 Use this menu to search for files, retrieve files, save bookmarks and
  1830. save listings.
  1831.  
  1832. 0 arch,T,,Archieä
  1833. 1 Search for a file by querying an Archie server.
  1834. 2 Search for a file. Not available because there is already a Search
  1835. window open.
  1836.  
  1837. 0 fget,E,,Getä
  1838. 1 Get a file or listing from an FTP site. You must enter the host name and
  1839. path of the file
  1840. 2 Get a file from an FTP site. Not available because there is not enough
  1841. free memory.
  1842.  
  1843. 0 gets,,,Get Selection
  1844. 1 Get the selected file or listing from an FTP site. The ≥return≤ key is
  1845. often a shortcut for this command.
  1846. 2 Get the selected file or listing. Not available because there is nothing
  1847. selected.
  1848.  
  1849. 0 view,L,,View Selection
  1850. 1 View the selected file in your favourite text editor. This is also
  1851. useful for getting text files.
  1852. 2 View the selected file. Not available because there is nothing selected.
  1853.  
  1854. 0 rtry,R,,Retry
  1855. 1 Retry a failed ≥Get≤ or ≥Archie≤ operation. Hold down the option key to
  1856. edit the request before retrying.
  1857. 2 Retry a failed operation. Not available because the current window
  1858. cannot be retried.
  1859.  
  1860. 0 obok,O,,Open Bookmarkä
  1861. 1 Open a saved bookmark file and fetch the results. Hold down the option
  1862. key to edit the request before acting on it.
  1863. 2 Open a saved bookmark file. Not available because there is not enough
  1864. free memory.
  1865.  
  1866. 0 obms,B,,List Bookmarksä
  1867. 1 Open a window listing all the bookmarks in the Bookmarks folder.
  1868. 2 Open the bookmarks window. Not available because there is not enough
  1869. free memory.
  1870.  
  1871. 0
  1872.  
  1873. 0 sbok,S,,Save Bookmarkä
  1874. 1 Save a bookmark (or bookmark list) for later use. The bookmark refers to
  1875. either the current selection or, if there is no selection, the front
  1876. window.
  1877. 2 Save a bookmark (or bookmark list) for the front window. Not available
  1878. because the front window does not support bookmarks.
  1879.  
  1880. 0 svls,,,Save Listingä
  1881. 1 Save the front window to a text file which you can import into a
  1882. spreadsheet or word processor.
  1883. 2 Save the front window to a text file. Not available because the front
  1884. window does not support listings.
  1885.  
  1886. 0 clos,W,,Close
  1887. 1 Close the front window. Hold down the option key to close all windows.
  1888. 2 Not available because there is no window to close.
  1889.  
  1890. 0
  1891.  
  1892. 0 help,H,,Helpä
  1893. 1 Display the help window.
  1894.  
  1895. 0
  1896.  
  1897. 0 quit,Q,,Quit
  1898. 1 Quit ≥Anarchie≤.
  1899.  
  1900. END-MENU
  1901.  
  1902. MENU 130 Edit
  1903.  
  1904. 0 xxxx,,,Edit
  1905. 1 Use this menu to work with text or to set preferences.
  1906.  
  1907. 0 undo,Z,,Undo
  1908. 1 Undoes the previous text command.
  1909. 2 Not available because the last operation cannot be undone.
  1910.  
  1911. 0
  1912.  
  1913. 0 cut ,X,,Cut
  1914. 1 Cuts or removes the selected text. The text is put into the clipboard.
  1915. 2 Not available because no text is selected.
  1916.  
  1917. 0 copy,C,,Copy
  1918. 1 Copies the selected item into the clipboard.  With the option key down,
  1919. this will often copy as a URL.
  1920. 2 Not available because nothing is selected.
  1921.  
  1922. 0 past,V,,Paste
  1923. 1 Puts the current contents of the clipboard into the current selection.
  1924. 2 Not available because nothing appropriate is in the clipboard or because
  1925. you canπt paste anything into the current selection.
  1926.  
  1927. 0 clea,,,Clear
  1928. 1 Remove the selected text or delete log entries. The text is lost forever.
  1929. 2 Removes the selected text. Not available because nothing that can be
  1930. deleted is selected.
  1931.  
  1932. 0 sela,A,,Select All
  1933. 1 Select the entire contents of the front window.
  1934. 2 Not available because you canπt select anything in the front window or
  1935. because you already have selected everything.
  1936.  
  1937. 0
  1938.  
  1939. 0 find,F,,Findä
  1940. 1 Find a matching entry in the window.
  1941. 2 Not available because the front window is not a List Window.
  1942.  
  1943. 0 fagn,G,,Find Again
  1944. 1 Find the next matching entry.
  1945. 2 Not available because the front window is not a List Window.
  1946.  
  1947. 0
  1948.  
  1949. 0 ftch,,,Fetch Server List
  1950. 1 Fetch the definitive server list from an FTP site in Texas.
  1951. 2 Not available because there is not enough free memory.
  1952.  
  1953. 0 pref,,,Preferencesä
  1954. 1 Modify the preferences.
  1955. 2 Not available because the preferences window is already at the front.
  1956.  
  1957. END-MENU
  1958.  
  1959. MENU 150 Window
  1960.  
  1961. 0 xxxx,,,Window
  1962. 1 Use this menu to bring a window to the front.
  1963.  
  1964. 0 logw,,,Show Log
  1965. 1 Display the Log Window.
  1966. 2 Not available because the log window is already at the front.
  1967.  
  1968. 0 tran,,,Show Transcript
  1969. 1 Display the Transcript Window.
  1970. 2 Not available because the transcript window is already at the front.
  1971.  
  1972. END-MENU
  1973.  
  1974. END
  1975.  
  1976. (evaluate "{active}" =~ /(â)Æ1:â/ )> dev:null
  1977. directory "{Æ1}"
  1978. Perl.68k -Sx "Rocky:Peter:Perl:Balloons.pl"
  1979. rez -a -o "Anarchie.rsrc" -ov Balloons.r
  1980. delete Balloons.r
  1981. *****
  1982.  
  1983. Just change the path for Balloons.pl to point to the following file, and
  1984. change Anarchie.rsrc to be your resource file (make a copy first to be
  1985. safe).  Then edit the high level file in MPW, and select those last few
  1986. lines to update the .rsrc file.
  1987.  
  1988. ***** Balloons.pl *****
  1989. #!perl
  1990.  
  1991. $balloons_strh_id = 26724;
  1992.  
  1993. # chdir "Rocky:Peter:Pascal:TCP Work:TCP Programs:Anarchie";
  1994.  
  1995. open(STDIN,"Balloons Data") || die "Failed to open input";
  1996. open(STDOUT,">Balloons.r") || die "Failed to open output";
  1997.  
  1998. print <<INCLUDES;
  1999. #include "Types.r"
  2000. #include "BalloonTypes.r"
  2001.  
  2002. INCLUDES
  2003.  
  2004. @strings=();
  2005.  
  2006. while (<>) {
  2007.   chop;
  2008.   next if /^$/;
  2009.   last if /^END$/;
  2010.   die "Bad line '$_'" unless /(DIALOG|MENU)\s+(\d+)\s*(.*)/;
  2011.   $dialog = $1 eq "DIALOG"; $id = $2; $name=$3;
  2012.   @items=();
  2013.    @menus=();
  2014.    $menuitem=0;
  2015.   while (<>) {
  2016.     chop;
  2017.     next if /^$/;
  2018.     if ($dialog) {
  2019.        last if /^END-DIALOG$/;
  2020.        die "Bad dialog line '$_'" unless /^(\d+)\.(\d+)\s+(.*)/;
  2021.        die "Quote in line" if /"/;
  2022.        $base=($1-1)*4;
  2023.        $item=$base+$2-1;
  2024.        $index = &find_string($3);
  2025.        $items[$item] = $index;
  2026.        $items[$base+0] = 0 unless $items[$base+0];
  2027.        $items[$base+1] = 0 unless $items[$base+1];
  2028.        $items[$base+2] = 0 unless $items[$base+2];
  2029.        $items[$base+3] = 0 unless $items[$base+3];
  2030.     } else {
  2031.        last if /^END-MENU$/;
  2032.        die "Quote in line '$_'" if /"/;
  2033.        die "Bad menu line '$_'" unless /^(\d) (.*)/ || /^(\d)$/;
  2034.          if ($1 == 0) {
  2035.            if ($1 eq $_) {
  2036.              $menus[$menuitem]='-';
  2037.             } else {
  2038.               $menus[$menuitem]= $2;
  2039.             }
  2040.             $menuitem++;
  2041.          } else {
  2042.             $base=($menuitem-1)*4;
  2043.             $item=$base+$1-1;
  2044.             $index = &find_string($2);
  2045.             $items[$item] = $index;
  2046.             $items[$base+0] = 0 unless $items[$base+0];
  2047.             $items[$base+1] = 0 unless $items[$base+1];
  2048.             $items[$base+2] = 0 unless $items[$base+2];
  2049.             $items[$base+3] = 0 unless $items[$base+3];
  2050.          }
  2051.     }
  2052.   }
  2053.    if ($dialog) {
  2054.    print <<"HEADER";
  2055. resource 'hdlg' ($id,"$name") {
  2056. \t2,0,0,0,0,
  2057. \tHMSkipItem { },
  2058. \t{
  2059. HEADER
  2060.    } else {
  2061.       print <<"HEADER";
  2062. resource 'hmnu' ($id,"$name") {
  2063. \t2,0,0,0,
  2064. \tHMSkipItem { },
  2065. \t{
  2066. HEADER
  2067.    }
  2068.   for $item (1..@items/4) {
  2069.     $base = ($item-1)*4;
  2070.     if ($items[$base+0] || $items[$base+1] ||
  2071.         $items[$base+2] || $items[$base+3]) {
  2072.          print "\t\tHMStringResItem { /* $item */\n";
  2073.          if ($dialog) {
  2074.          print <<"ITEM";
  2075. \t\t\t{0,0},
  2076. \t\t\t{0,0,0,0},
  2077. ITEM
  2078.          }
  2079.       for $k (0..3) {
  2080.         $index = $items[$base+$k];
  2081.         if ($index) {
  2082.           print "\t\t\t$balloons_strh_id,$index,\n";
  2083.         } else {
  2084.           print "\t\t\t0,0,\n";
  2085.         }
  2086.       }
  2087.       print "\t\t},\n";
  2088.     } else {
  2089.         print "\t\tHMSkipItem { }, /* $item */\n";
  2090.     }
  2091.   }
  2092.   print <<"TRAILER";
  2093. \t}
  2094. };
  2095.  
  2096. TRAILER
  2097. }
  2098.  
  2099. print "resource 'STR#' ($balloons_strh_id,\"Balloon Help Strings\") {\n";
  2100. print "\t{\n";
  2101. for $index (1..@strings) {
  2102.   print "\t\t/* $index */\n";
  2103.   print "\t\t\"$strings[$index-1]\",\n";
  2104. }
  2105. print "\t}\n";
  2106. print "};\n\n";
  2107.  
  2108. close(STDOUT);
  2109. close(STDIN);
  2110.  
  2111. sub find_string {
  2112.   local($s) = @_;
  2113.   local($i);
  2114.   for $i (1..@strings) {
  2115.     return $i if $s eq $strings[$i-1];
  2116.   }
  2117.   $i = @strings;
  2118.   $strings[$i] = $s;
  2119.   return $i+1;
  2120. }
  2121. *****
  2122.  
  2123. Enjoy,
  2124.    Peter.
  2125. -- 
  2126. Peter N Lewis <peter.lewis@info.curtin.edu.au> - Macintosh TCP fingerpainter
  2127. FTP my programs from redback.cs.uwa.edu.au:Others/PeterLewis/ or
  2128. amug.org:pub/peterlewis/ or nic.switch.ch:software/mac/peterlewis/
  2129.  
  2130. ---------------------------
  2131.  
  2132. >From chrisat@ids.net (Chris Arsenault)
  2133. Subject: Need help with MDEF UPP Question
  2134. Date: 16 Sep 1994 11:26:48 GMT
  2135. Organization: Sandcastle Studios
  2136.  
  2137. I'm in the process of converting a 68k C application over to PowerPC and
  2138. ran into a snag. There's a menu def proc module that resides in the main
  2139. 68k code segment and is patched in via the code resource stub trick. This
  2140. trick doesn't work too well on the PowerPC. 
  2141.  
  2142. I thought I could still keep the MDEF module in with the application
  2143. rather than as a standalone code resource, by installing a MenuDefUPP in
  2144. the (**myMenuHandle).menuDefProc. I figured this approach would handle
  2145. either PPC or 68k and would remove the self-modifying code.   The PowerPC
  2146. version isn't working.  It keeps crashing into _MoveHLow.
  2147.  
  2148. I'd really like to keep the menudef proc in the application as it uses
  2149. globals etc.
  2150.  
  2151. Is this the right approach or is there another way to do this?  Any help
  2152. would be greatly appreciated.
  2153.  
  2154.  
  2155. Chris
  2156.  
  2157. +++++++++++++++++++++++++++
  2158.  
  2159. >From duga@pacersoft.com (Brady Duga)
  2160. Date: Fri, 16 Sep 1994 09:28:21 -0500
  2161. Organization: Pacer Software, Inc.
  2162.  
  2163. In article <chrisat-1609940719040001@pslip092.egr-ri.ids.net>,
  2164. chrisat@ids.net (Chris Arsenault) wrote:
  2165.  
  2166. > I thought I could still keep the MDEF module in with the application
  2167. > rather than as a standalone code resource, by installing a MenuDefUPP in
  2168. > the (**myMenuHandle).menuDefProc. I figured this approach would handle
  2169. > either PPC or 68k and would remove the self-modifying code.   The PowerPC
  2170. > version isn't working.  It keeps crashing into _MoveHLow.
  2171.  
  2172. In your MDEF stub, how are you calling the UPP? Remember, you can't just
  2173. call it like a function, you have to use CallUniversalProc(). For an MDEF,
  2174. you would use:
  2175.  
  2176. CallMenuBarDefProc(userRoutine, selector, message, parameter1, parameter2);
  2177.  
  2178. That's #defined in Menus.h.
  2179.  
  2180.  
  2181. --Brady
  2182.  
  2183. +++++++++++++++++++++++++++
  2184.  
  2185. >From sbill@informix.com (Bill Stackhouse)
  2186. Date: 16 Sep 1994 16:39:00 GMT
  2187. Organization: Informix Software, Inc.
  2188.  
  2189. In article <chrisat-1609940719040001@pslip092.egr-ri.ids.net> chrisat@ids.net (Chris Arsenault) writes:
  2190. >I'm in the process of converting a 68k C application over to PowerPC and
  2191. >ran into a snag. There's a menu def proc module that resides in the main
  2192. >68k code segment and is patched in via the code resource stub trick. This
  2193. >trick doesn't work too well on the PowerPC. 
  2194. >
  2195. >I thought I could still keep the MDEF module in with the application
  2196. >rather than as a standalone code resource, by installing a MenuDefUPP in
  2197. >the (**myMenuHandle).menuDefProc. I figured this approach would handle
  2198. >either PPC or 68k and would remove the self-modifying code.   The PowerPC
  2199. >version isn't working.  It keeps crashing into _MoveHLow.
  2200.  
  2201. Just went through the same problem. Here is the pseudo code:
  2202.  
  2203. #if powerpc
  2204. create handle size of UPP
  2205. create UPP
  2206. copy in the UPP
  2207. store handle in menuProc
  2208. destroy UPP
  2209. #else
  2210. create handle size 6 bytes
  2211. copy in jmp MDEF
  2212. store handle in menuProc
  2213. #endif
  2214.  
  2215.  
  2216. Bill
  2217.  
  2218. ---------------------------
  2219.  
  2220. >From boyerr@bach.seattleu.edu (Robert A. Boyer)
  2221. Subject: OpenDoc Development Environments?
  2222. Date: 18 Sep 1994 12:28:50 -0700
  2223. Organization: Seattle University, Seattle, WA, USA
  2224.  
  2225. Does anyone have experience developing OpenDoc applications on a
  2226. Macintosh using a development environment other than MPW?  What
  2227. are the pros and cons of the following C++ development environments:
  2228. MPW, Symantec, and Metroworks?
  2229.  
  2230. Thanks,
  2231.  
  2232. Robert Boyer
  2233. boyerr@seattleu.edu
  2234.  
  2235. +++++++++++++++++++++++++++
  2236.  
  2237. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  2238. Date: Tue, 20 Sep 1994 00:10:43 GMT
  2239. Organization: Apple Computer
  2240.  
  2241. The current status is that you need cfront or scpp (the Symantec MPW tool) to
  2242. build OpenDoc A6 shared libraries. If you get the OpenDoc source code CD,
  2243. there's a folder in the Goodies folder that contains a Metrowerks project.
  2244. This is a static build, with everything linked into one app, since MW doesn't
  2245. support ASLM (more on that later.)
  2246.  
  2247. The future: Ever since we moved to SOM we've been using CodeWarrior PPC as
  2248. our primary development environment, and it works fine. So when the beta seed
  2249. is released RSN you'll be able to build parts with CodeWarrior -- if you have
  2250. a PowerPC. For 68k you'll need to use the Symantec compiler, until Metrowerks
  2251. releases a 68k version of CW that supports CFM68k. I know that MW plans to do
  2252. this but I will let them reveal their schedule :-)
  2253.  
  2254. Ken Prehoda, kenp@nmrfam.wisc.edu writes:
  2255. > ASLM seems like it is sooo much nicer than SOM.  Well I
  2256. > guess it isn't if you are not using C++ (or a C++ compiler that produces
  2257. > CFront compatible vtables, etc.).
  2258.  
  2259. ASLM is certainly simpler than SOM, and can be used in some niches that SOM
  2260. can't (mostly interrupt-level stuff like networking code, not surprising
  2261. since it was developed by the AppleTalk people.) But it has a lot of failings
  2262. -- not only that it's extremely compiler-dependent, but also that the
  2263. libraries are 'fragile' and any nontrivial change to an object's
  2264. implementation will break clients. It's also C++ centric, the downside of
  2265. which is that object-based libraries cannot be developed in any language but
  2266. C++.
  2267.  
  2268. Jason Bobier, jbobier@cybernetics.net writes:
  2269. > Why doesn't MW support the ASLM? Are they planning on supporting it?
  2270.  
  2271. Metrowerks doesn't support ASLM because it would require them to adopt
  2272. cfront's calling conventions, vtable format and name-mangling scheme. At
  2273. least two of these would be major steps backward for CW on 68k (the third is
  2274. the mangling; I've never understood why there was more than one name-mangling
  2275. system in the world, can someone explain?)
  2276. ASLM will continue to play a role in Mac software, but a minor one, mosty
  2277. dominated by the Open Transport networking protocols. Metrowerks (I'm putting
  2278. words in their mouths here) decided that wasn't as interesting as other stuff
  2279. they could be doing.
  2280.  
  2281. > Seems kinda strange that they don't when PP ships with a shared library...
  2282.  
  2283. That's a CFM shared library, not an ASLM library. You can sort-of do C++
  2284. object based libraries with CFM, provided you export your nonvirtual methods.
  2285. These libraries are (as with ASLM) highly dependent on the compiler and on
  2286. the exact versions of the library and its clients.
  2287.  
  2288. --Jens Alfke                           jens_alfke@powertalk.apple.com
  2289.                    "A man, a plan, a yam, a can of Spam ... Bananama!"
  2290.  
  2291. +++++++++++++++++++++++++++
  2292.  
  2293. >From nick+@pitt.edu ( nick.c )
  2294. Date: Sun, 18 Sep 94 23:21:35 GMT
  2295. Organization: The Pitt, Chemistry
  2296.  
  2297. In Article <35i4di$sd@bach.seattleu.edu>, boyerr@bach.seattleu.edu (Robert
  2298. A. Boyer) wrote:
  2299.  
  2300. >Does anyone have experience developing OpenDoc applications on a
  2301. >Macintosh using a development environment other than MPW?  What
  2302. >are the pros and cons of the following C++ development environments:
  2303. >MPW, Symantec, and Metroworks?
  2304.  
  2305.     With a6, you can only use MPW or Symantec.  MW doesn't support
  2306.       ASLM, however I've heard later releases of OpenDoc will be
  2307.       supported by CodeWarrior.  I'm still sketchy on details.
  2308.  
  2309.  
  2310.  
  2311.                                     _/   _/  _/  _/_/_/   _/   _/  
  2312.      Interet: nick@pitt.edu        _/_/ _/  _/  _/   _/  _/_/_/    
  2313.       eWorld: nick                _/ _/_/  _/  _/       _/ _/      
  2314.          CIS: 71232,766          _/   _/  _/   _/_/_/  _/   _/     
  2315.  
  2316.  
  2317. +++++++++++++++++++++++++++
  2318.  
  2319. >From philip@cs.wits.ac.za (Philip Machanick)
  2320. Date: 20 Sep 1994 13:20:51 GMT
  2321. Organization: Computer Science Dept, U of Witwatersrand
  2322.  
  2323. In article <1994Sep20.001043.28057@gallant.apple.com>, Jens Alfke
  2324. <jens_alfke@powertalk.apple.com> wrote:
  2325.  
  2326. > The future: Ever since we moved to SOM we've been using CodeWarrior PPC as
  2327. > our primary development environment, and it works fine. So when the beta seed
  2328. > is released RSN you'll be able to build parts with CodeWarrior -- if you have
  2329. > a PowerPC. For 68k you'll need to use the Symantec compiler, until Metrowerks
  2330. > releases a 68k version of CW that supports CFM68k. I know that MW plans to do
  2331. > this but I will let them reveal their schedule :-)
  2332.  
  2333. I hope they will.
  2334.  
  2335. Then it looks as if it may be worth my while to wait for the SOM/beta seed
  2336. before getting too heavily into this. I note you craftily failed to
  2337. mention the schedule for that ...
  2338. -- 
  2339. Philip Machanick                   philip@cs.wits.ac.za
  2340. Department of Computer Science, University of the Witwatersrand
  2341. 2050 Wits, South Africa        (at University of Cape Town 4 July-7 Nov)
  2342. phone 27(11)716-3309  fax 27(11)339-7965
  2343.  
  2344. ---------------------------
  2345.  
  2346. >From bb@lightside.com (Bob Bradley)
  2347. Subject: Q: Getting errors out of threads?
  2348. Date: Fri, 16 Sep 1994 15:16:37 -0800
  2349. Organization: SS Software Inc.
  2350.  
  2351. I'm using the Thread Manager to a series of long operations that can
  2352. generate errors and I'm looking for a better way to get those errors to
  2353. the user.
  2354.  
  2355. Right now I'm using OS Queues and when I get an error, I post an error
  2356. 'event' to the OS Queue which is picked up in my main thread's event loop
  2357. (I check for events in my OS queue just like I do the regular event
  2358. queue).
  2359.  
  2360. One problem is that sometimes I want to give the user the option to skip
  2361. the error and resume but, I'm having problems figuring a way to do it.
  2362.  
  2363. It also seems like using custom event queues just to display errors is
  2364. overkill, any thoughts?
  2365.  
  2366. +++++++++++++++++++++++++++
  2367.  
  2368. >From kenp@nmrfam.wisc.edu (Ken Prehoda)
  2369. Date: Sun, 18 Sep 1994 09:31:11 -0600
  2370. Organization: Univ of Wisc-Madison Dept of Biochemistry
  2371.  
  2372. In article <bb-1609941516370001@user50.lightside.com>, bb@lightside.com
  2373. (Bob Bradley) wrote:
  2374.  
  2375. > I'm using the Thread Manager to a series of long operations that can
  2376. > generate errors and I'm looking for a better way to get those errors to
  2377. > the user.
  2378. > Right now I'm using OS Queues and when I get an error, I post an error
  2379. > 'event' to the OS Queue which is picked up in my main thread's event loop
  2380. > (I check for events in my OS queue just like I do the regular event
  2381. > queue).
  2382. > One problem is that sometimes I want to give the user the option to skip
  2383. > the error and resume but, I'm having problems figuring a way to do it.
  2384. > It also seems like using custom event queues just to display errors is
  2385. > overkill, any thoughts?
  2386.  
  2387. It sure does.  What I did in this situation was just to create my own
  2388. queue as an application global that I would check through the event loop.
  2389.  
  2390. If you are using powerplant, there is an LSharedQueue class which uses a
  2391. somewhat more elegant mechanism to solve the problem of communication
  2392. between threads.
  2393.  
  2394. Ken Prehoda
  2395. University of Wisconsin-Madison
  2396. Department of Biochemistry
  2397. kenp@nmrfam.wisc.edu
  2398.  
  2399. +++++++++++++++++++++++++++
  2400.  
  2401. >From peter.lewis@info.curtin.edu.au (Peter N Lewis)
  2402. Date: Mon, 19 Sep 1994 09:48:34 +0800
  2403. Organization: NCRPDA, Curtin University
  2404.  
  2405. In article <kenp-1809940931110001@f180-096.net.wisc.edu>,
  2406. kenp@nmrfam.wisc.edu (Ken Prehoda) wrote:
  2407.  
  2408. >> Right now I'm using OS Queues and when I get an error, I post an error
  2409. >> 'event' to the OS Queue which is picked up in my main thread's event loop
  2410. >> (I check for events in my OS queue just like I do the regular event
  2411. >> queue).
  2412. >> 
  2413. >> One problem is that sometimes I want to give the user the option to skip
  2414. >> the error and resume but, I'm having problems figuring a way to do it.
  2415.  
  2416. >It sure does.  What I did in this situation was just to create my own
  2417. >queue as an application global that I would check through the event loop.
  2418.  
  2419. Isn't that the same as what he said?  OS queues are just queues, you can
  2420. use the Enqueue and Dequeue functions with your own queues.  Here is what
  2421. I would do:
  2422.  
  2423. type 
  2424.   ThisThreadInformationPtr=^ThisThreadInformation;
  2425.   ThisThreadInformation=record
  2426.     qLink:ThisThreadInformationPtr; { MUST BE AT START OF RECORD! }
  2427.     error:OSErr;
  2428.     die:boolean;
  2429.     whatever else
  2430.   end;
  2431.  
  2432. Create New Thread:
  2433. data:=NewPtr(SizeOf(ThisThreadInformation));
  2434. data^.error:=1; { in progress }
  2435. data^.die:=false;
  2436. Enqueue(data,@threads);
  2437. NewThread(@DoThread,data);
  2438.  
  2439.  
  2440. DoThread(data:ThisThreadInformationPtr)
  2441. do your calculations as per normal.  If data^.die becomes true, give up.
  2442. If you get a potential error, set data^.error to it, and then wait:
  2443.  
  2444. procedure GotAnError(err:OSErr);
  2445. data^.error:=err;
  2446. while data^.error<>1 and not die do
  2447.   Yield
  2448. end-while
  2449.  
  2450. When we return from that, if die is true, then give up, otherwise
  2451. continue, ignoring or handling the error as appropriate.
  2452.  
  2453.  
  2454. Init:
  2455. threads.qHead:=nil;
  2456. threads.qTail:=nil;
  2457.  
  2458. In the Main loop:
  2459. for each data in threads queue do
  2460.   if data^.error=noErr then begin
  2461.     Signal Success
  2462.     Remove from queue
  2463.   end else if data^.error<>1 then begin
  2464.     Signal failure
  2465.     If the user wants it to abort
  2466.       set the die field to true
  2467.     otherwise
  2468.       set data^.error to 1 again so the thread will continue
  2469.     end-if
  2470.   end;  
  2471. end-for
  2472.  
  2473. You'll have to be careful about exactly who removes the entry from the
  2474. queue and disposes it, but it's not too tricky.
  2475.  
  2476. Just be thankful we dont have preemptive multitasking.  Ughh.  It makes
  2477. this much more horrible.
  2478.    Peter.
  2479. -- 
  2480. Peter N Lewis <peter.lewis@info.curtin.edu.au> - Macintosh TCP fingerpainter
  2481. FTP my programs from redback.cs.uwa.edu.au:Others/PeterLewis/ or
  2482. amug.org:pub/peterlewis/ or nic.switch.ch:software/mac/peterlewis/
  2483.  
  2484.  
  2485. ---------------------------
  2486.  
  2487. >From fba@cs.brown.edu (Farah B. Abbas)
  2488. Subject: Shared Memory on Mac
  2489. Date: Thu, 8 Sep 1994 16:46:20 GMT
  2490. Organization: Brown University Department of Computer Science
  2491.  
  2492. Hi,
  2493.  
  2494. Does anyone know how to implement shared memory on the Mac? I have an 
  2495. application that sets a variable that I want another app to read later. I guess
  2496. one way would be to use a code resource so that one application sets the 
  2497. variable in the resource and the other app can load the resource and 
  2498. thereby look up the variable. Is there a "Apple Suggested" way that is 
  2499. better or do I have to do this hack ? Please email any suggestions to 
  2500. fba@cs.brown.edu. Thanx in advance.
  2501.  
  2502. Farah
  2503.  
  2504. +++++++++++++++++++++++++++
  2505.  
  2506. >From rmah@panix.com (Robert Mah)
  2507. Date: Fri, 09 Sep 1994 03:24:53 -0500
  2508. Organization: One Step Beyond
  2509.  
  2510. fba@cs.brown.edu (Farah B. Abbas) wrote:
  2511.  
  2512. ) Does anyone know how to implement shared memory on the Mac? I have an 
  2513. ) application that sets a variable that I want another app to read later.
  2514. ) I guess one way would be to use a code resource so that one application
  2515. ) sets the variable in the resource and the other app can load the resource
  2516. ) and thereby look up the variable. Is there a "Apple Suggested" way that
  2517. ) is better or do I have to do this hack ?
  2518.  
  2519. I've been working on something to do just this.
  2520.  
  2521. It uses Gestalt to provide tagged, shared memory between apps (and any 
  2522. other code for that matter).
  2523.  
  2524. I've thought about using a trap, but decided against it as Apple sort of
  2525. has a hammerlock on the A-trap market :-).
  2526.  
  2527. In any case, to use it, one simply registers a block of memory with the
  2528. Shared Memory Manager (tm) and then can request it again later by using
  2529. the tag.
  2530.  
  2531. It is all very simple.  Would you like to test/work on it with it with me?
  2532.  
  2533. Cheers,
  2534. Rob
  2535. _____________________________________________________________________
  2536. Robert S. Mah           Software Development          +1.212.947.6507
  2537. One Step Beyond        and Network Consulting          rmah@panix.com
  2538.  
  2539. +++++++++++++++++++++++++++
  2540.  
  2541. >From lambert_l@measurex.com (Leon Lambert)
  2542. Date: Tue, 13 Sep 1994 20:04:31 GMT
  2543. Organization: measurex
  2544.  
  2545. In article <1994Sep8.164620.21157@cs.brown.edu>
  2546. fba@cs.brown.edu (Farah B. Abbas) writes:
  2547.  
  2548. > Hi,
  2549. > Does anyone know how to implement shared memory on the Mac? I have an 
  2550. > application that sets a variable that I want another app to read later. I guess
  2551. > one way would be to use a code resource so that one application sets the 
  2552. > variable in the resource and the other app can load the resource and 
  2553. > thereby look up the variable. Is there a "Apple Suggested" way that is 
  2554. > better or do I have to do this hack ? Please email any suggestions to 
  2555. > fba@cs.brown.edu. Thanx in advance.
  2556. > Farah
  2557.  
  2558. I did this by making an INIT that created a trap. But I now think a
  2559. better way to do this is to use the gestalt manager. It has the
  2560. ability to store and retrieve a 32 bit value. I haven't tried it yet
  2561. but maybe someone else has.
  2562.  
  2563. lambert_l@measurex.com (Leon Lambert)
  2564. lambertlb@aol.com
  2565.  
  2566. +++++++++++++++++++++++++++
  2567.  
  2568. >From Jaeger@fquest.com (Brian Stern)
  2569. Date: 14 Sep 1994 15:54:21 GMT
  2570. Organization: The University of Texas at Austin, Austin, Texas
  2571.  
  2572. In article <1994Sep8.164620.21157@cs.brown.edu>, fba@cs.brown.edu (Farah
  2573. B. Abbas) wrote:
  2574.  
  2575. < Hi,
  2576. < Does anyone know how to implement shared memory on the Mac? I have an 
  2577. < application that sets a variable that I want another app to read later.
  2578. I guess
  2579. < one way would be to use a code resource so that one application sets the 
  2580. < variable in the resource and the other app can load the resource and 
  2581. < thereby look up the variable. Is there a "Apple Suggested" way that is 
  2582. < better or do I have to do this hack ? Please email any suggestions to 
  2583. < fba@cs.brown.edu. Thanx in advance.
  2584. < Farah
  2585.  
  2586. Hi,
  2587.  
  2588. This can be done by putting the information in a preferences file that
  2589. both apps can open.  
  2590.  
  2591. You can install a gestalt selector that returns the address of this shared
  2592. memory.  Both the gestalt selector and the shared memory should exist in
  2593. the system heap if you do this, in case of crashes.  
  2594.  
  2595. This can also be implemented by creating a driver that returns the address
  2596. of the shared mem or that returns the actual values in the shared mem.
  2597.  
  2598. Good Luck,
  2599.  
  2600. -- 
  2601. Brian  Stern  :-{)}
  2602. Jaeger@fquest.com
  2603.  
  2604. +++++++++++++++++++++++++++
  2605.  
  2606. >From peter.lewis@info.curtin.edu.au (Peter N Lewis)
  2607. Date: Mon, 19 Sep 1994 09:33:04 +0800
  2608. Organization: NCRPDA, Curtin University
  2609.  
  2610. In article <1994Sep8.164620.21157@cs.brown.edu>, fba@cs.brown.edu (Farah
  2611. B. Abbas) wrote:
  2612.  
  2613. >Does anyone know how to implement shared memory on the Mac? I have an 
  2614. >application that sets a variable that I want another app to read later. I guess
  2615. >one way would be to use a code resource so that one application sets the 
  2616. >variable in the resource and the other app can load the resource and 
  2617. >thereby look up the variable. Is there a "Apple Suggested" way that is 
  2618. >better or do I have to do this hack ? Please email any suggestions to 
  2619. >fba@cs.brown.edu. Thanx in advance.
  2620.  
  2621. Use Gestalt.  Have either or both applications install a gestalt handler
  2622. that returns the variable or the address of the variable.
  2623.  
  2624. WARNING: Do not assume you will be able to write (or perhaps even read)
  2625. another app's memory directly.  We desperately want Apple to give us
  2626. memory protection, at least between the various app's partitions, right?! 
  2627. If you want to share memory directly, then at least allocate the memory in
  2628. the System Heap, and use a Gestalt call to get the address of the memory.
  2629.  
  2630. Both apps could do something like:
  2631.  
  2632. If the gestalt call is already installed
  2633.   use the value returned as a ptr/handle to the data.
  2634. otherwise
  2635.   create the memory in the system heap
  2636.   load the gestalt code (probably also in the system heap)
  2637.   install the gestalt
  2638.   initialize the memory
  2639. end
  2640.  
  2641. After that, you can assume the gestalt call is installed and the memory is
  2642. available.
  2643.  
  2644. Enjoy,
  2645.    Peter.
  2646. -- 
  2647. Peter N Lewis <peter.lewis@info.curtin.edu.au> - Macintosh TCP fingerpainter
  2648. FTP my programs from redback.cs.uwa.edu.au:Others/PeterLewis/ or
  2649. amug.org:pub/peterlewis/ or nic.switch.ch:software/mac/peterlewis/
  2650.  
  2651. +++++++++++++++++++++++++++
  2652.  
  2653. >From chrism@col.hp.com (Chris Magnuson)
  2654. Date: 20 Sep 1994 17:05:56 GMT
  2655. Organization: HP Colorado Springs Division
  2656.  
  2657.   It *seems* like the PPC Toolbox might be okay for this.  There is an
  2658.   example of this on one of the developer CDs, where an INIT allocates
  2659.   some memory for shared globals and an application reads them.
  2660.  
  2661.   Chris Magnuson
  2662.   chrism@col.hp.com
  2663.  
  2664. ---------------------------
  2665.  
  2666. >From dbradley@Netaxs.com (Dan Bradley)
  2667. Subject: Window Lists
  2668. Date: 10 Sep 1994 19:10:49 GMT
  2669. Organization: Netaxs Internet BBS and Shell Accounts
  2670.  
  2671. Can anyone describe the process used to get a list of all open windows
  2672. within an application? I simply want to make an on the fly menu with
  2673. all the windows in my application in it. I thought of just updating the list
  2674. within my open, close, and save handlers, but it seems like it would be
  2675. a lot easier to just cycle through a list, which I'm sure must exist, but
  2676. I simply can't find, being a newbie who just doesn't know where to look.
  2677. I've been looking through IM, Think Ref, and Dave Mark's books, but
  2678. haven't found anything. I'm using Think C 6 and no TCL.
  2679.  
  2680. Thanks in advance,
  2681.  
  2682. Dan Bradley
  2683. dbradley@netaxs.com
  2684.  
  2685.  
  2686. +++++++++++++++++++++++++++
  2687.  
  2688. >From tnleeuw@cs.vu.nl (Leeuw van der TN)
  2689. Date: Mon, 12 Sep 1994 14:23:31 GMT
  2690. Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
  2691.  
  2692. dbradley@Netaxs.com (Dan Bradley) writes:
  2693. : Can anyone describe the process used to get a list of all open windows
  2694. : within an application? I simply want to make an on the fly menu with
  2695. : all the windows in my application in it. I thought of just updating the list
  2696. : within my open, close, and save handlers, but it seems like it would be
  2697. : a lot easier to just cycle through a list, which I'm sure must exist, but
  2698. : I simply can't find, being a newbie who just doesn't know where to look.
  2699. : I've been looking through IM, Think Ref, and Dave Mark's books, but
  2700. : haven't found anything. I'm using Think C 6 and no TCL.
  2701. : Thanks in advance,
  2702. : Dan Bradley
  2703. : dbradley@netaxs.com
  2704. Once I had a similar problem, when I wanted to get a list of my windows
  2705. so I could dispose of them when quitting. I came up with the AUXWinRec,
  2706. which you can call with a valid window record as a parameter, and gives
  2707. you the AuxWinRecord (sp?) for the Window *if* it is a color window.
  2708. *If* it is a color window, the owner field points to your window. Big Trick:
  2709. it also has a field pointing to the next AuxWinRec in the list,
  2710. which has of course an owner... So if you now what your first window
  2711. is (like, your about-box) you might be able to get the list.
  2712.  
  2713. I must admit that after I typed that code, I found the solution too scary
  2714. to really try it. I rewrote it using Frontwindow(). I've not seen it
  2715. documented anywhere what window is really next in the list. It might not
  2716. be yours.
  2717. I'm really curious how to do it.
  2718.  
  2719. --Tim van der Leeuw
  2720. tnleeuw@cs.vu.nl
  2721.  
  2722. +++++++++++++++++++++++++++
  2723.  
  2724. >From kurisuto@babel.ling.upenn.edu (Sean Crist)
  2725. Date: 12 Sep 1994 18:59:18 GMT
  2726. Organization: University of Pennsylvania, Linguistics Department
  2727.  
  2728. Unless I'm mistaken, it's still kosher to write your program as if all its
  2729. windows are in one linked list.  There's so many applications that step
  2730. through their own windows this way that Apple really can't change this
  2731. without breaking an awful lot of applications.  If I remember right,
  2732. though, FrontWindow returns the first _visible_ window, and you might want
  2733. to start with invisible ones, so you've got to look in some low-memory
  2734. pointer to really start at the front of the window list.
  2735.  
  2736. I'm talking off the top of my head; I've got some Pascal code at home that
  2737. illustrates this but I might be wrong in a few of the details.
  2738.  
  2739. --Sean
  2740.  
  2741.  
  2742. +++++++++++++++++++++++++++
  2743.  
  2744. >From cswan@actrix.gen.nz (Chris Swan)
  2745. Date: Wed, 14 Sep 1994 00:58:40 GMT
  2746. Organization: Actrix Information Exchange
  2747.  
  2748. > : Can anyone describe the process used to get a list of all open windows
  2749. > : within an application? I simply want to make an on the fly menu with
  2750.  
  2751. > Once I had a similar problem, when I wanted to get a list of my windows
  2752. > so I  [deleted - really complex answer] tting. 
  2753.  
  2754. theWindow := FrontWindow;
  2755. while theWindow <> nil do
  2756.   begin
  2757.    Do_Some_thing(with, theWindow);
  2758.    theWindow:= windowPtr(windowPeek(theWindow)^.nextWindow);
  2759.   end;
  2760.  
  2761. Ref. Inside Macintosh Volume I
  2762.  
  2763. -- 
  2764. Chris Swan
  2765. cswan@actrix.gen.nz
  2766. PO Box 11567, Wellington, New Zealand
  2767. --
  2768.  
  2769. +++++++++++++++++++++++++++
  2770.  
  2771. >From Tim_Craycroft@PowerTalk.apple.com (Tim Craycroft)
  2772. Date: Wed, 14 Sep 1994 00:40:00 GMT
  2773. Organization: Apple Computer
  2774.  
  2775. In article <Cw0tB8.2IL@cs.vu.nl>, tnleeuw@cs.vu.nl (Leeuw van der TN)
  2776. wrote:
  2777. > dbradley@Netaxs.com (Dan Bradley) writes:
  2778. > : Can anyone describe the process used to get a list of all open windows
  2779. > : within an application? I simply want to make an on the fly menu with
  2780. > : all the windows in my application in it. I thought of just updating the list
  2781. > : within my open, close, and save handlers, but it seems like it would be
  2782. > : a lot easier to just cycle through a list, which I'm sure must exist, but
  2783. > : I simply can't find, being a newbie who just doesn't know where to look.
  2784. > : I've been looking through IM, Think Ref, and Dave Mark's books, but
  2785. > : haven't found anything. I'm using Think C 6 and no TCL.
  2786. > : 
  2787. > : Thanks in advance,
  2788. > : 
  2789. > : Dan Bradley
  2790. > : dbradley@netaxs.com
  2791. > : 
  2792. > Once I had a similar problem, when I wanted to get a list of my windows
  2793. > so I could dispose of them when quitting. I came up with the AUXWinRec,
  2794. > which you can call with a valid window record as a parameter, and gives
  2795. > you the AuxWinRecord (sp?) for the Window *if* it is a color window.
  2796. > *If* it is a color window, the owner field points to your window. Big Trick:
  2797. > it also has a field pointing to the next AuxWinRec in the list,
  2798. > which has of course an owner... So if you now what your first window
  2799. > is (like, your about-box) you might be able to get the list.
  2800. > I must admit that after I typed that code, I found the solution too scary
  2801. > to really try it. I rewrote it using Frontwindow(). I've not seen it
  2802. > documented anywhere what window is really next in the list. It might not
  2803. > be yours.
  2804. > I'm really curious how to do it.
  2805. > --Tim van der Leeuw
  2806. > tnleeuw@cs.vu.nl
  2807.  
  2808. You want to iterate over your window list.  Get the first window by calling
  2809. LMGetWindowList().  The link field in the window record is ->nextWindow. 
  2810. If you are just interested in visible windows, you can use FrontWindow()
  2811. instead of LMGetWindowList() and then check the ->visible field of all
  2812. subsequent windows in the list.  Do NOT use the aux record list.  There is
  2813. no guarantee that the link field in the aux record is an aux record of a
  2814. window you own.
  2815.  
  2816.  
  2817. //
  2818. // Accessor macros that will someday be replace by real window mgr APIs
  2819. //
  2820.  
  2821. #define    GetNextWindow(w)            (((WindowPeek) w)->nextWindow)    
  2822. #define IsWindowVisible(w)    (((WindowPeek) w)->visible)
  2823.  
  2824.  
  2825. DoSomethingWithMyWindows(Boolean onlyVisible)
  2826. {
  2827.         WindowRef    currentWindow;
  2828.  
  2829.      currentWindow = LMGetWindowList();
  2830.  
  2831.         while (currentWindow != 0)
  2832.      {
  2833.                     if (!onlyVisible || ( IsWindowVisible(currentWindow) )
  2834.                  {        
  2835.                             // do something with this window...
  2836.                          DoSomethingToOneWindow(currentWindow);
  2837.                  }
  2838.  
  2839.               currentWindow = GetNextWindow(currentWindow);
  2840.      }
  2841. }
  2842.  
  2843. +++++++++++++++++++++++++++
  2844.  
  2845. >From h+@nada.kth.se (Jon W{tte)
  2846. Date: Wed, 14 Sep 1994 18:36:53 +0200
  2847. Organization: Royal Institute of Something or other
  2848.  
  2849. In article <Cw3HDs.2qx@actrix.gen.nz>,
  2850. cswan@actrix.gen.nz (Chris Swan) wrote:
  2851.  
  2852. >theWindow := FrontWindow;
  2853. >while theWindow <> nil do
  2854. >  begin
  2855. >   Do_Some_thing(with, theWindow);
  2856. >   theWindow:= windowPtr(windowPeek(theWindow)^.nextWindow);
  2857. >  end;
  2858.  
  2859. Close, but no cigar. FrontWindow() returns the first visible 
  2860. window, but the nextWindow pointer can return an invisible 
  2861. window.
  2862.  
  2863.     WindowPtr window = FrontWindow ( ) ;
  2864.     while ( window )
  2865.     {
  2866.         DoSomeThing ( window ) ;
  2867.         do {
  2868.             window = ( WindowPtr ) ( ( WindowPeek ) window ) -> 
  2869.                 nextWindow ;
  2870.         } while ( window && ! ( ( WindowPeek ) window ) -> visible ) ;
  2871.     }
  2872.  
  2873. The Window Manager is desperately in need of a lot of accessor 
  2874. functions, by the way.
  2875.  
  2876. Cheers,
  2877.  
  2878.                 / h+
  2879.  
  2880.  
  2881. --
  2882.   Jon W‰tte (h+@nada.kth.se), Hagagatan 1, 113 48 Stockholm, Sweden
  2883.  ~r ~/.signature
  2884.  
  2885.  
  2886. +++++++++++++++++++++++++++
  2887.  
  2888. >From larson@oahu.cs.ucla.edu (Christopher Larson)
  2889. Date: Wed, 14 Sep 94 16:26:12 GMT
  2890. Organization: UCLA, Computer Science Department
  2891.  
  2892. In article <Cw3HDs.2qx@actrix.gen.nz> cswan@actrix.gen.nz (Chris Swan) writes:
  2893. >> : Can anyone describe the process used to get a list of all open windows
  2894. >> : within an application? I simply want to make an on the fly menu with
  2895. >
  2896. >> Once I had a similar problem, when I wanted to get a list of my windows
  2897. >> so I  [deleted - really complex answer] tting. 
  2898. >
  2899. >theWindow := FrontWindow;
  2900.               ^^^^^^^^^^^
  2901. >while theWindow <> nil do
  2902. >  begin
  2903. >   Do_Some_thing(with, theWindow);
  2904. >   theWindow:= windowPtr(windowPeek(theWindow)^.nextWindow);
  2905. >  end;
  2906. >
  2907. >Ref. Inside Macintosh Volume I
  2908.  
  2909. If memory serves, FrontWindow() returns the frontmost _visible_ window. You
  2910. may miss hidden windows this way. Try starting with the LM global WindowList.
  2911.  
  2912. --Chris
  2913. _______________________________________________________________________________
  2914. Chris Larson -- Amateur Macintosh Geek, CoBase Research Assistant
  2915. L.A. Institute of Slowly and Painfully Working Out the Surprisingly Obvious
  2916. Death to the Trojans! Go Bruins!
  2917.  
  2918. (Insert disclaimer here)
  2919. Internet: larson@kingston.cs.ucla.edu
  2920.  
  2921. +++++++++++++++++++++++++++
  2922.  
  2923. >From tnleeuw@cs.vu.nl (Leeuw van der TN)
  2924. Date: Thu, 15 Sep 1994 11:36:45 GMT
  2925. Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
  2926.  
  2927. cswan@actrix.gen.nz (Chris Swan) writes:
  2928. : > : Can anyone describe the process used to get a list of all open windows
  2929. : > : within an application? I simply want to make an on the fly menu with
  2930. : > Once I had a similar problem, when I wanted to get a list of my windows
  2931. : > so I  [deleted - really complex answer] tting. 
  2932. : theWindow := FrontWindow;
  2933. : while theWindow <> nil do
  2934. :   begin
  2935. :    Do_Some_thing(with, theWindow);
  2936. :    theWindow:= windowPtr(windowPeek(theWindow)^.nextWindow);
  2937. :   end;
  2938. I still don't understand how I could have overlooked that field. Really stupid,
  2939. actually. Sorry. Anyway, I understand that you can get the first window by
  2940. calling FrontWindow()? It's not the window that you first created?
  2941. : Ref. Inside Macintosh Volume I
  2942. : -- 
  2943. : Chris Swan
  2944. : cswan@actrix.gen.nz
  2945. : PO Box 11567, Wellington, New Zealand
  2946. : --
  2947. --Tim van der Leeuw
  2948. tnleeuw@cs.vu.nl
  2949.  
  2950. +++++++++++++++++++++++++++
  2951.  
  2952. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  2953. Date: Mon, 19 Sep 1994 20:35:15 GMT
  2954. Organization: Apple Computer
  2955.  
  2956. In article <34t0bp$jkt@netaxs.com> Dan Bradley, dbradley@Netaxs.com writes:
  2957. > Can anyone describe the process used to get a list of all open windows
  2958. > within an application?
  2959.  
  2960. Start with FrontWindow(), then follow the nextWindow fields in each
  2961. windowRecord. Note that WindowPtr is just another name for GrafPtr, so you
  2962. won't be able to access the extra WindowRecord fields through it. You have to
  2963. cast to WindowPeek (defined as a pointer to WindowRecord).
  2964.  
  2965. WindowPtr w;
  2966. for( w=FrontWindow(); w; w=(WindowPtr)((WindowPeek)w)->nextWindow )
  2967.     if( ((WindowPeek)w)->windowKind >= userKind )
  2968.         /*do something with w*/;
  2969.  
  2970. Note that this loop intentionally skips non-document windows like dialogs,
  2971. DAs and other system windows.
  2972.  
  2973. --Jens Alfke                           jens_alfke@powertalk.apple.com
  2974.                    "A man, a plan, a yam, a can of Spam ... Bananama!"
  2975.  
  2976. ---------------------------
  2977.  
  2978. >From paitech@hntp2.hinet.net (paitech)
  2979. Subject: preloaded CODE resources in fat binaries
  2980. Date: 9 Sep 1994 08:28:52 GMT
  2981. Organization: NCTU News Server, HiNet
  2982.  
  2983. In the 68k world, we usually mark the resident CODE segments LOCKED and
  2984. PRELOADED, to avoid memory fragmentation.  But under the Power Macintosh
  2985. runtime architecture, these preloaded CODE segments just waste memory.
  2986.  
  2987. So how should I do to these CODE resources in the fat binaries?  Currently
  2988. I put the following piece of code at the beginning of my program, and it
  2989. looks ugly.  Are there any better methods?
  2990.  
  2991.     #ifdef __powerc
  2992.         for (short seg_idx = Count1Resources('CODE'); seg_idx > 0; --seg_idx)
  2993.         {   SetResLoad(false);
  2994.             Handle seg = Get1IndResource('CODE', seg_idx);
  2995.             SetResLoad(true);
  2996.             if (seg)
  2997.                 ReleaseResource(seg);
  2998.         }
  2999.     #endif
  3000.  
  3001. Hao-yang Wang
  3002. Pai Technology, Inc.
  3003. Taipei
  3004.  
  3005. +++++++++++++++++++++++++++
  3006.  
  3007. >From gurgle@dnai.com (Pete Gontier)
  3008. Date: Fri, 09 Sep 1994 12:48:15 -0800
  3009. Organization: Integer Poet Software
  3010.  
  3011. In article <34p6c4$jqo@serv.hinet.net>, paitech@hntp2.hinet.net (paitech) wrote:
  3012.  
  3013. > In the 68k world, we usually mark the resident CODE segments LOCKED and
  3014. > PRELOADED, to avoid memory fragmentation.  But under the Power Macintosh
  3015. > runtime architecture, these preloaded CODE segments just waste memory.
  3016. > So how should I do to these CODE resources in the fat binaries?  Currently
  3017. > I put the following piece of code at the beginning of my program...
  3018.  
  3019. [code to get and release code segments omitted]
  3020.  
  3021. Interesting problem. I realized you have a problem just the opposite of
  3022. the one I try to solve in my code, which is that pre-loaded segments don't
  3023. work the same when your app is not an app (i.e. when it's a TPM project).
  3024. See, in that case you have to go get the code segments yourself and lock
  3025. them low in the heap.
  3026.  
  3027. I think this is useful information for you because (1) it's an example of
  3028. someone else doing a disgusting hack against the CODE resources and pretty
  3029. much getting away with it, and (2) it provides you with code you might
  3030. want to use instead of marking your segments pre-loaded. That way, for the
  3031. PPC version, you can simply omit the code.
  3032.  
  3033. //////////////////////////////////////////////////////////////////////////////
  3034.  
  3035. #if defined (THINK_C) || defined (applec)
  3036.  
  3037. //  Note selectivity of above compilers; under Metrowerks we
  3038. //  assume the linker has been set to merge the whole app into
  3039. //  one huge resource. Probably we should later include an
  3040. //  explicit check for this, but right now I am using the
  3041. //  CD ROM drive for music and can't look up the symbols. :-/
  3042.  
  3043. static OSErr MacLow_Init_LoadCODEs (void)
  3044. {
  3045.     OSErr oe = noErr;
  3046.  
  3047.     //  This code attempts to load all the code segments low in the heap and
  3048.     //  lock them down. If we're not running under TPM, this should have been
  3049.     //  done already for us by the fact that all the code resources should be
  3050.     //  marked pre-load and lock in the resource map. If we are, we need to
  3051.     //  take extra steps.
  3052.     //  
  3053.     //  First, we check to see if we are running under TPM. Since the TPM
  3054.     //  opens an external, non-CODE resource file on top of the project file,
  3055.     //  where the CODE resources live, we can search the top resource file for
  3056.     //  CODEs to find out if the TPM has done this. And an easy way to do this
  3057.     //  is Count1Resources.
  3058.  
  3059.     Boolean tpmRunning = false;
  3060.     short code = Count1Resources ('CODE');
  3061.  
  3062.     if (!(oe = ResError ( )) && !code)
  3063.     {
  3064.         //  OK, now we know we are running under TPM.
  3065.         //  We need to get the "real" count of the CODE resources.
  3066.         //  We can do this by searching beyond the current file,
  3067.         //  which will catch the CODEs in the project.
  3068.  
  3069.         tpmRunning = true;
  3070.         code = CountResources ('CODE');
  3071.         oe = ResError ( );
  3072.     }
  3073.  
  3074.     if (!oe)
  3075.     {
  3076.         //  Now index all of
  3077.         //  them and get their IDs without loading them, reserve
  3078.         //  space for them at the bottom of the heap, load them,
  3079.         //  and lock them.
  3080.  
  3081.         Handle      codeH;
  3082.         Size        size;
  3083.         short       id;
  3084.         ResType     type;
  3085.         Str255      name;
  3086.  
  3087.         if (code)
  3088.         {
  3089.             Boolean oldResLoad = LMGetResLoad ( );
  3090.             SetResLoad (false);
  3091.  
  3092.             do
  3093.             {
  3094.                 if (tpmRunning)
  3095.                     codeH = GetIndResource ('CODE', code);
  3096.                 else
  3097.                     codeH = Get1IndResource ('CODE', code);
  3098.  
  3099.                 oe = ResError ( ); if (oe) break;
  3100.                 GetResInfo (codeH, &id, &type, name);
  3101.                 oe = ResError ( ); if (oe) break;
  3102.  
  3103.                 //  Skip the jump table and the startup code.
  3104.                 //  This should be more intelligent about how
  3105.                 //  various linkers handle their startup code.
  3106.                 //  It's presently set up for THINK, but may
  3107.                 //  work in other cases.
  3108.  
  3109.                 if (id != 0 && id != 1)
  3110.                 {
  3111.                     size = GetResourceSizeOnDisk (codeH);
  3112.                     oe = ResError ( ); if (oe) break;
  3113.                     ReserveMem (size);
  3114.                     oe = MemError ( ); if (oe) break;
  3115.                     LoadResource (codeH);
  3116.                     oe = ResError ( ); if (oe) break;
  3117.                     HLock (codeH);
  3118.                     oe = MemError ( ); if (oe) break;
  3119.                     HNoPurge (codeH); // just for paranoia
  3120.                     oe = MemError ( ); if (oe) break;
  3121.                 }
  3122.             }
  3123.             while (--code);
  3124.  
  3125.             SetResLoad (oldResLoad);
  3126.         }
  3127.     }
  3128.  
  3129.     return (oe);
  3130. }
  3131.  
  3132. #endif
  3133.  
  3134. -- 
  3135.  
  3136.  Pete Gontier // CTO, Integer Poet Software // gurgle@dnai.com
  3137.  
  3138.  "The need to be (or appear to be) sophisticated pervades the very
  3139.  atmosphere in which we, the Magazine Reading Class, move."
  3140.                   -- Ellis Weiner, Spy Magazine, 9/94
  3141.  
  3142. +++++++++++++++++++++++++++
  3143.  
  3144. >From paitech@hntp2.hinet.net (paitech)
  3145. Date: 10 Sep 1994 18:51:43 GMT
  3146. Organization: NCTU News Server, HiNet
  3147.  
  3148. Pete Gontier (gurgle@dnai.com) wrote:
  3149. : much getting away with it, and (2) it provides you with code you might
  3150. : want to use instead of marking your segments pre-loaded. That way, for the
  3151. : PPC version, you can simply omit the code.
  3152.  
  3153. But you still have to preload the main segment (i.e. CODE 1), right?
  3154.  
  3155. Hao-yang Wang
  3156. Pai Technology, Inc.
  3157. Taipei
  3158.  
  3159. +++++++++++++++++++++++++++
  3160.  
  3161. >From gurgle@dnai.com (Pete Gontier)
  3162. Date: Sat, 10 Sep 1994 18:14:54 -0800
  3163. Organization: Integer Poet Software
  3164.  
  3165. In article <34sv7v$8hr@serv.hinet.net>, paitech@hntp2.hinet.net (paitech) wrote:
  3166.  
  3167. > Pete Gontier (gurgle@dnai.com) wrote:
  3168. > : much getting away with it, and (2) it provides you with code you might
  3169. > : want to use instead of marking your segments pre-loaded. That way, for the
  3170. > : PPC version, you can simply omit the code.
  3171. > But you still have to preload the main segment (i.e. CODE 1), right?
  3172.  
  3173. I'm not terribly familiar with the PPC code model, so it's possible you
  3174. might have to do this, but I think it's always a pretty safe assumption
  3175. that if your code is running, CODE 1 loaded successfully. :-)
  3176.  
  3177. -- 
  3178.  
  3179.  Pete Gontier // CTO, Integer Poet Software // gurgle@dnai.com
  3180.  
  3181.  "The need to be (or appear to be) sophisticated pervades the very
  3182.  atmosphere in which we, the Magazine Reading Class, move."
  3183.                   -- Ellis Weiner, Spy Magazine, 9/94
  3184.  
  3185. +++++++++++++++++++++++++++
  3186.  
  3187. >From paitech@hntp2.hinet.net (paitech)
  3188. Date: 11 Sep 1994 08:50:52 GMT
  3189. Organization: NCTU News Server, HiNet
  3190.  
  3191. Pete Gontier (gurgle@dnai.com) wrote:
  3192. : > But you still have to preload the main segment (i.e. CODE 1), right?
  3193.  
  3194. : I'm not terribly familiar with the PPC code model, so it's possible you
  3195. : might have to do this, but I think it's always a pretty safe assumption
  3196. : that if your code is running, CODE 1 loaded successfully. :-)
  3197.  
  3198. Let me make my question clearer:
  3199.  
  3200. You suggested that instead of marking the resident segments PRELOADED, we can
  3201. also load them manually at runtime.  This is a good idea (It cannot be bad
  3202. because MacApp has done it in a similar way since 1.0.), but when your code is
  3203. executed (under 68k), the main segment is already loaded (into the middle of
  3204. the heap?) and it is already too late to reallocate the main segment.
  3205.  
  3206. So the main segment should still be marked as PRELOADED and we still have to
  3207. release it under PPC, right?
  3208.  
  3209. Hao-yang Wang
  3210. Pai Technology, Inc.
  3211. Taipei
  3212.  
  3213. +++++++++++++++++++++++++++
  3214.  
  3215. >From h+@nada.kth.se (Jon W{tte)
  3216. Date: Sun, 11 Sep 1994 19:47:54 +0200
  3217. Organization: Royal Institute of Something or other
  3218.  
  3219. In article <34ugdc$pqk@serv.hinet.net>,
  3220. paitech@hntp2.hinet.net (paitech) wrote:
  3221.  
  3222. >You suggested that instead of marking the resident segments PRELOADED, we can
  3223. >also load them manually at runtime.  This is a good idea (It cannot be bad
  3224. >because MacApp has done it in a similar way since 1.0.), but when your code is
  3225. >executed (under 68k), the main segment is already loaded (into the middle of
  3226. >the heap?) and it is already too late to reallocate the main segment.
  3227.  
  3228. >So the main segment should still be marked as PRELOADED and we still have to
  3229. >release it under PPC, right?
  3230.  
  3231.  
  3232. No.
  3233.  
  3234. The Segment Loader loads CODE 0 and whatever's referenced by 
  3235. the first jump table entry for you. At this time, the heap is 
  3236. really small (MaxApplZone() hasn't been called) and there's 
  3237. nothing else in it (what would it be? No memory allocation's 
  3238. been done) so that CODE resource is loaded snugly in the heap; 
  3239. no fragmentation.
  3240.  
  3241. If your main() function is not in the same segment as the 
  3242. startup loader bootstrap (runtime library) you'll have a third 
  3243. CODE resource load before you get to the start of main, and 
  3244. still MaxApplZone() isn't called and no non-permanent memory is 
  3245. allocated to there's no chance of fragmentation.
  3246.  
  3247. So, don't mark CODE 0 or CODE 1 (or ANY CODE) preloaded for a 
  3248. fat binary.
  3249.  
  3250. OR special-case for PPC to get all CODE resources and release 
  3251. them :-) :-) :-)
  3252.  
  3253. Cheers,
  3254.  
  3255.                 / h+
  3256.  
  3257.  
  3258. --
  3259.   Jon W‰tte (h+@nada.kth.se), Hagagatan 1, 113 48 Stockholm, Sweden
  3260.  
  3261.    Nothing crashes like a Macintosh.
  3262.                      -- Guy Kawasaki
  3263.  
  3264.  
  3265. +++++++++++++++++++++++++++
  3266.  
  3267. >From paitech@hntp2.hinet.net (paitech)
  3268. Date: 12 Sep 1994 13:55:17 GMT
  3269. Organization: NCTU News Server, HiNet
  3270.  
  3271. Jon W{tte (h+@nada.kth.se) wrote:
  3272. : The Segment Loader loads CODE 0 and whatever's referenced by 
  3273. : the first jump table entry for you. At this time, the heap is 
  3274. : really small (MaxApplZone() hasn't been called) and there's 
  3275. : nothing else in it (what would it be? No memory allocation's 
  3276. : been done) so that CODE resource is loaded snugly in the heap; 
  3277. : no fragmentation.
  3278.  
  3279. There is still fragmentation.  You can break into Macsbug and check for it
  3280. yourself.  It is not caused by other memory allocations, but by the MiveHHi()
  3281. call (made by the Segment Loader).  However, the heap is really small at this
  3282. time, so the memory loss caused by this fragmentation may be no more than
  3283. several kilo bytes.  We may just ignore this fragmentation.
  3284.  
  3285. : So, don't mark CODE 0 or CODE 1 (or ANY CODE) preloaded for a 
  3286. : fat binary.
  3287.  
  3288. In CodeWarrior, this is easy.  In MPW, you may need to write a rez script for
  3289. this post-link process.  I don't know an easy way to clear the preloaded bit
  3290. under the Symantec environment.
  3291.  
  3292. Another related problem is the SIZE resource.  On one hand, under the PPC
  3293. runtime environment the code does not take up the application heap, on the
  3294. other hand, the PPC stack size is usually larger than the 68k one.  Anyway,
  3295. if the memory requirements for PPC and 68k are different, how can one SIZE
  3296. fit for both?
  3297.  
  3298. I am writing a fat 'appe', and the SIZE resource becomes a problem, because
  3299. 1) users cannot change the memory partition in the "Get Info..." Finder
  3300.    dialog for the 'appe';
  3301. 2) the 'appe' will always resident in background and take up memory, so I
  3302.    cannot throw away hundreds of kilo bytes here and there, as I used to do.
  3303.  
  3304. Maybe I should put an INIT resource into the  the appe file, to adjust the
  3305. SIZE resource dynamically at the startup time, according to the current
  3306. machine architecture.  But I think I have used up all my quota on dirty
  3307. tricks this year. :-)
  3308.  
  3309. Hao-yang Wang
  3310. Pai Technology, Inc.
  3311. Taipei
  3312.  
  3313. +++++++++++++++++++++++++++
  3314.  
  3315. >From gurgle@dnai.com (Pete Gontier)
  3316. Date: Mon, 12 Sep 1994 10:22:25 -0800
  3317. Organization: Integer Poet Software
  3318.  
  3319. In article <351mk5$sus@serv.hinet.net>, paitech@hntp2.hinet.net (paitech) wrote:
  3320.  
  3321. > There is still fragmentation.  You can break into Macsbug and check for it
  3322. > yourself.  It is not caused by other memory allocations, but by the MiveHHi()
  3323. > call (made by the Segment Loader).  However, the heap is really small at this
  3324. > time, so the memory loss caused by this fragmentation may be no more than
  3325. > several kilo bytes.  We may just ignore this fragmentation.
  3326.  
  3327. Ah. After some twiddling of my own current project, I see what you are
  3328. getting at. For various technical reasons, I was not running into the
  3329. problem. My code was only intended to get around the tricky resource fork
  3330. problem in the TPM. The real solution for 68K is to have all your code
  3331. segments locked and pre-loaded, which is fine, because my TPM solution
  3332. knows whether it's running under TPM and bails out if not.
  3333.  
  3334. But you still have a problem -- how to make the 68K code all load and stay
  3335. loaded without fragmenting the heap while at the same time *not* loading
  3336. when the PPC code runs. Making sure the 68K code does not waste RAM while
  3337. the PPC code is running not only requires you to get and release the CODE
  3338. resources but *also* costs you startup time, because those resources take
  3339. some non-zero time to be read in from the disk, even when running under
  3340. PPC.
  3341.  
  3342. As you say, though, the heap is really small at that time, and you might
  3343. just want to sacrifice the wasted space to the gods of convenience.
  3344. Anyway, I will think about this some more as a mental background process,
  3345. for whatever that's worth. :-)
  3346.  
  3347. -- 
  3348.  
  3349.  Pete Gontier // CTO, Integer Poet Software // gurgle@dnai.com
  3350.  
  3351.  "The need to be (or appear to be) sophisticated pervades the very
  3352.  atmosphere in which we, the Magazine Reading Class, move."
  3353.                   -- Ellis Weiner, Spy Magazine, 9/94
  3354.  
  3355. +++++++++++++++++++++++++++
  3356.  
  3357. >From wdh@fresh.com (Bill Hofmann)
  3358. Date: Mon, 12 Sep 1994 17:36:24 GMT
  3359. Organization: Fresh Software
  3360.  
  3361. In article <34ugdc$pqk@serv.hinet.net>, paitech@hntp2.hinet.net (paitech) wrote:
  3362.  
  3363. > Let me make my question clearer:
  3364. > You suggested that instead of marking the resident segments PRELOADED, we can
  3365. > also load them manually at runtime.  This is a good idea (It cannot be bad
  3366. > because MacApp has done it in a similar way since 1.0.), but when your code is
  3367. > executed (under 68k), the main segment is already loaded (into the middle of
  3368. > the heap?) and it is already too late to reallocate the main segment.
  3369. > So the main segment should still be marked as PRELOADED and we still have to
  3370. > release it under PPC, right?
  3371. > Hao-yang Wang
  3372. > Pai Technology, Inc.
  3373. > Taipei
  3374. No.  The system loads CODE 1 (and CODE 0) itself in the process of launching your application if it's a 68k app.  You really don't have to mark any resources preload except your error reporting resources (DLOG or ALRT, DITL, STRs or STR#s, etc).  You don't have to mark CODE 1 preload.
  3375. -- 
  3376. Bill Hofmann                                   wdh@fresh.com
  3377. Fresh Software and Instructional Design        voice: +1 510 524 0852
  3378. 1640 San Pablo Ave #C Berkeley CA 94702 USA    fax:   +1 510 524 0853
  3379.  
  3380. +++++++++++++++++++++++++++
  3381.  
  3382. >From gurgle@dnai.com (Pete Gontier)
  3383. Date: Mon, 12 Sep 1994 12:20:17 -0800
  3384. Organization: Integer Poet Software
  3385.  
  3386. In article <wdh-1209941036240001@wdh.slip.netcom.com>, wdh@fresh.com (Bill
  3387. Hofmann) wrote:
  3388.  
  3389. > You really don't have to mark any resources 
  3390. > preload except your error reporting resources
  3391. > (DLOG or ALRT, DITL, STRs or STR#s, etc).
  3392.  
  3393. I think perhaps you are missing the idea that he *wants* to pre-load all
  3394. his code resources so that he doesn't have to worry about the memory
  3395. management issues associated with code segments loading and unloading via
  3396. Segment Loader and the jump table. It's not that he thinks he must; he's
  3397. choosing to do so in order to make his memory management simpler. This is
  3398. not optimal in terms of memory usage, but code takes up a surprisingly
  3399. small amount of relative space in some apps, and making sure it's all
  3400. always loaded can simplify QA a lot.
  3401.  
  3402. -- 
  3403.  
  3404.  Pete Gontier // CTO, Integer Poet Software // gurgle@dnai.com
  3405.  
  3406.  "The need to be (or appear to be) sophisticated pervades the very
  3407.  atmosphere in which we, the Magazine Reading Class, move."
  3408.                   -- Ellis Weiner, Spy Magazine, 9/94
  3409.  
  3410. +++++++++++++++++++++++++++
  3411.  
  3412. >From gurgle@dnai.com (Pete Gontier)
  3413. Date: Mon, 12 Sep 1994 12:25:50 -0800
  3414. Organization: Integer Poet Software
  3415.  
  3416. In article <wdh-1209941036240001@wdh.slip.netcom.com>, wdh@fresh.com (Bill
  3417. Hofmann) wrote:
  3418.  
  3419. > The system loads CODE 1 (and CODE 0) itself in the process of
  3420. > launching your application if it's a 68k app... You don't have to mark
  3421. > CODE 1 preload.
  3422.  
  3423. I forgot to note something else:
  3424.  
  3425. Most development systems automatically mark CODE 1 as pre-loaded. This has
  3426. the effect of forcing the segment into the lowest possible position in the
  3427. heap as soon as the app's resource file is opened. (Ordinarily this is a
  3428. good thing, because CODE 1 tends to do things like patch ExitToShell, and
  3429. you don't want it moving around.) It may be that under some systems the
  3430. process manager does the right thing to make sure this happens anyway, but
  3431. since most development systems mark CODE 1 as pre-loaded regardless, it's
  3432. still a good idea to figure out how to deal with it under PowerPC in a fat
  3433. binary situation.
  3434.  
  3435. -- 
  3436.  
  3437.  Pete Gontier // CTO, Integer Poet Software // gurgle@dnai.com
  3438.  
  3439.  "The need to be (or appear to be) sophisticated pervades the very
  3440.  atmosphere in which we, the Magazine Reading Class, move."
  3441.                   -- Ellis Weiner, Spy Magazine, 9/94
  3442. >From Pete.Gontier@f1.n100.z60.wlink.nl (Pete Gontier)
  3443. Subject: preloaded CODE resources in fat binaries
  3444. Date: Mon, 12 Sep 1994 14:25:50 -0100
  3445. Organization: (none)
  3446.  
  3447.  
  3448. In article <wdh-1209941036240001@wdh.slip.netcom.com>, wdh@fresh.com (Bill
  3449. Hofmann) wrote:
  3450.  
  3451. > The system loads CODE 1 (and CODE 0) itself in the process of
  3452. > launching your application if it's a 68k app... You don't have to mark
  3453. > CODE 1 preload.
  3454.  
  3455. I forgot to note s
  3456.  
  3457.  
  3458.  
  3459.  
  3460. +++++++++++++++++++++++++++
  3461.  
  3462. >From wdh@fresh.com (Bill Hofmann)
  3463. Date: Thu, 15 Sep 1994 17:18:00 GMT
  3464. Organization: Fresh Software
  3465.  
  3466. In article <gurgle-1209941220170001@dynamic-210.dnai.com>, gurgle@dnai.com
  3467. (Pete Gontier) wrote:
  3468. > I think perhaps you are missing the idea that he *wants* to pre-load all
  3469. > his code resources so that he doesn't have to worry about the memory
  3470. > management issues associated with code segments loading and unloading via
  3471. > Segment Loader and the jump table. It's not that he thinks he must....
  3472. Well, no, I didn't miss it, but his question seemed to indicate that he thought that he *had* to.  If he's still listening, I'd suggest something like this:
  3473.  
  3474. #ifndef powerc
  3475.     <preload code resources>
  3476. #endif
  3477.  
  3478. That'll do it.  But preloading and other memory management things should be done at the end of the development process, when you can spend a lot of time staring at Macsbug heap displays.   I hold that nowadays it's much less of an issue than it was 8 years ago.
  3479. -- 
  3480. Bill Hofmann                                   wdh@fresh.com
  3481. Fresh Software and Instructional Design        voice: +1 510 524 0852
  3482. 1640 San Pablo Ave #C Berkeley CA 94702 USA    fax:   +1 510 524 0853
  3483.  
  3484. +++++++++++++++++++++++++++
  3485.  
  3486. >From gurgle@dnai.com (Pete Gontier)
  3487. Date: Fri, 16 Sep 1994 10:25:41 -0800
  3488. Organization: Integer Poet Software
  3489.  
  3490. In article <wdh-1509941018000001@wdh.slip.netcom.com>, wdh@fresh.com (Bill
  3491. Hofmann) wrote:
  3492.  
  3493. > #ifndef powerc
  3494. >     <preload code resources>
  3495. > #endif
  3496.  
  3497. He can do that, but if he does, CODE 1 and the segment which contains
  3498. 'main' and the segment which contains the code which loads the rest of the
  3499. segments may already have been loaded in a sub-optimal place. (In fact,
  3500. they are almost guranteed to have been.) He wants a solution which (a)
  3501. doesn't require him to worry about what code goes where, and (b) doesn't
  3502. create any heap islands. The traditional solution of marking all the code
  3503. segments pre-loaded and locked doesn't, of course, work under PPC in a fat
  3504. binary because the code segments should *never* be loaded in that case.
  3505. That's why this is such a vexing problem.
  3506.  
  3507. > But preloading and other memory management things should be done at the end
  3508. > of the development process, when you can spend a lot of time...
  3509.  
  3510. That's precisely when when you *cannot* spend a lot of time! :-) Anyway, I
  3511. think if you are going to adopt the policy of not messing with the segment
  3512. loader at all, it's prudent to make that part of the program work right up
  3513. front. You should see the colors my face turns when I'm trying to debug
  3514. one crash and another crash happens because of something like a segment
  3515. loader error. :-)
  3516.  
  3517. > I hold that nowadays it's much less of an issue than it was 8 years ago.
  3518.  
  3519. Right. That's why he wants to dispense with that pesky Segment Loader.
  3520.  
  3521. -- 
  3522.  
  3523.  Pete Gontier // CTO, Integer Poet Software // gurgle@dnai.com
  3524.  
  3525.  "I saw John Norstad with Elvis! And they were varnishing waffles!"
  3526.       -- Peter Cohen <flargh@tiac.net>
  3527.  
  3528. ---------------------------
  3529.  
  3530. End of C.S.M.P. Digest
  3531. **********************
  3532.  
  3533.  
  3534.