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

  1. Received-Date: Mon, 2 May 1994 13:42:08 +0200
  2. From: pottier@clipper.ens.fr (Francois Pottier)
  3. Subject: csmp-digest-v3-022
  4. To: csmp-digest@ens.fr
  5. Date: Mon, 2 May 94 13:41:49 MET DST
  6. X-Mailer: ELM [version 2.3 PL11]
  7. Errors-To: listman@ens.fr
  8. Reply-To: pottier@clipper.ens.fr
  9. X-Sequence: 24
  10.  
  11. C.S.M.P. Digest             Mon, 02 May 94       Volume 3 : Issue 22
  12.  
  13. Today's Topics:
  14.  
  15.         Best way to handle Moveable Modals?
  16.         Can you set the folder in which SFGetFile will open?
  17.         Control Panels items font
  18.         Fixed Point Math on PowerMac
  19.         Keeping DialogPtr's in RAM after startup...
  20.         Metrowerks News from MacWEEK
  21.         WaitNextEvent Emulated on PoMac!?
  22.         X2Fix code generation bug still in SC++ 7.0
  23.  
  24.  
  25.  
  26. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  27. (pottier@clipper.ens.fr).
  28.  
  29. The digest is a collection of article threads from the internet newsgroup
  30. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  31. regularly and want an archive of the discussions.  If you don't know what a
  32. newsgroup is, you probably don't have access to it.  Ask your systems
  33. administrator(s) for details.  If you don't have access to news, you may
  34. still be able to post messages to the group by using a mail server like
  35. anon.penet.fi (mail help@anon.penet.fi for more information).
  36.  
  37. Each issue of the digest contains one or more sets of articles (called
  38. threads), with each set corresponding to a 'discussion' of a particular
  39. subject.  The articles are not edited; all articles included in this digest
  40. are in their original posted form (as received by our news server at
  41. nef.ens.fr).  Article threads are not added to the digest until the last
  42. article added to the thread is at least two weeks old (this is to ensure that
  43. the thread is dead before adding it to the digest).  Article threads that
  44. consist of only one message are generally not included in the digest.
  45.  
  46. The digest is officially distributed by two means, by email and ftp.
  47.  
  48. If you want to receive the digest by mail, send email to listserv@ens.fr
  49. with no subject and one of the following commands as body:
  50.     help                        Sends you a summary of commands
  51.     subscribe csmp-digest Your Name    Adds you to the mailing list
  52.     signoff csmp-digest            Removes you from the list
  53. Once you have subscribed, you will automatically receive each new
  54. issue as it is created.
  55.  
  56. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  57. Questions related to the ftp site should be directed to
  58. scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
  59. digest are available there.
  60.  
  61. Also, the digests are available to WAIS users as comp.sys.mac.programmer.src.
  62.  
  63.  
  64. -------------------------------------------------------
  65.  
  66. >From mahboud@aggroup.com (mahboud)
  67. Subject: Best way to handle Moveable Modals?
  68. Date: Fri, 08 Apr 1994 12:50:48 -0800
  69. Organization: AG Group, Inc.
  70.  
  71. Hi.
  72.  
  73. What's the best way to handle moveable modals?  Specifically, I want to be
  74. able to do process(application) switches (i.e. put my app in the
  75. background, while a moveable modal is foremost).
  76.  
  77. Prefereably I want to be able to do this by changing a filterproc, not by
  78. going through the main event loop.  I have tried putting WaitNextEvents in
  79. the ModalFilterProc, but it did some weird things.  One reason I want to
  80. use the filterproc is that I still want to call ModalDialog to handle the
  81. events in the window, so I don't have to worry about updates, etc..
  82.  
  83. Thanks,
  84.  
  85. mahboud
  86.  
  87. ps.  I already handle moving the dialog from within my filterproc.
  88.  
  89. - -------------------------------------------------------------
  90. Mahboud Zabetian
  91. mahboud@aggroup.com
  92. ag group, inc.
  93. 2540 camino diablo, suite 200
  94. walnut creek, ca 94596
  95. 510-937-7900 voice
  96. 510-937-2479 fax
  97. 510-937-6704 ara
  98. ftp.aggroup.com anonymous ftp
  99.  
  100. +++++++++++++++++++++++++++
  101.  
  102. >From mahboud@aggroup.com (mahboud)
  103. Date: Sun, 10 Apr 1994 14:50:00 -0800
  104. Organization: AG Group, Inc.
  105.  
  106. In article I wrote:
  107. > What's the best way to handle moveable modals?  Specifically, I want to be
  108. > able to do process(application) switches (i.e. put my app in the
  109. > background, while a moveable modal is foremost).
  110. > Prefereably I want to be able to do this by changing a filterproc, not by
  111. > going through the main event loop.  I have tried putting WaitNextEvents in
  112. > the ModalFilterProc, but it did some weird things.  One reason I want to
  113. > use the filterproc is that I still want to call ModalDialog to handle the
  114. > events in the window, so I don't have to worry about updates, etc..
  115.  
  116. In response to all the mail I got, telling me to use the main event loop
  117. and not a filter proc, I'd like to clarify a point.
  118.  
  119. I'd rather not use the main event loop, as I am retro fitting applications,
  120. one modal dialog at a time, and by adding to the filter proc of each
  121. existing dialog (most share the same filterproc), I would be making fewer
  122. changes overall.
  123.  
  124. -mahboud
  125. - -------------------------------------------------------------
  126. Mahboud Zabetian
  127. mahboud@aggroup.com
  128. ag group, inc.
  129. 2540 camino diablo, suite 200
  130. walnut creek, ca 94596
  131. 510-937-7900 voice
  132. 510-937-2479 fax
  133. 510-937-6704 ara
  134. ftp.aggroup.com anonymous ftp
  135.  
  136. +++++++++++++++++++++++++++
  137.  
  138. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  139. Date: Wed, 13 Apr 1994 23:24:46 GMT
  140. Organization: Apple Computer
  141.  
  142. mahboud, mahboud@aggroup.com writes:
  143. > I'd rather not use the main event loop, as I am retro fitting applications,
  144. > one modal dialog at a time, and by adding to the filter proc of each
  145. > existing dialog (most share the same filterproc), I would be making fewer
  146. > changes overall.
  147.  
  148. Given that you can't make them "modeless dialogs that won't let you switch to
  149. another window", you can get most of the functionality by modifying the
  150. filterProc. Users still won't be able to switch layers while your dialogs are
  151. up, unfortunately, because ModalDialog disables layer switching.
  152.  
  153. In your filterProc:
  154. * On mouseDown, call FindWindow. If the click is on the title bar of the
  155. window, call DragWindow. Then change the event record to a nullEvent.
  156. Optionally, you can also respond to command-clicks in other app windows'
  157. title bars by dragging those windows without activating them.
  158. * On update, check whether the target window is an application window other
  159. than the dialog. If so, call whatever application routine handles update
  160. events. If you don't do this, moving the dialog will leave permanent white
  161. areas behind where the dialog used to be, as well as denying background time
  162. to other apps (see the tech note "Pending Update Perils".)
  163.  
  164. --Jens Alfke
  165.   jens_alfke@powertalk              Rebel girl, rebel girl,
  166.             .apple.com              Rebel girl you are the queen of my world
  167.  
  168. +++++++++++++++++++++++++++
  169.  
  170. >From peter.lewis@info.curtin.edu.au (Peter N Lewis)
  171. Date: Fri, 15 Apr 1994 09:46:34 +0800
  172. Organization: NCRPDA, Curtin University
  173.  
  174. In article <1994Apr13.232446.4419@gallant.apple.com>, Jens Alfke
  175. <jens_alfke@powertalk.apple.com> wrote:
  176.  
  177. >mahboud, mahboud@aggroup.com writes:
  178. >> I'd rather not use the main event loop, as I am retro fitting applications,
  179. >> one modal dialog at a time, and by adding to the filter proc of each
  180. >> existing dialog (most share the same filterproc), I would be making fewer
  181. >> changes overall.
  182. >
  183. >Given that you can't make them "modeless dialogs that won't let you switch to
  184. >another window", you can get most of the functionality by modifying the
  185. >filterProc. Users still won't be able to switch layers while your dialogs are
  186. >up, unfortunately, because ModalDialog disables layer switching.
  187.  
  188. If you're going to do this, why not just write your own implementation of
  189. ModalDialog?  It's not that complicated, you just call WNE, and handle
  190. events (passing most of them to IsDialogEvent and DialogSelect).  You have
  191. the same disadvantage of ModalDialog in that you aren't going thru your
  192. main loop, so you can't handle AppleEvents and other things that would
  193. normally get processed.
  194.    Peter.
  195. _______________________________________________________________________
  196. Peter N Lewis <peter.lewis@info.curtin.edu.au>       Ph: +61 9 368 2055
  197.  
  198. +++++++++++++++++++++++++++
  199.  
  200. >From troy@i-link.com (Troy Gaul)
  201. Date: Fri, 15 Apr 1994 18:53:08 -0500
  202. Organization: I-Link, Ltd.
  203.  
  204. In article <peter.lewis-150494094634@rocky.curtin.edu.au>,
  205. peter.lewis@info.curtin.edu.au (Peter N Lewis) wrote:
  206.  
  207. > In article <1994Apr13.232446.4419@gallant.apple.com>, Jens Alfke
  208. > <jens_alfke@powertalk.apple.com> wrote:
  209. > >mahboud, mahboud@aggroup.com writes:
  210. > >> I'd rather not use the main event loop, as I am retro fitting applications,
  211. > >> one modal dialog at a time, and by adding to the filter proc of each
  212. > >> existing dialog (most share the same filterproc), I would be making fewer
  213. > >> changes overall.
  214. > >
  215. > >Given that you can't make them "modeless dialogs that won't let you switch to
  216. > >another window", you can get most of the functionality by modifying the
  217. > >filterProc. Users still won't be able to switch layers while your dialogs are
  218. > >up, unfortunately, because ModalDialog disables layer switching.
  219. > If you're going to do this, why not just write your own implementation of
  220. > ModalDialog?  It's not that complicated, you just call WNE, and handle
  221. > events (passing most of them to IsDialogEvent and DialogSelect).  You have
  222. > the same disadvantage of ModalDialog in that you aren't going thru your
  223. > main loop, so you can't handle AppleEvents and other things that would
  224. > normally get processed.
  225.  
  226. I've done this, and it's not too bad.  Makes retrofitting and still getting
  227. the AppleCorrect(tm) behavior fairly easy.
  228.  
  229. With a little thought (and depending on the design of your application),
  230. you can even get this secondary event loop to handle high level events (if
  231. appropriate).  This is left as an exercise for the reader. 
  232.  
  233. _troy
  234. //////// //////___Troy Gaul____________________________t-gaul@i-link.com__
  235. //
  236.   //    //       Infinity Systems ; West Des Moines, Iowa                
  237. //
  238.  //    //  //  "Good news is just life's way of keeping you off balance" //
  239. //    //////___________________________________________________________ //
  240.  
  241. +++++++++++++++++++++++++++
  242.  
  243. >From Vampire@crypt.demon.co.uk (Vampire)
  244. Date: Sun, 17 Apr 1994 09:10:37 GMT
  245. Organization: Pennangalan Software
  246.  
  247.  
  248. I've been watching this thread for a few days now...
  249.  
  250. The way I do this is a little Windows-inspired (don't all flame me, please...I
  251. HATE Windows...unfortunately my employers don't...
  252.  
  253. I have a main event loop. (Surprise!). When I want to go Movable Modal, I get
  254. the module with the Modal to create its Window as usual, then get it to call a
  255. function 'RegisterModal', with the main control module. This function simply
  256. registers a second event-loop (particular to the movable modal concerned), and
  257. sets an internal Boolean, 'InModal', to TRUE.
  258.  
  259. The main event-loop examines InModal, and if it is TRUE, ALWAYS passes the
  260. event onto the registered secondary event loop for handling. The secondary
  261. function returns TRUE or FALSE, depending upon whether it handled the event or
  262. not. If it didn't, the main-event loop can handle it as normal.
  263.  
  264. That way, the Movable Modal code gets to react to events concerning it, ignore
  265. events that don't (e.g. update a background window), and *pretend* to react to
  266. events it wants ignored (i.e. mousedowns in another Window of the same
  267. application).
  268.  
  269. =============================================================================
  270.                                   |"If I knock on your door, you're a fool;
  271.          VAMPIRE                  | if you invite me in, you're a dead fool"
  272.   (Pennangalan Software)          |  My dust resides @crypt.demon.co.uk
  273. =============================================================================
  274.  
  275. ---------------------------
  276.  
  277. >From blume@twg.com (David Blume)
  278. Subject: Can you set the folder in which SFGetFile will open?
  279. Date: Fri, 15 Apr 1994 00:28:03 GMT
  280. Organization: Gokuraku Videos - Wollongong Dept.
  281.  
  282. Can you set the folder in which SFGetFile and SFPutFile will open?
  283.  
  284. --David
  285. +---------------------------------------------------------------+
  286. |  David Blume    |  "I get tired thinking of all the things I  |
  287. |  blume@twg.com  |   don't want to do."  --Bukowski, _Barfly_  |
  288. +---------------------------------------------------------------+
  289.  
  290. +++++++++++++++++++++++++++
  291.  
  292. >From dubois@primate.wisc.edu (Paul DuBois)
  293. Date: 14 Apr 1994 20:38:06 -0500
  294. Organization: Castra Parvulorum
  295.  
  296. >From article <1994Apr15.002803.14161@twg.com>, by blume@twg.com (David Blume):
  297. > Can you set the folder in which SFGetFile and SFPutFile will open?
  298.  
  299. This is how I do it if I have an FSSpec:
  300.  
  301.     CurDirStore = fss.parID;
  302.     SFSaveDisk = -fss.vRefNum;
  303.  
  304. Note that you use the negative of the vRefNum.
  305.  
  306. I think this is horrendous, because it involves assigning values to
  307. two low-memory globals.  Is there another way to do it?
  308.  
  309. -- 
  310. Paul DuBois
  311. dubois@primate.wisc.edu
  312.  
  313. +++++++++++++++++++++++++++
  314.  
  315. >From stk@uropax.contrib.de (Stefan Kurth)
  316. Date: 17 Apr 1994 01:50:56 +0200
  317. Organization: Contributed Software GbR
  318.  
  319. In article <2okr5uINN970@uakari.primate.wisc.edu>,
  320. Paul DuBois <dubois@primate.wisc.edu> wrote:
  321.  
  322. >     CurDirStore = fss.parID;
  323. >     SFSaveDisk = -fss.vRefNum;
  324. > I think this is horrendous, because it involves assigning values to
  325. > two low-memory globals.
  326.  
  327. Exactly.
  328.  
  329. > Is there another way to do it?
  330.  
  331. If you can require System 7, yes. (the original poster asked about
  332. SFGetFile, so maybe this won't help him). Do a CustomGetFile; in your
  333. dlgHook you check for sfHookFirstCall, and if you receive it, change your
  334. reply record to whatever location you want to have displayed, and return
  335. sfHookChangeSelection. This has the additional advantage that you can
  336. specify a certain file to be selected.
  337.  
  338. (You'll have to pass the address of the reply record in the yourDataPtr
  339. parameter if you don't want to make it a global var).
  340.  
  341. _____________________________________________________________________
  342. Stefan Kurth              Berlin, Germany              stk@contrib.de
  343.  
  344. +++++++++++++++++++++++++++
  345.  
  346. >From pottier@kayak.ens.fr (Francois Pottier)
  347. Date: 17 Apr 1994 21:24:12 GMT
  348. Organization: Ecole Normale Superieure, PARIS, France
  349.  
  350. In article <2optl1$57h@uropax.contrib.de>,
  351. Stefan Kurth <stk@uropax.contrib.de> wrote:
  352.  
  353. >dlgHook you check for sfHookFirstCall, and if you receive it, change your
  354. >reply record to whatever location you want to have displayed, and return
  355. >sfHookChangeSelection. This has the additional advantage that you can
  356. >specify a certain file to be selected.
  357.  
  358. If you want this to work, you also have to set sfScript to 0.
  359. I know it isn't mentioned in Inside Mac, but it's true. Took
  360. me days to figure out (thanks to Jon Watte's FAQ for pointing
  361. it out!)
  362.  
  363. -- 
  364. Francois Pottier
  365. pottier@dmi.ens.fr
  366.  
  367. ---------------------------
  368.  
  369. >From alex@metcalf.demon.co.uk (Alex Metcalf)
  370. Subject: Control Panels items font
  371. Date: Fri, 8 Apr 1994 23:20:33 GMT
  372. Organization: Demon Internet
  373.  
  374.  
  375. This is a slightly dumb question...
  376.  
  377. How do you set the font for the DITL resource for a control panel? I've
  378. often opened up ResEdit to find the control panel's DITL displayed in
  379. Geneva 9 (such as check boxes and static text), but I can't seem to change
  380. from the default Chicago 12.
  381.  
  382. Thanks,
  383.  
  384.  
  385. Alex
  386.  
  387. --
  388. Alex Metcalf, Mac programmer in C, C++, HyperTalk, assembler
  389.  
  390. Internet, AOL, BIX: alex@metcalf.demon.co.uk            "Surely you
  391. AppleLink:          alex@metcalf.demon.co.uk@internet#   can't be
  392. CompuServe:         INTERNET:alex@metcalf.demon.co.uk    serious?"
  393. Delphi:             alex@metcalf.demon.co.uk@inet#
  394. FirstClass:         alex@metcalf.demon.co.uk,Internet   "I'm serious...
  395. Fax (UK):           (0570) 45636                         and don't call
  396. Fax (US / Canada):  011 44 570 45636                     me Shirley."
  397.  
  398. +++++++++++++++++++++++++++
  399.  
  400. >From bjaques@vanbc.wimsey.com (Barton Jaques)
  401. Date: 10 Apr 1994 20:43:53 GMT
  402. Organization: Wimsey Information Services
  403.  
  404. In article <alex-090494002008@metcalf.demon.co.uk>,
  405. alex@metcalf.demon.co.uk (Alex Metcalf) wrote:
  406.  
  407. > How do you set the font for the DITL resource for a control panel? I've
  408. > often opened up ResEdit to find the control panel's DITL displayed in
  409. > Geneva 9 (such as check boxes and static text), but I can't seem to change
  410. > from the default Chicago 12.
  411.  
  412. In your cdev code, just set TextFont() to whatever you desire, before any
  413. drawing is done. Be sure to change it back whenever your code exits.
  414. You can change the ResEdit view font under "View As I" in the DITL editor.
  415. That only changes how it appears in ResEdit, though; it has no effect on
  416. the DITL resource contents.
  417. -- 
  418. bjaques@wimsey.com
  419.  
  420. +++++++++++++++++++++++++++
  421.  
  422. >From Reid Ellis <rae@alias.com>
  423. Date: Sat, 16 Apr 1994 03:47:27 GMT
  424. Organization: Alias Research, Inc., Toronto ON Canada
  425.  
  426. Alex Metcalf <alex@metcalf.demon.co.uk> asks:
  427. |How do you set the font for the DITL resource for a control panel?
  428.  
  429. Barton Jaques <bjaques@vanbc.wimsey.com> replies:
  430. |In your cdev code, just set TextFont() to whatever you desire, before
  431. |any drawing is done. Be sure to change it back whenever your code
  432. |exits.
  433.  
  434. Alternatively, include a 'finf' resource, id=-4049, and set its three
  435. 16-bit ints to the font id, style, and size you want [in that order].
  436.  
  437. Caveat: I've been having problems with 'useWFont' popup menus in
  438. combination with the 'finf' resource under System 7.0 [it's fine under
  439. System 7.1]
  440.  
  441. Reid
  442. --
  443. - -
  444. Reid Ellis, Alias Research Inc.
  445. +1 416 362 9181 <rae@Alias.com>
  446.  
  447. ---------------------------
  448.  
  449. >From Willie Rauchwerger <willie-rauchwerger@uokhsc.edu>
  450. Subject: Fixed Point Math on PowerMac
  451. Date: 6 Apr 1994 21:22:02 GMT
  452. Organization: OU Health Sciences Center
  453.  
  454. My image manipluation software uses fixed-point math for matrix
  455. math. However, in my PowerPC port, I am getting hardly no
  456. performance boost (seems slower to me) when I hit the matrix
  457. calcuations.
  458.  
  459. After running TrapsCheck (very cool stuff), I find that the Fixed
  460. point math routines are not native. Ugh.
  461.  
  462. After deciding not to do floating point because of speed, finding
  463. that Fixed-point calculations are slower now is not too funny. 
  464. I would like to keep it using fixed point so that I can get good
  465. performance regardless of processor.
  466.  
  467. Any ideas aobut how to get around this? Any ideas when the Fixed
  468. point routines  will be native?
  469.  
  470. Any separate libraries to do fixed point calculations?
  471.  
  472. - -----------------------------------------------------------------
  473. Willie Rauchwerger         AppleLink: Willie
  474. Telemedicine Software Guy  Internet:  willie-rauchwerger@uokhsc.edu
  475. OU Health Sciences Center
  476.  
  477. +++++++++++++++++++++++++++
  478.  
  479. >From zstern@adobe.com (Zalman Stern)
  480. Date: Wed, 6 Apr 1994 22:50:44 GMT
  481. Organization: Adobe Systems Incorporated
  482.  
  483. Willie Rauchwerger <willie-rauchwerger@uokhsc.edu> writes
  484. > My image manipluation software uses fixed-point math for matrix
  485. > math. However, in my PowerPC port, I am getting hardly no
  486. > performance boost (seems slower to me) when I hit the matrix
  487. > calcuations.
  488. > After running TrapsCheck (very cool stuff), I find that the Fixed
  489. > point math routines are not native. Ugh.
  490.  
  491. Fixed point routines are not handled via traps for native code. Rather they  
  492. are in the shared library InterfaceLib. This is a godd idea as already in  
  493. 68K land people were using skanky hacks to get around the trap dispatcher  
  494. overhead for the fixed-point math code.
  495.  
  496. For emulated code, the cost of doing a mixed mode switch to native mode  
  497. outweighs the benefit of faster antive mode execution. (Especially since the  
  498. emualtor is going to be executing native multiply instructions anyway at the  
  499. bottom level.)
  500. --
  501. Zalman Stern           zalman@adobe.com            (415) 962 3824
  502. Adobe Systems, 1585 Charleston Rd., POB 7900, Mountain View, CA 94039-7900
  503. "Do right, and risk consequences." Motto of Sam Houston (via Molly Ivins)
  504.  
  505. +++++++++++++++++++++++++++
  506.  
  507. >From fixer@faxcsl.dcrt.nih.gov (Chris Gonna' Find Ray Charles Tate)
  508. Date: Wed, 6 Apr 1994 23:46:17 GMT
  509. Organization: DCRT, NIH, Bethesda, MD
  510.  
  511. In article <1994Apr6.225044.12892@adobe.com>, zstern@adobe.com (Zalman Stern) writes:
  512. >Willie Rauchwerger <willie-rauchwerger@uokhsc.edu> writes
  513. >>
  514. >> My image manipluation software uses fixed-point math for matrix
  515. >> math. However, in my PowerPC port, I am getting hardly no
  516. >> performance boost (seems slower to me) when I hit the matrix
  517. >> calcuations.
  518. >
  519. >For emulated code, the cost of doing a mixed mode switch to native mode  
  520. >outweighs the benefit of faster native mode execution. (Especially since the  
  521. >emualtor is going to be executing native multiply instructions anyway at the  
  522. >bottom level.)
  523.  
  524. Is fixed-point still going to be faster on the PowerPC than floating-
  525. point?  It may not, since the PPC's floating-point unit is so much
  526. faster than (say) the MC6888x's.  If someone could come up with some
  527. hard figures for this, it'd be handy.  Zalman?  Anyone?
  528.  
  529. (I *think* I remember hearing that for most things - like, anything
  530. more complex than loop counting and such - floating-point is going to
  531. be faster on the PPC than integer math.  Am I right, or hallucinating
  532. again?)
  533.  
  534. - -------------------------------------------------------------------
  535. Christopher Tate             |   "Blue ice cubes?  How degenerate!"
  536. MSD, Inc.                    |
  537. fixer@faxcsl.dcrt.nih.gov    |    < anybody recognize the source? >
  538.  
  539. +++++++++++++++++++++++++++
  540.  
  541. >From jwbaxter@olympus.net (John W. Baxter)
  542. Date: Wed, 06 Apr 1994 18:24:34 -0700
  543. Organization: Internet for the Olympic Peninsula
  544.  
  545. In article <1994Apr6.234617.11486@alw.nih.gov>, fixer@faxcsl.dcrt.nih.gov
  546. (Chris Gonna' Find Ray Charles Tate) wrote:
  547.  
  548. > Is fixed-point still going to be faster on the PowerPC than floating-
  549. > point?  It may not, since the PPC's floating-point unit is so much
  550. > faster than (say) the MC6888x's.  If someone could come up with some
  551. > hard figures for this, it'd be handy.  Zalman?  Anyone?
  552. > (I *think* I remember hearing that for most things - like, anything
  553. > more complex than loop counting and such - floating-point is going to
  554. > be faster on the PPC than integer math.  Am I right, or hallucinating
  555. > again?)
  556.  
  557. It seems to me that working out the details is going to be tough, and
  558. variable over time.  I *suspect* that switching *some* operations to
  559. floating point will speed things up, just because the processor can do more
  560. things at once that way.  IF you're looking at code which has had
  561. instruction scheduling applied to it, and IF the compiler you are using
  562. does a good job of that (that's the part likely to vary over time).
  563.  
  564. Bottom line:  beware the quick and dirty "benchmark" in this area.  For
  565. now, write your code in the most convenient (for
  566. writing/understanding/maintenance) way.  [There was a flap a while back
  567. about one of the compilers not strength-reducing loops over arrays from
  568. multiplies to adds.  My particular quick and dirty "benchmark" (not to be
  569. trusted) suggested that on PPC it makes no difference (so why should the
  570. compiler bother, except to avoid folks complaining about "poor
  571. optimization").]
  572. -- 
  573. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  574.    jwbaxter@pt.olympus.net
  575.  
  576. +++++++++++++++++++++++++++
  577.  
  578. >From johnmce@world.std.com (John McEnerney)
  579. Date: Thu, 7 Apr 1994 16:35:02 GMT
  580. Organization: The World Public Access UNIX, Brookline, MA
  581.  
  582. [There was a flap a while back
  583. about one of the compilers not strength-reducing loops over arrays from
  584. multiplies to adds.  My particular quick and dirty "benchmark" (not to be
  585. trusted) suggested that on PPC it makes no difference (so why should the
  586. compiler bother, except to avoid folks complaining about "poor
  587. optimization").]
  588.  
  589. Floating-point adds take about the same time as multiplies (1 more cycle 
  590. unless it is single-precision). Integer adds are -considerably- quicker 
  591. than integer multiples: 1 cycle vs. 5 or 9.
  592.  
  593. > Is fixed-point still going to be faster on the PowerPC than floating-
  594. > point? 
  595.  
  596. Again, it depends on the distribution of the operations. Integer 
  597. multiplies and divides are -way- slower than floating-point. Adds/subs 
  598. are -way- faster.
  599.  
  600. For any compiler that does instruction scheduling, you'll probably get 
  601. better results using floating-point, because the floating-point 
  602. arithmetic can operate in parallel with the integer instructions used for 
  603. loops, branches, etc.
  604.  
  605. -- John
  606.  
  607.  
  608.  
  609. +++++++++++++++++++++++++++
  610.  
  611. >From 103t_english@west.cscwc.pima.edu
  612. Date: 8 Apr 94 01:19:50 MST
  613. Organization: (none)
  614.  
  615. In article <2nv95q$5at@romulus.ucs.uoknor.edu>, Willie Rauchwerger <willie-rauchwerger@uokhsc.edu> writes:
  616. > My image manipluation software uses fixed-point math for matrix
  617. > math. However, in my PowerPC port, I am getting hardly no
  618. > performance boost (seems slower to me) when I hit the matrix
  619. > calcuations.
  620. > After running TrapsCheck (very cool stuff), I find that the Fixed
  621. > point math routines are not native. Ugh.
  622. > After deciding not to do floating point because of speed, finding
  623. > that Fixed-point calculations are slower now is not too funny. 
  624. > I would like to keep it using fixed point so that I can get good
  625. > performance regardless of processor.
  626. > Any ideas aobut how to get around this? Any ideas when the Fixed
  627. > point routines  will be native?
  628. > Any separate libraries to do fixed point calculations?
  629. > -------------------------------------------------------------------
  630. > Willie Rauchwerger         AppleLink: Willie
  631. > Telemedicine Software Guy  Internet:  willie-rauchwerger@uokhsc.edu
  632. > OU Health Sciences Center
  633.  
  634. Since you are claiming a need for critical speed, I wonder why you bother with
  635. the overhead of the Fixed-Point trap  on the 68K side anyways?
  636.  
  637. Rolling your own 68k fixedpoint routines will save you 100+ CPU cycles for
  638. every fixed-point call as that is the overhead of the trap dispatcher.
  639.  
  640. As I understand it, there is no trap dispatcher on the PowerMac: the emulator
  641. does it automatically. However, that don't mean that you should be happy with
  642. the result either way.
  643.  
  644. Having read this thread backwards, I note that the PowerMac doesn't do native
  645. fixed point due to the overhead from the Mixed Mode manager. Why not roll your
  646. own routines for both 68K and PowerMac and use each as it is appropriate,
  647. thereby avoiding the trap dispatcher on the 68k Macs and the emulator overhead
  648. on the PowerMacs?
  649.  
  650.  
  651. Lawson
  652.  
  653. +++++++++++++++++++++++++++
  654.  
  655. >From d88-jwa@hemul.nada.kth.se (Jon Wdtte)
  656. Date: 8 Apr 1994 09:58:42 GMT
  657. Organization: The Royal Institute of Technology
  658.  
  659. >fixed point due to the overhead from the Mixed Mode manager. Why not roll your
  660. >own routines for both 68K and PowerMac and use each as it is appropriate,
  661. >thereby avoiding the trap dispatcher on the 68k Macs and the emulator overhead
  662. >on the PowerMacs?
  663.  
  664. Why not define macros for your data representation and manipulation,
  665. and have it use single-precision floats on the PPC and fixeds on 68K?
  666. That way, you get the superior math performance on the PPC (where
  667. float multiplies/divides are faster than integer) and keep the speed
  668. on the 68K. And, yes, implementing your own fixed math macros is
  669. pretty much a must.
  670. -- 
  671.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
  672.  
  673.    This article printed on 100% recycled electrons.
  674.  
  675. +++++++++++++++++++++++++++
  676.  
  677. >From Willie Rauchwerger <willie-rauchwerger@uokhsc.edu>
  678. Date: 8 Apr 1994 14:42:46 GMT
  679. Organization: OU Health Sciences Center
  680.  
  681. In article <2o39si$673@news.kth.se> Jon W!tte, d88-jwa@hemul.nada.kth.se
  682. writes:
  683. >Why not define macros for your data representation and manipulation,
  684. >and have it use single-precision floats on the PPC and fixeds on 68K?
  685. >That way, you get the superior math performance on the PPC (where
  686. >float multiplies/divides are faster than integer) and keep the speed
  687. >on the 68K. And, yes, implementing your own fixed math macros is
  688. >pretty much a must.
  689.  
  690. OK. It is obvious to me that I need to roll my own fixed point routines.
  691. My question is whether there are any out there right now that people
  692. have used to get around the trap overhead, or do I really need to roll
  693. my own. (I think I can handle most of it, but I worry about it being
  694. entirrly correct, and those trig functions...)
  695.  
  696. My next question is, how can floating point be faster than integer
  697. math on the PowerPC (or any processor for that matter)? It would
  698. seem to me that no matter how fast fp is, integer should faster -
  699. otherwise, should I start using fp for counters, etc. :-)
  700.  
  701. - -----------------------------------------------------------------
  702. Willie Rauchwerger         AppleLink: Willie
  703. Telemedicine Software Guy  Internet:  willie-rauchwerger@uokhsc.edu
  704. OU Health Sciences Center
  705.  
  706. +++++++++++++++++++++++++++
  707.  
  708. >From d88-jwa@dront.nada.kth.se (Jon Wdtte)
  709. Date: 8 Apr 1994 15:40:13 GMT
  710. Organization: The Royal Institute of Technology
  711.  
  712. In <2o3qh6$b2c@romulus.ucs.uoknor.edu> Willie Rauchwerger <willie-rauchwerger@uokhsc.edu> writes:
  713.  
  714. >My next question is, how can floating point be faster than integer
  715. >math on the PowerPC (or any processor for that matter)? It would
  716. >seem to me that no matter how fast fp is, integer should faster -
  717. >otherwise, should I start using fp for counters, etc. :-)
  718.  
  719. The integer unit is not designed the same as the floating-point
  720. unit, and the FP unit kicks some serious butt.
  721.  
  722. The only thing preventing you from using floating point registers
  723. for counters is that you can't index using floating-point registers,
  724. and the conversion to integer is slow. Else, go ahead! (addition
  725. and subtraction of course aren't faster in FP, but multiply and
  726. divide are)
  727.  
  728. Cheers,
  729.  
  730.                     / h+
  731. -- 
  732.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
  733.  "If people bought cars according to the same principles they buy computers,
  734.   cars would behave like Lamborghinis but would be built and look like Yugos."
  735.                      -- Craig Fields
  736.  
  737. +++++++++++++++++++++++++++
  738.  
  739. >From rmcassid@uci.edu (Robert Cassidy)
  740. Date: Fri, 08 Apr 1994 09:45:15 -0700
  741. Organization: TLG Project
  742.  
  743. In article <2o3tst$99f@news.kth.se>, d88-jwa@dront.nada.kth.se (Jon Wtte)
  744. wrote:
  745.  
  746. > In <2o3qh6$b2c@romulus.ucs.uoknor.edu> Willie Rauchwerger <willie-rauchwerger@uokhsc.edu> writes:
  747. > >My next question is, how can floating point be faster than integer
  748. > >math on the PowerPC (or any processor for that matter)? It would
  749. > >seem to me that no matter how fast fp is, integer should faster -
  750. > >otherwise, should I start using fp for counters, etc. :-)
  751. > The integer unit is not designed the same as the floating-point
  752. > unit, and the FP unit kicks some serious butt.
  753. > The only thing preventing you from using floating point registers
  754. > for counters is that you can't index using floating-point registers,
  755. > and the conversion to integer is slow. Else, go ahead! (addition
  756. > and subtraction of course aren't faster in FP, but multiply and
  757. > divide are)
  758.  
  759. Doesn't the integer unit handle all of the register loading as well?
  760. Wouldn't that be even more incentive to use the fp unit in certain
  761. instances?
  762.  
  763. -- 
  764. Robert Cassidy
  765. TLG Project
  766. UC Irvine
  767.  
  768. Let's hope 'Information SuperTollroad' isn't the catchphrase of the next
  769. decade...
  770.  
  771. +++++++++++++++++++++++++++
  772.  
  773. >From cforden@netcom.com (Chris Forden)
  774. Date: Fri, 8 Apr 1994 16:57:41 GMT
  775. Organization: NETCOM On-line Communication Services (408 241-9760 guest)
  776.  
  777. Excerpted from my upcoming article in the May issue of
  778. MacTech--
  779.  
  780. Clever programmers of 68K Macs have done the fastest
  781. calculations with integer arithmetic.  For instance, the
  782. calculation of screen position of 2D CAD objects can be done
  783. quickest using the long (32 bit) integer arithmetic available
  784. on the 68020 and better.  (The FixMath routines in those
  785. machinesUs ROM automatically make use of the extended
  786. instructions.)  Some programmers were even willing to put up
  787. the aggravation of doing all the worst-case analyses of
  788. overflow and underflow needed to use fixed-point math routines
  789. reliably.
  790.  
  791. However, on the PowerPC, the floating point performance is so
  792. much improved that now one gets faster execution by using
  793. floating point routines than by using fixed point arithmetic in
  794. any case where precautions would need to be taken against
  795. overflow error or precision loss due to underflow.  Those two
  796. enemies of integer arithmeticP  overflow and underflowP  ravage
  797. more fixed point math schemes than programmers expect a priori.
  798.  Therefore calculating with floating point is generally much
  799. easier than adapting fixed-point arithmetic to oneUs needs.
  800.  
  801. So how much faster is floating point?  A friend of mine timed
  802. various implementations of an FFT-based image processing
  803. algorithm running on several Mac platforms.  Here are his 
  804. results tabularized, including single precision floating point,
  805. for  a one-way 512 x 512 FFT:
  806.  
  807.              IIci w/cache       Power Mac proto
  808.              ------------       ---------------
  809. integer      52 sec             14.5 sec
  810. single float 80 sec             3   sec
  811.  
  812. Integer arithmetic on the Power Mac prototype was about the 
  813. same as the Quadra 840avUs, but single precision float on the
  814. Power Mac was 4.5 times faster than the faster (integer with 
  815. special long mul assembly) arithmetic on Q840av.  We were using
  816. a bottom-of-the-line Power Mac prototype, running at only 50
  817. MHz.
  818.  
  819. Double-precision floating point on the PowerPC is only 0% to 20%
  820. slower than single-precision floating point.  The 64 bits of
  821. the double-precision format mean you have great freedom from
  822. precision loss.  The PowerPC also has a multiply-and-add
  823. instruction, often called Rmultiply and accumulateS.  It
  824. combines a multiplication and an addition into a single
  825. instruction.  Many signal processing programs for audio or
  826. images can make heavy use of that instruction, which optimizing
  827. -- 
  828. cforden@netcom.com 's self-referential signature quote:  "Huh?"
  829.  
  830. +++++++++++++++++++++++++++
  831.  
  832. >From 103t_english@west.cscwc.pima.edu
  833. Date: 9 Apr 94 16:30:50 MST
  834. Organization: (none)
  835.  
  836. In article <2o3qh6$b2c@romulus.ucs.uoknor.edu>, Willie Rauchwerger <willie-rauchwerger@uokhsc.edu> writes:
  837. > In article <2o39si$673@news.kth.se> Jon W!tte, d88-jwa@hemul.nada.kth.se
  838. > writes:
  839. >>Why not define macros for your data representation and manipulation,
  840. >>and have it use single-precision floats on the PPC and fixeds on 68K?
  841. >>That way, you get the superior math performance on the PPC (where
  842. >>float multiplies/divides are faster than integer) and keep the speed
  843. >>on the 68K. And, yes, implementing your own fixed math macros is
  844. >>pretty much a must.
  845. > OK. It is obvious to me that I need to roll my own fixed point routines.
  846. > My question is whether there are any out there right now that people
  847. > have used to get around the trap overhead, or do I really need to roll
  848. > my own. (I think I can handle most of it, but I worry about it being
  849. > entirrly correct, and those trig functions...)
  850. > My next question is, how can floating point be faster than integer
  851. > math on the PowerPC (or any processor for that matter)? It would
  852. > seem to me that no matter how fast fp is, integer should faster -
  853. > otherwise, should I start using fp for counters, etc. :-)
  854. FP adds and subtracts are every bit as fast as fixed point adds and subtracts.
  855. In fact, I understand that it is possible to get extra speed out of the 601 by
  856. using fp indexes in loops...
  857.  
  858. Lawson
  859.  
  860. +++++++++++++++++++++++++++
  861.  
  862. >From jwbaxter@olympus.net (John W. Baxter)
  863. Date: Thu, 14 Apr 1994 01:14:02 -0700
  864. Organization: Internet for the Olympic Peninsula
  865.  
  866. In article <2nv95q$5at@romulus.ucs.uoknor.edu>, Willie Rauchwerger
  867. <willie-rauchwerger@uokhsc.edu> wrote:
  868.  
  869. > After deciding not to do floating point because of speed...
  870.  
  871. A preconception which has long been true, on a wide variety of hardware. 
  872. But...you may well find that using float (the 4-byte form) on PPC is the
  873. right way to go.  Run your time trials on your program built that way (and
  874. let us know how they come out).  [Enabling the Instruction Scheduling
  875. optimization could well be important here.  If you're using a compiler
  876. which does it well or even semi-well.]
  877.  
  878. -- 
  879. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  880.    jwbaxter@pt.olympus.net
  881.  
  882. +++++++++++++++++++++++++++
  883.  
  884. >From Dave Falkenburg <falken@apple.com>
  885. Date: Fri, 15 Apr 1994 16:30:31 GMT
  886. Organization: Apple Computer, Inc.
  887.  
  888. In article <1994Apr8.011950.1@west.cscwc.pima.edu> ,
  889. 103t_english@west.cscwc.pima.edu writes:
  890. >Having read this thread backwards, I note that the PowerMac doesn't do
  891. native
  892. >fixed point due to the overhead from the Mixed Mode manager. Why not
  893. roll your
  894. >own routines for both 68K and PowerMac and use each as it is appropriate,
  895. >thereby avoiding the trap dispatcher on the 68k Macs and the emulator
  896. overhead
  897. >on the PowerMacs?
  898.  
  899. Many of the FixMath routines are "split" traps, which do not support
  900. patching
  901. anymore. On PowerPC, they are implemented inside InterfaceLib directly,
  902. and
  903. are not called through the trap dispatcher...
  904.  
  905. -Dave Falkenburg
  906. -Apple Computer, Inc.
  907.  
  908. +++++++++++++++++++++++++++
  909.  
  910. >From 103t_english@west.cscwc.pima.edu
  911. Date: 17 Apr 94 08:09:19 MST
  912. Organization: (none)
  913.  
  914. In article <1994Apr15.163031.5662@gallant.apple.com>, Dave Falkenburg <falken@apple.com> writes:
  915. > In article <1994Apr8.011950.1@west.cscwc.pima.edu> ,
  916. > 103t_english@west.cscwc.pima.edu writes:
  917. >>Having read this thread backwards, I note that the PowerMac doesn't do
  918. > native
  919. >>fixed point due to the overhead from the Mixed Mode manager. Why not
  920. > roll your
  921. >>own routines for both 68K and PowerMac and use each as it is appropriate,
  922. >>thereby avoiding the trap dispatcher on the 68k Macs and the emulator
  923. > overhead
  924. >>on the PowerMacs?
  925. > Many of the FixMath routines are "split" traps, which do not support
  926. > patching
  927. > anymore. On PowerPC, they are implemented inside InterfaceLib directly,
  928. > and
  929. > are not called through the trap dispatcher...
  930. > -Dave Falkenburg
  931. > -Apple Computer, Inc.
  932.  
  933. I take it that they are "native" then?
  934.  
  935.  
  936. Lawson
  937.  
  938. ---------------------------
  939.  
  940. >From rrose@CSOS.ORST.EDU (-= Godfather Moof =-)
  941. Subject: Keeping DialogPtr's in RAM after startup...
  942. Date: 13 Apr 1994 23:44:59 GMT
  943. Organization: CS Outreach Services, Oregon State University, Corvallis, OR, USA
  944.  
  945. I'm writing an INIT that I would like to load a DialogPtr into ram at 
  946. startup so that the trap macro I am patching can use it later.  So far
  947. I've tryed converting the ptr to a handle and locking the handle, but without
  948. success.  I've tryed just opening up the file the Dialog Box is located in,
  949. but that's to much of a hassle in case the dialog resource gets deleted,
  950. (which it might).
  951.  
  952. Can anyone help?
  953.  
  954.  
  955.  
  956.                                                                    /-/
  957.              Dogcow lives...                                   ___/ /__
  958.                                                               /__  ___/
  959.              Godfather Moof:                                  | / /| |
  960.              rrose@csos.orst.edu                              |/_/ | |
  961.                                                               | |  | |
  962.              He'll make you an offer you can't refuse.        | |    |
  963.                                                                 |
  964.  
  965. +++++++++++++++++++++++++++
  966.  
  967. >From zobkiw@datawatch.com (joe zobkiw)
  968. Date: Thu, 14 Apr 1994 20:41:09 GMT
  969. Organization: Datawatch Corporation
  970.  
  971. In article <2oi05r$jco@jadzia.CSOS.ORST.EDU>, rrose@CSOS.ORST.EDU (-=
  972. Godfather Moof =-) wrote:
  973.  
  974. > I'm writing an INIT that I would like to load a DialogPtr into ram at 
  975. > startup so that the trap macro I am patching can use it later.  So far
  976. > I've tryed converting the ptr to a handle and locking the handle, but without
  977. > success.  I've tryed just opening up the file the Dialog Box is located in,
  978. > but that's to much of a hassle in case the dialog resource gets deleted,
  979. > (which it might).
  980.  
  981. Forget abou it. Simply (at INIT time) call the following routine (passing
  982. CurResFile() as the refNum) to learn where your INIT is. Then, in your
  983. patch, when you need access to your resources, simply open the INIT file
  984. and use the resources. Don't forget to close it when you are done.
  985.  
  986. OSErr FindFileSpec(short refNum, short *foundVRefNum, long *foundDirID,
  987. unsigned char *fileName)
  988. {
  989.     FCBPBRec        pb;
  990.     OSErr           err = noErr;
  991.     
  992.     pb.ioCompletion = NULL;
  993.     pb.ioNamePtr = fileName;
  994.     pb.ioVRefNum = 0;
  995.     pb.ioRefNum = refNum;
  996.     pb.ioFCBIndx = 0;
  997.     
  998.     err = PBGetFCBInfoSync(&pb);
  999.     
  1000.     *foundVRefNum = pb.ioFCBVRefNum;
  1001.     *foundDirID = pb.ioFCBParID;
  1002.             
  1003.     return err;
  1004. }
  1005.  
  1006. ___________________________________________________________
  1007. _/_/_/_/   Joe Zobkiw                                   ,,,
  1008.     _/     Senior Software Engineer                     - -
  1009.   _/       Datawatch Corporation                         L
  1010. _/_/_/_/   zobkiw@datawatch.com                          -
  1011.  
  1012. +++++++++++++++++++++++++++
  1013.  
  1014. >From petm@soda.berkeley.edu (Peter Mattis)
  1015. Date: 16 Apr 1994 23:29:00 GMT
  1016. Organization: Computer Science Undergrad Assoc., UCBerkeley
  1017.  
  1018. In article <zobkiw-140494154109@zobkiw.datawatch.com>,
  1019. joe zobkiw <zobkiw@datawatch.com> wrote:
  1020. >In article <2oi05r$jco@jadzia.CSOS.ORST.EDU>, rrose@CSOS.ORST.EDU (-=
  1021. >Godfather Moof =-) wrote:
  1022. >
  1023. >> I'm writing an INIT that I would like to load a DialogPtr into ram at 
  1024. >> startup so that the trap macro I am patching can use it later.  So far
  1025. >> I've tryed converting the ptr to a handle and locking the handle, but without
  1026. >> success.  I've tryed just opening up the file the Dialog Box is located in,
  1027. >> but that's to much of a hassle in case the dialog resource gets deleted,
  1028. >> (which it might).
  1029. >> 
  1030. >
  1031. >Forget abou it. Simply (at INIT time) call the following routine (passing
  1032. >CurResFile() as the refNum) to learn where your INIT is. Then, in your
  1033. >patch, when you need access to your resources, simply open the INIT file
  1034. >and use the resources. Don't forget to close it when you are done.
  1035. [SNIP]
  1036.  
  1037. Yes, but what happens if the user moves the init file? (Hmm...bit of a
  1038. problem, isn't it?)
  1039.  
  1040. The method I used for displaying a dialog box in the manner you
  1041. describe is to get the handle to the 'DITL' (dialog items list) resource
  1042. at start time. Remember to call DetachResource and HLock the handle.
  1043. This handle can then be used in a call to NewDialog to create a dialog
  1044. with the your items in it.
  1045.  
  1046. Be careful and make sure the item list doesn't get deleted somewhere
  1047. along the line.
  1048.  
  1049. -Peter Mattis
  1050.  
  1051. +++++++++++++++++++++++++++
  1052.  
  1053. >From ari@world.std.com (Ari I Halberstadt)
  1054. Date: Sun, 17 Apr 1994 03:22:03 GMT
  1055. Organization: The World Public Access UNIX, Brookline, MA
  1056.  
  1057. In article <2opsbs$jed@agate.berkeley.edu>,
  1058. Peter Mattis <petm@soda.berkeley.edu> wrote:
  1059. >
  1060. >The method I used for displaying a dialog box in the manner you
  1061. >describe is to get the handle to the 'DITL' (dialog items list) resource
  1062. >at start time. Remember to call DetachResource and HLock the handle.
  1063. >This handle can then be used in a call to NewDialog to create a dialog
  1064. >with the your items in it.
  1065. >
  1066. >Be careful and make sure the item list doesn't get deleted somewhere
  1067. >along the line.
  1068.  
  1069. You would also have to ensure that the dialog only accesses resources
  1070. from the system file. For instance, you couldn't specify a popup
  1071. control using 'CNTL' and 'MENU' resources. You could write code to
  1072. create the popup menu on the fly, or you could write code to create
  1073. the control and menu by saving copies of the resources, and then
  1074. attach the popup to the dialog. It's easier, as suggested in a prior
  1075. post, just to open the extension's resource file before creating the
  1076. dialog. I don't think it's too unreasonable to expect an extension to
  1077. be able to find its own file or some preferences file. If the user
  1078. goes and moves the file, a simple alert (or notification manager
  1079. alert) could issue a gentle admonishment.
  1080. -- 
  1081. Ari Halberstadt    ari@world.std.com     #include <std/disclaimer.h>
  1082. "These beetles were long considered to be very rare because very few
  1083. entomologists look for beetles in the mountains, in winter, at night,
  1084. during snow storms." -- Purves W. K., et al, "Life: The Science of
  1085.  
  1086. ---------------------------
  1087.  
  1088. >From Robert Hess <robert_hess@macweek.ziff.com>
  1089. Subject: Metrowerks News from MacWEEK
  1090. Date: Sat, 9 Apr 1994 02:35:44 GMT
  1091. Organization: MacWEEK
  1092.  
  1093. As a service, here are some snippets from Monday!s MacWEEK. I'll try to do
  1094. this in the future when there's developer-related news but it will be as
  1095. time permits...
  1096.  
  1097. St. Laurent, Quebec -- Metrowerks Inc., the developer community's bold new
  1098. kid on the block, has received a big boost from a formidable ally, IBM
  1099. Corp., and will announce several major additions to its CodeWarrior
  1100. product this week.
  1101.  
  1102. Metrowerks has formed an agreement with IBM which gives Metrowerks access
  1103. to Big Blue's compiler optimization technology for current and future
  1104. PowerPC processors. As a result, Mac developers will have access to the
  1105. best PowerPC code generators available, said Jean Belanger, Metrowerks'
  1106. chairman. "In addition to having the fastest compiler, we'll be able to
  1107. generate the fastest code," he said.
  1108.  
  1109. At Apple's Worldwide Developers Conference next month Metrowerks will
  1110. ship:
  1111.  
  1112. MPW MW CW: Metrowerks will make its native and 680x0 compilers available
  1113. to users of Apple's Macintosh Programmer's Workshop. The combination will
  1114. bring CodeWarrior's speed and MPW's large project- and team-management
  1115. tools together.
  1116.  
  1117. Native-hosted 68K codegen: Metrowerks President and CEO Greg Galanos said,
  1118. "The new compiler is four to five times as fast as our 680x0-based
  1119. compiler and eight times as fast as Think."
  1120.  
  1121. Metrowerks will ship its 680x0 and PowerPC compilers as fat binaries, so
  1122. both can run and generate code for either processor line. The MPW-hosted
  1123. compiler will be included free.
  1124.  
  1125. Since developers feel Apple has not committed to continue supporting the
  1126. language,  Metrowerks will introduce an Object Pascal version of its
  1127. compiler by year-end.
  1128.  
  1129. Metrowerks is now bundling CodeWarrior with NeoLogic Systems' NeoPersist,
  1130. an object-oriented data storage utility for programmers. An encrypted copy
  1131. of NeoAccess, an object-oriented database extension of NeoPersist, is also
  1132. included; users can upgrade for $649.
  1133.  
  1134. Metrowerks plans to open its first U.S. office in Austin, Texas, June 1.
  1135. The Austin office will be the headquarters of the technical support,
  1136. quality assurance and sales divisions.
  1137.  
  1138. [For the full text, see MacWEEK or ZiffNet on CompuServe, eWorld or
  1139. AppleLink]
  1140.  
  1141. ========================================================================
  1142. Robert Hess, WEEKgeek                      robert_hess@macweek.ziff.com
  1143. MacWEEK                                    AppleLink: WNDZSX
  1144. 301 Howard                                 CompuServe: 72511,333
  1145. San Francisco, Calif. 94105                America Online: MacWEEK
  1146. (415) 243-3576 days                        MCI: RHESS
  1147. (415) 243-3651 fax
  1148. (415) 647-5549 nights                      I speak for myself.
  1149. now doesn!t that make you feel better?     And sometimes not even that.
  1150. ========================================================================
  1151.  
  1152. +++++++++++++++++++++++++++
  1153.  
  1154. >From gewekean@studentg.msu.edu (Andrew Geweke)
  1155. Date: Sat,  9 Apr 1994 01:08:09 -0400
  1156. Organization: Michigan State University
  1157.  
  1158. In article <Cnz0JL.5v9@zcias2.ziff.com>, Robert Hess 
  1159. <robert_hess@macweek.ziff.com> writes:
  1160. > As a service, here are some snippets from Monday!s MacWEEK. I'll try to 
  1161. > do this in the future when there's developer-related news but it will 
  1162. > be as time permits... 
  1163.  
  1164. Thank you very much for this! There are obviously lots of people who still 
  1165. can't really get MacWEEK.
  1166.  
  1167. > St. Laurent, Quebec -- Metrowerks Inc., the developer community's bold 
  1168. > new kid on the block, has received a big boost from a formidable ally, 
  1169. > IBM Corp., and will announce several major additions to its CodeWarrior 
  1170. > product this week. 
  1171. > Metrowerks has formed an agreement with IBM which gives Metrowerks 
  1172. > access to Big Blue's compiler optimization technology for current and 
  1173. > future PowerPC processors. As a result, Mac developers will have access 
  1174. > to the best PowerPC code generators available, said Jean Belanger, 
  1175. > Metrowerks' chairman. "In addition to having the fastest compiler, we'
  1176. > ll be able to generate the fastest code," he said. 
  1177.  
  1178. Am I the only one saying Wow? I've heard only huge rave reviews about IBM's 
  1179. compilers, but figured they were only available with the Macintosh on RISC 
  1180. SDK. Great!
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186. +++++++++++++++++++++++++++
  1187.  
  1188. >From sw@network-analysis-ltd.co.uk (Sak Wathanasin)
  1189. Date: Sat, 9 Apr 94 09:34:08 GMT
  1190. Organization: Network Analysis Ltd
  1191.  
  1192.  
  1193. In article <Cnz0JL.5v9@zcias2.ziff.com> (comp.sys.mac.programmer), Robert Hess <robert_hess@macweek.ziff.com> writes:
  1194.  
  1195. > Metrowerks will ship its 680x0 and PowerPC compilers as fat binaries, so
  1196. > both can run and generate code for either processor line. The MPW-hosted
  1197. > compiler will be included free.
  1198.  
  1199. Will this apply retrospectively to those of us who bought DR1 (2,3..)?
  1200. Or do I have to buy the MPW-hosted compiler separately? If the latter, where
  1201. do I get it from?
  1202.  
  1203.  
  1204. Sak Wathanasin
  1205. Network Analysis Limited
  1206. 178 Wainbody Ave South, Coventry CV3 6BX, UK
  1207.  
  1208. Internet: sw@network-analysis-ltd.co.uk 
  1209. uucp:     ...!uknet!nan!sw                       AppleLink: NAN.LTD
  1210. Phone: (+44) 203 419996 Mobile:(+44) 850 587411  Fax: (+44) 203 690690
  1211.  
  1212. +++++++++++++++++++++++++++
  1213.  
  1214. >From zstern@adobe.com (Zalman Stern)
  1215. Date: Sat, 9 Apr 1994 08:41:27 GMT
  1216. Organization: Adobe Systems Incorporated
  1217.  
  1218. Andrew Geweke writes
  1219. > Am I the only one saying Wow? I've heard only huge rave reviews about  
  1220. IBM's 
  1221. > compilers, but figured they were only available with the Macintosh on RISC 
  1222. > SDK. Great!
  1223.  
  1224. IBM's compilers are *not* on the Macintosh on RISC SDK. They are only  
  1225. available for IBM's AIX operating system.
  1226. --
  1227. Zalman Stern           zalman@adobe.com            (415) 962 3824
  1228. Adobe Systems, 1585 Charleston Rd., POB 7900, Mountain View, CA 94039-7900
  1229. "Do right, and risk consequences." Motto of Sam Houston (via Molly Ivins)
  1230.  
  1231. +++++++++++++++++++++++++++
  1232.  
  1233. >From johnmce@world.std.com (John McEnerney)
  1234. Date: Sat, 9 Apr 1994 09:03:06 GMT
  1235. Organization: The World Public Access UNIX, Brookline, MA
  1236.  
  1237. > Metrowerks has formed an agreement with IBM which gives Metrowerks 
  1238. > access to Big Blue's compiler optimization technology for current and 
  1239. > future PowerPC processors. As a result, Mac developers will have access 
  1240. > to the best PowerPC code generators available, said Jean Belanger, 
  1241. > Metrowerks' chairman. "In addition to having the fastest compiler, we'
  1242. > ll be able to generate the fastest code," he said. 
  1243.  
  1244. So that the rumours don't fly to far too fast on this one, let me clarify 
  1245. the situation as it will affect you, the users.
  1246.  
  1247. We have an agreement which says that as I develop the next version 
  1248. of our PowerPC code generator, I'm free to ask for advice, experiences, 
  1249. etc. from some of the guys at IBM's Watson Research Center where the 
  1250. POWER architecture was originally designed. It turns out much of my 
  1251. current code generator design is already based on some papers that they 
  1252. wrote at Watson anyway. They are willing to be pretty free with their 
  1253. experience, but I imagine they will also keep some tricks to themselves.
  1254.  
  1255. No source code is involved, at least not to my knowledge. The important 
  1256. point is that Metrowerks is going to invest pretty much 100% of my time 
  1257. developing aggressive global optimization for future versions of our 
  1258. product. How closely we compare with IBMs xlc compilers depends mostly on 
  1259. how good a job I do at that. Our agreement with IBM is an offshoot of a
  1260. relationship we have with some great guys in IBM Microelectronics, who 
  1261. want to see the PowerPC chip succeed and see Apple's broad market 
  1262. penetration with a low-cost desktop PowerPC as crucial to their success. 
  1263.  
  1264. By the way, although IBM seems to have a real stuffed-shirt image, Watson 
  1265. Research seems like a cool place. People there look just like us! Also, 
  1266. it was cool to sit in the office of a guy who wrote probably the first 
  1267. paper on Common Subexpression Elimination in a compiler.
  1268.  
  1269. In my early years at Symantec we always wrestled with the "THINK for fast 
  1270. compiles, MPW for production code" image, one that Apple liked to 
  1271. propagate, until we got serious in v5.0 and wrote a real code 
  1272. generator. I don't want Metrowerks to be pigeonholed like that. For DR3 
  1273. and probably DR4, we will be the "fast" compiler which makes some 
  1274. concessions in the optimization area. (This has not stopped a large 
  1275. number of commercial developers of well-known products from using 
  1276. CodeWarrior to "go native")
  1277.  
  1278. After that, we intend to generate code as good as anybody else's.
  1279.  
  1280. -- John McEnerney, Metrowerks PowerPC Product Architect
  1281.  
  1282. +++++++++++++++++++++++++++
  1283.  
  1284. >From d88-jwa@hemul.nada.kth.se (Jon Wdtte)
  1285. Date: 9 Apr 1994 12:30:13 GMT
  1286. Organization: The Royal Institute of Technology
  1287.  
  1288. In <9404090108.AA09272@geweke.ppp.msu.edu> gewekean@studentg.msu.edu (Andrew Geweke) writes:
  1289.  
  1290. >Am I the only one saying Wow? I've heard only huge rave reviews about IBM's 
  1291. >compilers, but figured they were only available with the Macintosh on RISC 
  1292. >SDK. Great!
  1293.  
  1294. Nope, the Macintosh on RISC SDK uses the Lucid compiler, PPCC.
  1295. To use xlc, you have to have an IBM RS/6000 with the development
  1296. environment, figure on spending $15000 and upwards...
  1297.  
  1298.  
  1299.  
  1300. -- 
  1301.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
  1302.  
  1303.   Clearly, most humans are not rational beings; they are rationalizing beings.
  1304.                      -- Mel Walker
  1305.  
  1306. +++++++++++++++++++++++++++
  1307.  
  1308. >From johnmce@world.std.com (John McEnerney)
  1309. Date: Sun, 10 Apr 1994 04:24:59 GMT
  1310. Organization: The World Public Access UNIX, Brookline, MA
  1311.  
  1312. sw@network-analysis-ltd.co.uk (Sak Wathanasin) writes:
  1313.  
  1314. >> Metrowerks will ship its 680x0 and PowerPC compilers as fat binaries, so
  1315. >> both can run and generate code for either processor line. The MPW-hosted
  1316. >> compiler will be included free.
  1317.  
  1318. >Will this apply retrospectively to those of us who bought DR1 (2,3..)?
  1319. >Or do I have to buy the MPW-hosted compiler separately? If the latter, where
  1320. >do I get it from?
  1321.  
  1322. We'll just tack these onto the CD for DR3, DR4, etc. You'll ghet them 
  1323. automatically (as long as you regstered!)
  1324.  
  1325. -- John McEnerney, Metrowerks PowerPC Product Architect
  1326.  
  1327.  
  1328. +++++++++++++++++++++++++++
  1329.  
  1330. >From sw@network-analysis-ltd.co.uk (Sak Wathanasin)
  1331. Date: Mon, 11 Apr 94 00:24:40 GMT
  1332. Organization: Network Analysis Ltd
  1333.  
  1334.  
  1335. In article <Co109o.E6F@world.std.com> (comp.sys.mac.programmer), johnmce@world.std.com (John McEnerney) writes:
  1336. > >Will this apply retrospectively to those of us who bought DR1 (2,3..)?
  1337. > >Or do I have to buy the MPW-hosted compiler separately? If the latter, where
  1338. > >do I get it from?
  1339. > We'll just tack these onto the CD for DR3, DR4, etc. You'll ghet them 
  1340. > automatically (as long as you regstered!)
  1341.  
  1342. Do we have to wait for DR3 for the MPW-hosted compiler? I thought the press
  1343. release said that it would be released at the WWDC. I'd be happy to buy a
  1344. separate copy of the MPW-hosted compiler if it were available...
  1345.  
  1346.  
  1347. Sak Wathanasin
  1348. Network Analysis Limited
  1349. 178 Wainbody Ave South, Coventry CV3 6BX, UK
  1350.  
  1351. Internet: sw@network-analysis-ltd.co.uk 
  1352. uucp:     ...!uknet!nan!sw                       AppleLink: NAN.LTD
  1353. Phone: (+44) 203 419996 Mobile:(+44) 850 587411  Fax: (+44) 203 690690
  1354.  
  1355. +++++++++++++++++++++++++++
  1356.  
  1357. >From johnmce@world.std.com (John McEnerney)
  1358. Date: Mon, 11 Apr 1994 07:03:19 GMT
  1359. Organization: The World Public Access UNIX, Brookline, MA
  1360.  
  1361. >Do we have to wait for DR3 for the MPW-hosted compiler? I thought the press
  1362. >release said that it would be released at the WWDC. I'd be happy to buy a
  1363. >separate copy of the MPW-hosted compiler if it were available...
  1364.  
  1365. DR3 is the version which we will be shipping at the WWDC! Of course, 
  1366. since we will probably get it in the mail just as we ourselves are 
  1367. leaving for WWDC, you might not get yours until after the WWDC depending 
  1368. on shipping time etc.
  1369.  
  1370. -- John McEnerney, Metrowerks PowerPC Product Architect
  1371.  
  1372. +++++++++++++++++++++++++++
  1373.  
  1374. >From Robert Hess <robert_hess@macweek.ziff.com>
  1375. Date: Mon, 11 Apr 1994 16:44:35 GMT
  1376. Organization: MacWEEK
  1377.  
  1378. In article <9404090108.AA09272@geweke.ppp.msu.edu> Andrew Geweke, gewekean@studentg.msu.edu
  1379. writes:
  1380. >Thank you very much for this! There are obviously lots of people who still 
  1381. >can't really get MacWEEK.
  1382.  
  1383. Well, keep in mind:
  1384.  
  1385. a) My employer won't let me post the full article;
  1386. b) This is going be as time permits.
  1387.  
  1388. So you're still better off getting the full scoop via MacWEEK or online.
  1389.  
  1390. ========================================================================
  1391. Robert Hess, WEEKgeek                      robert_hess@macweek.ziff.com
  1392. MacWEEK                                    AppleLink: WNDZSX
  1393. 301 Howard                                 CompuServe: 72511,333
  1394. San Francisco, Calif. 94105                America Online: MacWEEK
  1395. (415) 243-3576 days                        MCI: RHESS
  1396. (415) 243-3651 fax
  1397. (415) 647-5549 nights                      I speak for myself.
  1398. now doesn!t that make you feel better?     And sometimes not even that.
  1399. ========================================================================
  1400.  
  1401. +++++++++++++++++++++++++++
  1402.  
  1403. >From peter.lewis@info.curtin.edu.au (Peter N Lewis)
  1404. Date: Sun, 10 Apr 1994 12:27:59 +0800
  1405. Organization: NCRPDA, Curtin University
  1406.  
  1407. >Since developers feel Apple has not committed to continue supporting the
  1408. >language,  Metrowerks will introduce an Object Pascal version of its
  1409. >compiler by year-end.
  1410.  
  1411. And there was much rejoicing!  Now, what was the upgrade strategy for
  1412. this?  If the upgrade from Pascal to Object Pascel is sufficiently cheap,
  1413. then I'd love to buy a copy now and help get the bugs out!
  1414.    Peter.
  1415. _______________________________________________________________________
  1416. Peter N Lewis <peter.lewis@info.curtin.edu.au>       Ph: +61 9 368 2055
  1417.  
  1418. +++++++++++++++++++++++++++
  1419.  
  1420. >From gurgle@netcom.com (Pete Gontier)
  1421. Date: Sun, 17 Apr 1994 04:22:07 GMT
  1422. Organization: cellular
  1423.  
  1424. peter.lewis@info.curtin.edu.au (Peter N Lewis) writes:
  1425.  
  1426. >>Since developers feel Apple has not committed to continue supporting the
  1427. >>language,  Metrowerks will introduce an Object Pascal version of its
  1428. >>compiler by year-end.
  1429.  
  1430. >And there was much rejoicing!  Now, what was the upgrade strategy for
  1431. >this?  If the upgrade from Pascal to Object Pascel is sufficiently cheap,
  1432. >then I'd love to buy a copy now and help get the bugs out!
  1433.  
  1434. Since the license for DR2 includes updates through DR5 or so, and since
  1435. DR5 isn't supposed to ship this year, and since Object Pascal *is*
  1436. supposed to ship this year, my guess is that buying CodeWarrior now is
  1437. sufficient. Metrowerks may not have thought along this precise path, so
  1438. when you call them to confirm, mention it.
  1439. -- 
  1440.  Pete Gontier, CTO, Integer Poet Software; gurgle@netcom.com
  1441.  
  1442. +++++++++++++++++++++++++++
  1443.  
  1444. >From mwron@aol.com (MW Ron)
  1445. Date: 17 Apr 1994 16:24:02 -0400
  1446. Organization: America Online, Inc. (1-800-827-6364)
  1447.  
  1448. In article <gurgleCoDysv.8w6@netcom.com>, gurgle@netcom.com (Pete Gontier)
  1449. writes:
  1450. >> Since the license for DR2 includes updates through DR5 or so, and since
  1451. DR5 isn't supposed to ship this year, and since Object Pascal *is*
  1452. supposed to ship this year, my guess is that buying CodeWarrior now is
  1453. sufficient. 
  1454.  
  1455. Right, Every CD will include the latest compiler versions available.  With more
  1456. source codes and 3rd party demos and tools.  If you purchase the DR\2
  1457. pre-release version you will receive DR\3. DR\4, DR\5 as well, these CD's will
  1458. come out every 4 months.
  1459.  
  1460. The only upgrading necessary could be from a Bronze to a Gold if you needed to
  1461. write for a PowerPC later on.  
  1462.  
  1463. Ron Liechty
  1464. mwron@aol.com
  1465. Metrowerks Inc.
  1466.  
  1467. ---------------------------
  1468.  
  1469. >From greer@utdallas.edu (Dale M. Greer)
  1470. Subject: WaitNextEvent Emulated on PoMac!?
  1471. Date: 11 Apr 1994 15:50:35 GMT
  1472. Organization: The University of Texas at Dallas
  1473.  
  1474. Someone on the CodeWarrior mailing list said that WaitNextEvent runs
  1475. in emulation mode on the Power Macintosh.  This was in response to 
  1476. a programmer frustrated by jerky animation on the Power Mac.  It was
  1477. recommended that he put code to call WaitNextEvent after some number of
  1478. passes through the event loop, say every tenth pass.
  1479.  
  1480. It seems like WaitNextEvent would be one of the most frequently used 
  1481. routines by most applications, so why didn't Apple make it native?  Will 
  1482. it be native for System 7.5?
  1483.  
  1484. --
  1485.  
  1486. Dale Greer, greer@utdallas.edu
  1487.  
  1488.  
  1489.  
  1490. +++++++++++++++++++++++++++
  1491.  
  1492. >From fixer@faxcsl.dcrt.nih.gov (Chris Gonna' Find Ray Charles Tate)
  1493. Date: Mon, 11 Apr 1994 16:34:10 GMT
  1494. Organization: DCRT, NIH, Bethesda, MD
  1495.  
  1496. In article <2obrkb$2i8@news.utdallas.edu>, greer@utdallas.edu (Dale M. Greer) writes:
  1497. >
  1498. >Someone on the CodeWarrior mailing list said that WaitNextEvent runs
  1499. >in emulation mode on the Power Macintosh.  This was in response to 
  1500. >a programmer frustrated by jerky animation on the Power Mac.  It was
  1501. >recommended that he put code to call WaitNextEvent after some number of
  1502. >passes through the event loop, say every tenth pass.
  1503. >
  1504. >It seems like WaitNextEvent would be one of the most frequently used 
  1505. >routines by most applications, so why didn't Apple make it native?  Will 
  1506. >it be native for System 7.5?
  1507.  
  1508. I expect it's *because* it's one of the most-called routines.  If it were
  1509. native, then *every time* an emulated application called it would entail
  1510. at least two mode switches (into native to run the trap, then back out
  1511. again to run the application).  Mode switching is expensive.
  1512.  
  1513. Now, it *could* be that the trap is run native when you're running in
  1514. native mode, but emulated when you're running under the emulator; it seems
  1515. to me this would be optimal.  Does anyone know whether this is indeed the
  1516. case under the current PowerMac system software?
  1517.  
  1518. - -------------------------------------------------------------------
  1519. Christopher Tate             |   "Blue ice cubes?  How degenerate!"
  1520. MSD, Inc.                    |
  1521. fixer@faxcsl.dcrt.nih.gov    |    < anybody recognize the source? >
  1522.  
  1523. +++++++++++++++++++++++++++
  1524.  
  1525. >From Erik Schwiebert <evs1@cornell.edu>
  1526. Date: 11 Apr 1994 18:12:43 GMT
  1527. Organization: Cornell University
  1528.  
  1529. In article <1994Apr11.163410.6724@alw.nih.gov> Chris Gonna' Find Ray
  1530. Charles Tate, fixer@faxcsl.dcrt.nih.gov writes:
  1531. >In article <2obrkb$2i8@news.utdallas.edu>, greer@utdallas.edu (Dale M.
  1532. Greer) writes:
  1533. >>
  1534. >>Someone on the CodeWarrior mailing list said that WaitNextEvent runs
  1535. >>in emulation mode on the Power Macintosh.  This was in response to 
  1536. >>a programmer frustrated by jerky animation on the Power Mac.  It was
  1537. >>recommended that he put code to call WaitNextEvent after some number of
  1538. >>passes through the event loop, say every tenth pass.
  1539. >>
  1540. >>It seems like WaitNextEvent would be one of the most frequently used 
  1541. >>routines by most applications, so why didn't Apple make it native? 
  1542. Will 
  1543. >>it be native for System 7.5?
  1544. >
  1545. >I expect it's *because* it's one of the most-called routines.  If it were
  1546. >native, then *every time* an emulated application called it would entail
  1547. >at least two mode switches (into native to run the trap, then back out
  1548. >again to run the application).  Mode switching is expensive.
  1549. >
  1550. >Now, it *could* be that the trap is run native when you're running in
  1551. >native mode, but emulated when you're running under the emulator; it
  1552. seems
  1553. >to me this would be optimal.  Does anyone know whether this is indeed the
  1554. >case under the current PowerMac system software?
  1555.  
  1556. well, according to the example in New Inside Mac: PowerPC Software (or
  1557. whatever the title is), Apple gives an example that shows exactly what
  1558. Dale Greer said.  ie, the code only calls WNE every once in a while.  I
  1559. dont have the book, but it looked something like this:
  1560.  
  1561. procedure mainloop;
  1562.  var theEvent:eventRecord;
  1563. begin
  1564.   if (tickCount - gTimeOfLastCall) > gTimeToWait then begin
  1565.     gotEvent := waitNextEvent(blah, blah, blah ...)
  1566.     gTimeOfLastCall := tickCount;
  1567.   else
  1568.     gotEvent := false;
  1569.   if gotEvent then
  1570.     case  whatever of whatever
  1571.   etc...
  1572. end; 
  1573.  
  1574. anyways, you get the idea...  where gTimeToWait is 10 ticks or something
  1575. like that (getCaretTime maybe?) 
  1576.  
  1577. - -----------------------------------------------------------------
  1578.  "So live that you can |------------------| "Life is a tragedy for
  1579.   look any man in the  | evs1@cornell.edu |  those who feel, and a
  1580.   eye and tell him     |------------------|  comedy for those who
  1581.   go to hell."         |     Erik V.      |  think."
  1582.   -- Anonymous         |   Schwiebert     |  -- Jean De La Bruyere
  1583. - -----------------------------------------------------------------
  1584.  
  1585. +++++++++++++++++++++++++++
  1586.  
  1587. >From jwbaxter@olympus.net (John W. Baxter)
  1588. Date: Mon, 11 Apr 1994 11:01:28 -0700
  1589. Organization: Internet for the Olympic Peninsula
  1590.  
  1591. In article <1994Apr11.163410.6724@alw.nih.gov>, fixer@faxcsl.dcrt.nih.gov
  1592. (Chris Gonna' Find Ray Charles Tate) wrote:
  1593.  
  1594. > In article <2obrkb$2i8@news.utdallas.edu>, greer@utdallas.edu (Dale M. Greer) writes:
  1595. > >
  1596. > >Someone on the CodeWarrior mailing list said that WaitNextEvent runs
  1597. > >in emulation mode on the Power Macintosh.  This was in response to 
  1598. > >a programmer frustrated by jerky animation on the Power Mac.  It was
  1599. > >recommended that he put code to call WaitNextEvent after some number of
  1600. > >passes through the event loop, say every tenth pass.
  1601. > >
  1602. > I expect it's *because* it's one of the most-called routines.  If it were
  1603. > native, then *every time* an emulated application called it would entail
  1604. > at least two mode switches (into native to run the trap, then back out
  1605. > again to run the application).  Mode switching is expensive.
  1606. > Now, it *could* be that the trap is run native when you're running in
  1607. > native mode, but emulated when you're running under the emulator; it seems
  1608. > to me this would be optimal.  Does anyone know whether this is indeed the
  1609. > case under the current PowerMac system software?
  1610.  
  1611. It is possible to create "fat" traps...run 68K or PPC.  It was done for
  1612. several traps which **are unlikely to be patched**.  It's not clear that
  1613. existing apps which patch traps can deal with the fat ones.  Of course, no
  1614. one ever patches WaitNextEvent, and everyone who does so does it "right",
  1615. and will instantly retrofit "fat" patches.
  1616.  
  1617. -- 
  1618. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  1619.    jwbaxter@pt.olympus.net
  1620.  
  1621. +++++++++++++++++++++++++++
  1622.  
  1623. >From sbarta@magnus.acs.ohio-state.edu (Scott Barta)
  1624. Date: 11 Apr 1994 15:33:23 -0400
  1625. Organization: The Ohio State University
  1626.  
  1627. > well, according to the example in New Inside Mac: PowerPC Software (or
  1628. > whatever the title is), Apple gives an example that shows exactly what
  1629. > Dale Greer said.  ie, the code only calls WNE every once in a while.  I
  1630. > dont have the book, but it looked something like this:
  1631.     [code deleted] 
  1632. > anyways, you get the idea...  where gTimeToWait is 10 ticks or something
  1633. > like that (getCaretTime maybe?) 
  1634.  
  1635.  
  1636. There's one big problem with all of this.  While your application is
  1637. burning up cycles waiting to do its next WNE, it's _not_ giving up cycles
  1638. to other applications.  Very unfriendly.  I'm surprised that Apple is
  1639. advocating this, unless they're thinking ahead to some happy day when
  1640. applications will be able to preempt each other without WNE.  I would think
  1641. that you'd just want to call WNE as often as possible and grit your teeth
  1642. through the mode switches until the needed Toolbox calls go
  1643. native...shucks, your program may not be fully _debugged_ by then.  :-)
  1644.  
  1645.  
  1646. -- 
  1647. --Scott Barta
  1648. --sbarta@magnus.acs.ohio-state.edu
  1649.  
  1650. +++++++++++++++++++++++++++
  1651.  
  1652. >From b-clark@nwu.edu (Brian Clark)
  1653. Date: Mon, 11 Apr 1994 16:33:16 -0500
  1654. Organization: Northwestern University
  1655.  
  1656. In article <199404111933.PAA15286@bottom.magnus.acs.ohio-state.edu>,
  1657. sbarta@magnus.acs.ohio-state.edu (Scott Barta) wrote:
  1658.  
  1659. > There's one big problem with all of this.  While your application is
  1660. > burning up cycles waiting to do its next WNE, it's _not_ giving up cycles
  1661. > to other applications.  Very unfriendly.  I'm surprised that Apple is
  1662. > advocating this, unless they're thinking ahead to some happy day when
  1663. > applications will be able to preempt each other without WNE.  I would think
  1664. > that you'd just want to call WNE as often as possible and grit your teeth
  1665. > through the mode switches until the needed Toolbox calls go
  1666. > native...shucks, your program may not be fully _debugged_ by then.  :-)
  1667.  
  1668.  
  1669. A recent develop had a question on this, I believe. Someone had a app that
  1670. did a calculation, called WNE, did another calc, etc. When translated to
  1671. native code, more time was being after yielding to other apps than to
  1672. perform calculations. The suggestion was to call WNE less often, based on
  1673. some fixed timing schedule, and not on how fast or slow a particular series
  1674. of calculations took. This seems to be perfectly defensible.
  1675.  
  1676. +++++++++++++++++++++++++++
  1677.  
  1678. >From ivanski@world.std.com (Ivan M CaveroBelaunde)
  1679. Date: Mon, 11 Apr 1994 21:53:59 GMT
  1680. Organization: The World Public Access UNIX, Brookline, MA
  1681.  
  1682. Erik Schwiebert <evs1@cornell.edu> writes:
  1683. >In article <1994Apr11.163410.6724@alw.nih.gov> Chris Gonna' Find Ray
  1684. >Charles Tate, fixer@faxcsl.dcrt.nih.gov writes:
  1685. >>In article <2obrkb$2i8@news.utdallas.edu>, greer@utdallas.edu (Dale M.
  1686. >Greer) writes:
  1687. >>>Someone on the CodeWarrior mailing list said that WaitNextEvent runs
  1688. >>>in emulation mode on the Power Macintosh.  This was in response to 
  1689. >>>a programmer frustrated by jerky animation on the Power Mac.  It was
  1690. >>>recommended that he put code to call WaitNextEvent after some number of
  1691. >>>passes through the event loop, say every tenth pass.
  1692. >well, according to the example in New Inside Mac: PowerPC Software (or
  1693. >whatever the title is), Apple gives an example that shows exactly what
  1694. >Dale Greer said.  ie, the code only calls WNE every once in a while.  I
  1695. >dont have the book, but it looked something like this:
  1696. >procedure mainloop;
  1697. > var theEvent:eventRecord;
  1698. >begin
  1699. >  if (tickCount - gTimeOfLastCall) > gTimeToWait then begin
  1700. >    gotEvent := waitNextEvent(blah, blah, blah ...)
  1701. >    gTimeOfLastCall := tickCount;
  1702. >  else
  1703. >    gotEvent := false;
  1704. >  if gotEvent then
  1705. >    case  whatever of whatever
  1706. >  etc...
  1707. >end; 
  1708.  
  1709. It's kind of nasty (since it hogs the machine while you do nothing, because
  1710. gotEvent is hard-set to false if WNE is not called). A big problem,
  1711. I see, is that GetOSEvent and OSEventAvail are emulated - a good
  1712. alternative would have been to use those to process events while in
  1713. the foreground (this makes your app hog the machine while it is in front,
  1714. but it's processing user interactions, not sitting in an idle loop like
  1715. the code above; of course, if you're not in the foreground you should
  1716. relinqueish the CPU ASAP).
  1717.  
  1718. I could easily see the rationale for WNE/GNE being emulated that the
  1719. likelihood of a Mixed Mode Switch when doing the process swap is
  1720. exceedingly high anyway (I think the device manager is still emulated,
  1721. and WNE calls SystemTask). But hogging the machine AND not responding
  1722. to user events strikes me as unnecessarily evil.
  1723.  
  1724. I do hope the event handling (OS Event Mgr, Toolbox, Device Mgr) goes fat
  1725. (not native, too many 68K emulated apps would suffer performance problems)
  1726. in the next release - would go a long way towards easing that problem.
  1727.  
  1728. -Ivan
  1729. - -
  1730. Ivan Cavero Belaunde (ivanski@world.std.com)
  1731. Avid VideoShop Project Lead
  1732. Avid Technology, Inc.
  1733.  
  1734. +++++++++++++++++++++++++++
  1735.  
  1736. >From greer@utdallas.edu (Dale M. Greer)
  1737. Date: 11 Apr 1994 22:24:03 GMT
  1738. Organization: The University of Texas at Dallas
  1739.  
  1740. Brian Clark (b-clark@nwu.edu) wrote:
  1741. > In article <199404111933.PAA15286@bottom.magnus.acs.ohio-state.edu>,
  1742. > sbarta@magnus.acs.ohio-state.edu (Scott Barta) wrote:
  1743.  
  1744. > > There's one big problem with all of this.  While your application is
  1745. > > burning up cycles waiting to do its next WNE, it's _not_ giving up cycles
  1746. > > to other applications.  Very unfriendly.  I'm surprised that Apple is
  1747.  
  1748. > A recent develop had a question on this, I believe. Someone had a app that
  1749. > did a calculation, called WNE, did another calc, etc. When translated to
  1750. > native code, more time was being after yielding to other apps than to
  1751. > perform calculations. The suggestion was to call WNE less often, based on
  1752. > some fixed timing schedule, and not on how fast or slow a particular series
  1753. > of calculations took. This seems to be perfectly defensible.
  1754.  
  1755. Wouldn't it be nice if Apple had made a new GetMyPriority function, which
  1756. would get a value from a new resource which would tell your code how many
  1757. ticks to wait before calling WaitNextEvent.  Of course, the success of this
  1758. would depend on everyone using it, but if they did, then the user could set
  1759. priorities for each application as easily as setting the memory 
  1760. requirements.  Theoretically. ;)
  1761.  
  1762. As an alternative to having the programmer provide the waiting logic,
  1763. why couldn't Apple have made a little piece of code to call GetMyPriority,
  1764. or something similar just before calling the emulated WaitNextEvent?  This
  1765. little piece of code could just return until its timer timed out, when
  1766. it would then act like a regular call to WaitNextEvent.
  1767.  
  1768. --
  1769.  
  1770. Dale Greer, greer@utdallas.edu
  1771.  
  1772.  
  1773.  
  1774. +++++++++++++++++++++++++++
  1775.  
  1776. >From lsr@taligent.com (Larry Rosenstein)
  1777. Date: Mon, 11 Apr 1994 22:46:20 GMT
  1778. Organization: Taligent, Inc.
  1779.  
  1780. In article <2obrkb$2i8@news.utdallas.edu>, greer@utdallas.edu (Dale M.
  1781. Greer) wrote:
  1782.  
  1783. > Someone on the CodeWarrior mailing list said that WaitNextEvent runs
  1784. > in emulation mode on the Power Macintosh.  This was in response to 
  1785.  
  1786. A good application will call WaitNextEvent with the appropriate sleep
  1787. value, which means it doesn't get called as often as you'd think.
  1788.  
  1789. > recommended that he put code to call WaitNextEvent after some number of
  1790. > passes through the event loop, say every tenth pass.
  1791.  
  1792. That might be appropriate for animation where you want to maintain control
  1793. as much as possible.  I don't think you'd want to do this based on number
  1794. of passes, but rather based on elapsed time as someone suggested.
  1795.  
  1796. -- 
  1797. Larry Rosenstein
  1798. Taligent, Inc.
  1799.  
  1800. lsr@taligent.com
  1801.  
  1802. +++++++++++++++++++++++++++
  1803.  
  1804. >From leblonk@netcom.com (Marcel Blonk)
  1805. Date: Tue, 12 Apr 1994 00:12:32 GMT
  1806. Organization: NETCOM On-line Communication Services (408 241-9760 guest)
  1807.  
  1808. Dale M. Greer (greer@utdallas.edu) wrote:
  1809. : It seems like WaitNextEvent would be one of the most frequently used 
  1810. : routines by most applications, so why didn't Apple make it native?  Will 
  1811. : it be native for System 7.5?
  1812.  
  1813. Most time spent in WNE, as seen from an app, is actually spent in the 
  1814. other (background) apps that call WNE. Jerky animation and such, is caused 
  1815. by other apps taking up too much time in the background (read: calling 
  1816. WNE only every once in a while). The actual time spent in WNE itself is 
  1817. negligible, therefore I can understand that apple doesn't make it a 
  1818. priority to natify (from the verb 'to native') WNE (compare eg. the 
  1819. average app spends 70% of it's time in DrawText)
  1820.  
  1821. mb
  1822.  
  1823.  
  1824. +++++++++++++++++++++++++++
  1825.  
  1826. >From steeeve@aol.com (Steeeve)
  1827. Date: 12 Apr 1994 03:12:27 -0400
  1828. Organization: America Online, Inc. (1-800-827-6364)
  1829.  
  1830. In article <2obrkb$2i8@news.utdallas.edu>, greer@utdallas.edu (Dale M. Greer)
  1831. writes:
  1832. >>>>
  1833. Someone on the CodeWarrior mailing list said that WaitNextEvent runs
  1834. in emulation mode on the Power Macintosh. 
  1835. <<<<
  1836.  
  1837. I just finished up some code from which I expected to see a big speed gain on
  1838. the Power Mac, but it turned out to be slower than on a Quadra 800. I was
  1839. essentially doing this:
  1840.  
  1841. do some calculations;
  1842. fall through event loop;
  1843.  
  1844. I realized that in this case the only reasonable event was a mouse click, so I
  1845. changed it to
  1846.  
  1847. while( ! Button() )
  1848.    do some calculations;
  1849.  
  1850. flush any other events;  //so that the click is processed
  1851. fall through event loop;
  1852.  
  1853. Of course I probably should have done it like this in the first place, but on a
  1854. 6100 it went from 190,000 calculations per hour to 1,475,000.
  1855.  
  1856.  
  1857. -Steve
  1858.  
  1859.  
  1860. +++++++++++++++++++++++++++
  1861.  
  1862. >From woody@alumni.caltech.edu (William Edward Woody)
  1863. Date: 12 Apr 1994 07:44:53 GMT
  1864. Organization: California Institute of Technology, Alumni Association
  1865.  
  1866. In article <199404111933.PAA15286@bottom.magnus.acs.ohio-state.edu>,
  1867. Scott Barta <sbarta@magnus.acs.ohio-state.edu> wrote:
  1868. >> well, according to the example in New Inside Mac: PowerPC Software (or
  1869. >> whatever the title is), Apple gives an example that shows exactly what
  1870. >> Dale Greer said.  ie, the code only calls WNE every once in a while.  I
  1871. >> dont have the book, but it looked something like this:
  1872. >> 
  1873. >    [code deleted] 
  1874. >> anyways, you get the idea...  where gTimeToWait is 10 ticks or something
  1875. >> like that (getCaretTime maybe?) 
  1876. >
  1877. >
  1878. >There's one big problem with all of this.  While your application is
  1879. >burning up cycles waiting to do its next WNE, it's _not_ giving up cycles
  1880. >to other applications.  Very unfriendly.  I'm surprised that Apple is
  1881. >advocating this, unless they're thinking ahead to some happy day when
  1882. >applications will be able to preempt each other without WNE.  I would think
  1883. >that you'd just want to call WNE as often as possible and grit your teeth
  1884. >through the mode switches until the needed Toolbox calls go
  1885. >native...shucks, your program may not be fully _debugged_ by then.  :-)
  1886.  
  1887. Actually it turns out to be an extremely reasonable thing to do if you
  1888. want your application to get as much of the CPU as possible while yielding
  1889. in a way which feels very responsive to foreground applications.
  1890.  
  1891. If you make gTimeToWait 15 ticks, then when the user starts typing in the
  1892. foreground application he will be forced to wait no longer than 1/4
  1893. second before his application responds; for most applications users
  1894. won't feel a significant delay in the responsiveness of the application.
  1895. And since WNE won't return to the CPU-intensive application until there
  1896. is a delay in events arriving at the foreground application (such as when
  1897. the user pauses a second to think while typing in Microsoft Word),
  1898. the foreground application will get all the CPU needed to respond to the
  1899. user's typing or drawing.
  1900.  
  1901. I've used this technique in quite a few applications and have been
  1902. quite pleased at the amount of CPU my background CPU-intensive application
  1903. gets, while still getting reasonable responsiveness in the foreground
  1904. application.
  1905.  
  1906.                         - Bill
  1907.  
  1908. (Who isn't quite sure he understands why pre-emptive multi-tasking
  1909. is so hot, given how unresponsive a Sun workstation feels compared
  1910. to his less powerful Macintosh.)
  1911. -- 
  1912.  "A secret face--a touch of grace        William Edward Woody
  1913.   A man must learn to give a little space    woody@alumni.cco.caltech.edu
  1914.   A peaceful state--a submissive trait
  1915.   A man must learn to gently dominate" -- Rush, "Animate"
  1916.  
  1917. +++++++++++++++++++++++++++
  1918.  
  1919. >From d88-jwa@mumrik.nada.kth.se (Jon Wdtte)
  1920. Date: 12 Apr 1994 08:44:59 GMT
  1921. Organization: The Royal Institute of Technology
  1922.  
  1923. In <2obrkb$2i8@news.utdallas.edu> greer@utdallas.edu (Dale M. Greer) writes:
  1924.  
  1925. >It seems like WaitNextEvent would be one of the most frequently used 
  1926. >routines by most applications, so why didn't Apple make it native?  Will 
  1927. >it be native for System 7.5?
  1928.  
  1929. Wrong. WaitNextEvent isn't that important; when applications call it,
  1930. they expect some time to pass (since other apps can get switched in
  1931. during the call)
  1932.  
  1933. The real power suckers were DrawText() and FillRect() (==EraseRect())
  1934. plus a couple of others (the memory manager in some cases :-)
  1935. -- 
  1936.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
  1937.  
  1938.    This article printed on 100% recycled electrons.
  1939.  
  1940. +++++++++++++++++++++++++++
  1941.  
  1942. >From neeri@iis.ee.ethz.ch (Matthias Neeracher)
  1943. Date: 14 Apr 94 11:05:29
  1944. Organization: Integrated Systems Laboratory, ETH, Zurich
  1945.  
  1946. In article <leblonkCo4Dww.JKp@netcom.com>, leblonk@netcom.com (Marcel Blonk) writes:
  1947. > Dale M. Greer (greer@utdallas.edu) wrote:
  1948. > : It seems like WaitNextEvent would be one of the most frequently used 
  1949. > : routines by most applications, so why didn't Apple make it native?  Will 
  1950. > : it be native for System 7.5?
  1951.  
  1952. > Most time spent in WNE, as seen from an app, is actually spent in the 
  1953. > other (background) apps that call WNE. 
  1954.  
  1955. This is true to a certain degree. However, excessive calling of WNE
  1956. *while the application still has something to do* may slow down your
  1957. code considerably.
  1958.  
  1959. Matthias
  1960.  
  1961. - ---
  1962. Matthias Neeracher                                      neeri@iis.ee.ethz.ch
  1963.   "Where a calculator on the ENIAC is equipped with 18,000 vacuum tubes
  1964.    and weighs 30 tons, computers in the future may have only 1,000 vacuum
  1965.    tubes and weigh only 1 1/2 tons."         ---Popular Mechanics, March 1949
  1966.  
  1967.  
  1968.  
  1969. +++++++++++++++++++++++++++
  1970.  
  1971. >From leblonk@netcom.com (Marcel Blonk)
  1972. Date: Thu, 14 Apr 1994 19:05:26 GMT
  1973. Organization: NETCOM On-line Communication Services (408 241-9760 guest)
  1974.  
  1975. Matthias Neeracher (neeri@iis.ee.ethz.ch) wrote:
  1976. : In article <leblonkCo4Dww.JKp@netcom.com>, leblonk@netcom.com (Marcel Blonk) writes:
  1977. : > Dale M. Greer (greer@utdallas.edu) wrote:
  1978. : > : It seems like WaitNextEvent would be one of the most frequently used 
  1979. : > : routines by most applications, so why didn't Apple make it native?  Will 
  1980. : > : it be native for System 7.5?
  1981.  
  1982. : > Most time spent in WNE, as seen from an app, is actually spent in the 
  1983. : > other (background) apps that call WNE. 
  1984.  
  1985. : This is true to a certain degree. However, excessive calling of WNE
  1986. : *while the application still has something to do* may slow down your
  1987. : code considerably.
  1988.  
  1989. True, but the issue here is, that to make the WNE code native, wouldn't 
  1990. do much to improve performance. Not calling WNE too much has always been 
  1991. an issue on the mac, way before the PowerMac.
  1992.  
  1993. mb
  1994.  
  1995. +++++++++++++++++++++++++++
  1996.  
  1997. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  1998. Date: Mon, 18 Apr 1994 20:07:43 GMT
  1999. Organization: Apple Computer
  2000.  
  2001. On any reasonably fast Mac it's a bad idea to call WNE too often; not that
  2002. the implentation itself is slow, but there are limitations in the OS on how
  2003. fast process switches can happen, so when you call WNE you should expect to
  2004. be gone for at least a tick or two if there are any other non-sleeping
  2005. processes on that machine.
  2006.  
  2007. Scott Barta, sbarta@magnus.acs.ohio-state.edu writes:
  2008. > There's one big problem with all of this.  While your application is
  2009. > burning up cycles waiting to do its next WNE, it's _not_ giving up cycles
  2010. > to other applications.  Very unfriendly.  I'm surprised that Apple is
  2011.  
  2012. Well they're not advocating calling it only once a minute! It's probably best
  2013. to call WNE about once a second max while you're in the foreground. If you're
  2014. in the background you may want to call it four times a second or so. If you
  2015. call WNE too often you're also giving up lots of cycles to a loop inside the
  2016. Process Manager that waits for TickCount to advance.
  2017.  
  2018. --Jens Alfke
  2019.   jens_alfke@powertalk              Rebel girl, rebel girl,
  2020.             .apple.com              Rebel girl you are the queen of my world
  2021.  
  2022. +++++++++++++++++++++++++++
  2023.  
  2024. >From Dave Falkenburg <falken@apple.com>
  2025. Date: Mon, 18 Apr 1994 20:54:51 GMT
  2026. Organization: Apple Computer, Inc.
  2027.  
  2028. In article <1994Apr18.200743.26643@gallant.apple.com> Jens Alfke,
  2029. jens_alfke@powertalk.apple.com writes:
  2030. >Well they're not advocating calling it only once a minute! It's probably
  2031. best
  2032. >to call WNE about once a second max while you're in the foreground. If
  2033. you're
  2034. >in the background you may want to call it four times a second or so. If
  2035. you
  2036.  
  2037. You should ALWAYS dynamically calculate the sleep time!
  2038.  
  2039. When in the background, err on the side of calling WNE more than you'd
  2040. like with LARGE sleep values.
  2041.  
  2042. When running in the foreground, you should periodically call through, but
  2043. alter the frequency of your calling through if you are doing something
  2044. very compute-bound.
  2045.  
  2046. If you AREN'T compute bound, always call through... In most cases, the
  2047. worst thing this will do is pollute your instruction cache with other
  2048. people's code.
  2049.  
  2050. Of course, if you are doing something USER-bound (like a word processor)
  2051. you probably always want to call through anyway.
  2052.  
  2053.  
  2054. >call WNE too often you're also giving up lots of cycles to a loop inside
  2055. the
  2056. >Process Manager that waits for TickCount to advance.
  2057.  
  2058. Actually, I usually don't disagree with Jens, but this ONLY happens when
  2059. NO EVENTS are flying around and EVERY process is asleep...  In the
  2060. future, when we have a "real" operating system, we'll block instead...
  2061.  
  2062. -Dave Falkenburg
  2063. -Apple Computer, Inc.
  2064.  
  2065. ---------------------------
  2066.  
  2067. >From Jeff DuMonthier <jeff.dumonthier@gsfc.nasa.gov>
  2068. Subject: X2Fix code generation bug still in SC++ 7.0
  2069. Date: 6 Apr 1994 14:54:33 GMT
  2070. Organization: NASA GSFC
  2071.  
  2072. I recently posted sample code which demonstrated a code generation bug
  2073. in SC++ 6.0.1.  I have updated to 7.0 and the bug is still there, with
  2074. maybe a slight difference.  The following code demonstrates two
  2075. variations:
  2076.  
  2077. #include <fixmath.h>
  2078.  
  2079. Fixed FixIt1(extended x)
  2080. {    
  2081.     Fixed f = X2Fix(x);           //< This works
  2082.     return f;
  2083. }
  2084.  
  2085. Fixed FixIt2(extended *x)
  2086. {    
  2087.     Fixed f = X2Fix(*x);          //< This just fails.
  2088.     return f;
  2089. }
  2090.  
  2091. void main(void)
  2092. {
  2093.     extended x = 1.0;
  2094.     extended *xp = &x;
  2095.     
  2096.     Fixed f1 = FixIt1(x);
  2097.     Fixed f2 = FixIt2(&x);
  2098.     Fixed f3 = X2Fix(x);
  2099.     Fixed f4 = X2Fix(*xp);        //< Illegal instruction.
  2100. }
  2101.  
  2102. I started with a C++ project and used the factory default compilation
  2103. options for the project and for rebuilding the libraries.  The
  2104. following behavior is what I observed tracing through the program with
  2105. the source debugger:
  2106.  
  2107. FixIt1 works correctly and f1 will be assigned 0x00010000.  FixIt2 does
  2108. not work and f2 will be assigned 0 (local variable f in FixIt2 is also
  2109. assigned 0).  The assignment to f3 using X2Fix(x) works but
  2110. f4 = X2Fix(*xp) results in an illegal instruction error message (run
  2111. time, not a syntax error).
  2112.  
  2113. Here is the disassembled code:
  2114.  
  2115. FixIt1(long double):
  2116. 00000000: 4E56 0000          LINK      A6,#$0000
  2117. 00000004: 2F03               MOVE.L    D3,-(A7)
  2118. 00000006: 594F               SUBQ.W    #$4,A7
  2119. 00000008: 486E 0008          PEA       $0008(A6)
  2120. 0000000C: A844               _X2Fix
  2121. 0000000E: 201F               MOVE.L    (A7)+,D0
  2122. 00000010: 2600               MOVE.L    D0,D3
  2123. 00000012: 261F               MOVE.L    (A7)+,D3
  2124. 00000014: 4E5E               UNLK      A6
  2125. 00000016: 205F               MOVEA.L   (A7)+,A0
  2126. 00000018: 4FEF 000A          LEA       $000A(A7),A7
  2127. 0000001C: 4ED0               JMP       (A0)
  2128. 0000001E
  2129.  
  2130. FixIt2(long double *):
  2131. 00000000: 4E56 0000          LINK      A6,#$0000
  2132. 00000004: 2F03               MOVE.L    D3,-(A7)
  2133. 00000006: 594F               SUBQ.W    #$4,A7
  2134. 00000008: 486E 0008          PEA       $0008(A6)
  2135. 0000000C: A844               _X2Fix
  2136. 0000000E: 201F               MOVE.L    (A7)+,D0
  2137. 00000010: 2600               MOVE.L    D0,D3
  2138. 00000012: 261F               MOVE.L    (A7)+,D3
  2139. 00000014: 4E5E               UNLK      A6
  2140. 00000016: 205F               MOVEA.L   (A7)+,A0
  2141. 00000018: 584F               ADDQ.W    #$4,A7
  2142. 0000001A: 4ED0               JMP       (A0)
  2143. 0000001C
  2144.  
  2145. main:
  2146. 00000000: 4E56 FFF4          LINK      A6,#$FFF4
  2147. 00000004: 48E7 1E30          MOVEM.L   D3-D6/A2/A3,-(A7)
  2148. 00000008: 2D7C 3FFF 8000     MOVE.L    #$3FFF8000,$FFF4(A6)
  2149.           FFF4           
  2150. 00000010: 42AE FFF8          CLR.L     $FFF8(A6)
  2151. 00000014: 426E FFFC          CLR.W     $FFFC(A6)
  2152. 00000018: 45EE FFF4          LEA       $FFF4(A6),A2
  2153. 0000001C: 264A               MOVEA.L   A2,A3
  2154. 0000001E: 41EE FFF4          LEA       $FFF4(A6),A0
  2155. 00000022: 3F28 0008          MOVE.W    $0008(A0),-(A7)
  2156. 00000026: 2F28 0004          MOVE.L    $0004(A0),-(A7)
  2157. 0000002A: 2F10               MOVE.L    (A0),-(A7)
  2158. 0000002C: 4EBA 0000          JSR       FixIt1(long double)
  2159. 00000030: 2600               MOVE.L    D0,D3
  2160. 00000032: 486E FFF4          PEA       $FFF4(A6)
  2161. 00000036: 4EBA 0000          JSR       FixIt2(long double *)
  2162. 0000003A: 2800               MOVE.L    D0,D4
  2163. 0000003C: 594F               SUBQ.W    #$4,A7
  2164. 0000003E: 486E FFF4          PEA       $FFF4(A6)
  2165. 00000042: A844               _X2Fix
  2166. 00000044: 201F               MOVE.L    (A7)+,D0
  2167. 00000046: 2A00               MOVE.L    D0,D5
  2168. 00000048: 594F               SUBQ.W    #$4,A7
  2169. 0000004A: 484B               BKPT      #$3
  2170. 0000004C: A844               _X2Fix
  2171. 0000004E: 201F               MOVE.L    (A7)+,D0
  2172. 00000050: 2C00               MOVE.L    D0,D6
  2173. 00000052: 4CDF 0C78          MOVEM.L   (A7)+,D3-D6/A2/A3
  2174. 00000056: 4E5E               UNLK      A6
  2175. 00000058: 4E75               RTS
  2176. 0000005A
  2177.  
  2178. I don't know 68000 assembler, but I can see that FixIt1 and FixIt2 are
  2179. identical up to the instruction before returning.  This does not seem
  2180. correct since one is passed a pointer and one is passed a 10 byte
  2181. extended value.  Just before the last _X2Fix in main is this
  2182. instruction: BKPT.  Is that the illegal instruction?   What is it?
  2183.  
  2184. The workaround as with the 6.0.1 version of the bug is to always
  2185. use X2Fix on a local copy of an extended value, not a pointer or a
  2186. reference.
  2187.  
  2188. +++++++++++++++++++++++++++
  2189.  
  2190. >From N.Perry@massey.ac.nz (N.Perry)
  2191. Date: Wed, 13 Apr 1994 09:08:22 GMT
  2192. Organization: School of Maths & Info. Sci., Massey University, Palmerston North, NZ
  2193.  
  2194.  
  2195. Jeff DuMonthier <jeff.dumonthier@gsfc.nasa.gov> has posted that a bug
  2196. in the compilation of extended *arg being passed to X2Fix is still in
  2197. 7.0. I looked into this and discovered that the problem is even worse
  2198. than Jeff thought :-( The following function:
  2199.  
  2200. Fixed FixIt5(extended *x)
  2201. {
  2202.         extended *h = x;
  2203.         Fixed f = X2Fix(*h);          //< ouch!
  2204.         return f;
  2205. }
  2206.  
  2207. produces the code:
  2208.  
  2209. FixIt5(long double *):
  2210. 00000000: 4E56 0000          LINK      A6,#$0000
  2211. 00000004: 48E7 1020          MOVEM.L   D3/A2,-(A7)
  2212. 00000008: 202E 0008          MOVE.L    $0008(A6),D0
  2213. 0000000C: 2440               MOVEA.L   D0,A2
  2214. 0000000E: 594F               SUBQ.W    #$4,A7
  2215. 00000010: 484A               BKPT      #$2
  2216. 00000012: A844               _X2Fix
  2217. 00000014: 201F               MOVE.L    (A7)+,D0
  2218. 00000016: 2600               MOVE.L    D0,D3
  2219. 00000018: 4CDF 0408          MOVEM.L   (A7)+,D3/A2
  2220. 0000001C: 4E5E               UNLK      A6
  2221. 0000001E: 205F               MOVEA.L   (A7)+,A0
  2222. 00000020: 584F               ADDQ.W    #$4,A7
  2223. 00000022: 4ED0               JMP       (A0)
  2224.  
  2225. Now a BKPT is not very good for your Mac - I think a crash is
  2226. inevitable :-( (For 68K hackers, the hex 484A looks like an attempt to
  2227. code up PEA (A2), a non-existant instruction...)
  2228.  
  2229. I'll send it off to Symantec tech support.
  2230.  
  2231. Hope this helps someone *before* their Mac locks up!
  2232.  
  2233. Cheers,
  2234.     Nigel
  2235.  
  2236. -- 
  2237. Dr Nigel Perry                    Email: N.Perry@massey.ac.nz
  2238. Department of Computer Science    Tel: +64 6 356 9099 ext 8900
  2239. Massey University                 Fax: +64 6 350 5611
  2240. Palmerston North, New Zealand
  2241.  
  2242. +++++++++++++++++++++++++++
  2243.  
  2244. >From Ron_Hunsinger@bmug.org (Ron Hunsinger)
  2245. Date: Sat, 16 Apr 94 17:20:27 PST
  2246. Organization: Berkeley Macintosh Users Group
  2247.  
  2248. N.Perry@massey.ac.nz (N.Perry) writes:
  2249.  
  2250. >Now a BKPT is not very good for your Mac - I think a crash is
  2251. >inevitable :-( (For 68K hackers, the hex 484A looks like an attempt to
  2252. >code up PEA (A2), a non-existant instruction...)
  2253.  
  2254. PEA (A2) is a perfectly valid instruction, exactly equivalent in speed,
  2255. code size, and function to MOVE.L A2,-(A7).  Either would have been
  2256. correct in this sequence.
  2257.  
  2258. I think you meant to say "484A looks like an attempt to code up PEA A2, 
  2259. which is a non-existent instruction."
  2260.  
  2261. (Actually, it looks like they were trying to split the difference between 
  2262. PEA (A2) [4852] and MOVE.L A2,-(A7) [1F0A].  They got the sum of 4840 [PEA] 
  2263. and 000A [A2].  If they had started with 1F00 [MOVE.L ,-(A7)], or added 
  2264. 0012 [(A2)], they would have been OK.)
  2265.  
  2266. -Ron Hunsinger
  2267.  
  2268. +++++++++++++++++++++++++++
  2269.  
  2270. >From pottier@kayak.ens.fr (Francois Pottier)
  2271. Date: 17 Apr 1994 21:26:59 GMT
  2272. Organization: Ecole Normale Superieure, PARIS, France
  2273.  
  2274. In article <0013C774.fc@bmug.org>,
  2275. Ron Hunsinger <Ron_Hunsinger@bmug.org> wrote:
  2276.  
  2277. >(Actually, it looks like they were trying to split the difference between 
  2278. >PEA (A2) [4852] and MOVE.L A2,-(A7) [1F0A].  They got the sum of 4840 [PEA] 
  2279. >and 000A [A2].  If they had started with 1F00 [MOVE.L ,-(A7)], or added 
  2280. >0012 [(A2)], they would have been OK.)
  2281.  
  2282. Do you guys really know all these opcodes by heart ? I'm amazed!
  2283.  
  2284. -- 
  2285. Francois Pottier
  2286. pottier@dmi.ens.fr
  2287.  
  2288. ---------------------------
  2289.  
  2290. End of C.S.M.P. Digest
  2291. **********************
  2292.  
  2293.  
  2294.