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

  1. Received-Date: Fri, 14 Oct 1994 14:54:09 +0100
  2. From: pottier@clipper.ens.fr (Francois Pottier)
  3. Subject: csmp-digest-v3-065
  4. To: csmp-digest@ens.fr
  5. Date: Fri, 14 Oct 1994 14:54:01 +0100 (MET)
  6. X-Mailer: ELM [version 2.4 PL23]
  7. Mime-Version: 1.0
  8. Content-Type: text/plain; charset=ISO-8859-1
  9. Content-Transfer-Encoding: 8bit
  10. Errors-To: listman@ens.fr
  11. Reply-To: pottier@clipper.ens.fr
  12. X-Sequence: 70
  13.  
  14. --------------------
  15. Zero32Bytes.s.o    1K
  16. --------------------
  17.  
  18. C.S.M.P. Digest             Fri, 14 Oct 94       Volume 3 : Issue 65
  19.  
  20. Today's Topics:
  21.  
  22.         Books-Reference: opinions needed!!
  23.         Changing to new toolbox routine names with MacPerl
  24.         Cleanest way to turn AppleTalk on-off
  25.         Dialog Edit text> 256 characters
  26.         Fast zeroing on PPC
  27.         Inside Mac on CD-ROM
  28.         Q: Using PPC apps without Shared Libraries?
  29.         Reading STR# resource - Pascal code
  30.  
  31.  
  32.  
  33. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  34. (pottier@clipper.ens.fr).
  35.  
  36. The digest is a collection of article threads from the internet newsgroup
  37. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  38. regularly and want an archive of the discussions.  If you don't know what a
  39. newsgroup is, you probably don't have access to it.  Ask your systems
  40. administrator(s) for details.  If you don't have access to news, you may
  41. still be able to post messages to the group by using a mail server like
  42. anon.penet.fi (mail help@anon.penet.fi for more information).
  43.  
  44. Each issue of the digest contains one or more sets of articles (called
  45. threads), with each set corresponding to a 'discussion' of a particular
  46. subject.  The articles are not edited; all articles included in this digest
  47. are in their original posted form (as received by our news server at
  48. nef.ens.fr).  Article threads are not added to the digest until the last
  49. article added to the thread is at least two weeks old (this is to ensure that
  50. the thread is dead before adding it to the digest).  Article threads that
  51. consist of only one message are generally not included in the digest.
  52.  
  53. The digest is officially distributed by two means, by email and ftp.
  54.  
  55. If you want to receive the digest by mail, send email to listserv@ens.fr
  56. with no subject and one of the following commands as body:
  57.     help                        Sends you a summary of commands
  58.     subscribe csmp-digest Your Name    Adds you to the mailing list
  59.     signoff csmp-digest            Removes you from the list
  60. Once you have subscribed, you will automatically receive each new
  61. issue as it is created.
  62.  
  63. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  64. Questions related to the ftp site should be directed to
  65. scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
  66. digest are available there.
  67.  
  68. Also, the digests are available to WAIS users.  To search back issues
  69. with WAIS, use comp.sys.mac.programmer.src. With Mosaic, use
  70. http://www.wais.com/wais-dbs/comp.sys.mac.programmer.html.
  71.  
  72.  
  73. -------------------------------------------------------
  74.  
  75. >From stone@phoenix.cs.uga.edu (Robert)
  76. Subject: Books-Reference: opinions needed!!
  77. Date: 24 Sep 1994 22:09:29 GMT
  78. Organization: kind of sloppy actually....
  79.  
  80. I need YOUR opinion!  Here are some books that I've heard of, and I want to
  81. know how they rate.  Also, let me know if you have any good suggestions on
  82. where to get them (mail order or otherwise.)  Note that I'm interested in
  83. books for people who know little or nothing about mac programming in general
  84. (but who know something about programming on other platforms.)
  85.  
  86. Inside Macintosh: Overview - worth it or not?  necessary?  What Inside mac
  87. books are absolutely essential for any mac programmer?
  88.  
  89. Power Macintosh Programming Starter Kit (book + CD)  Anyone used it?  Is it
  90. useful for people who have, say, CW gold but no PowerPC?  What is the "special"
  91. version of MW CodeWarrior included on the CD like?  (i.e. how stripped down?)
  92.  
  93. Other books:  (How suitable for complete neophytes?  How "good" in general?)
  94.  
  95. Think THINK C by Dan Parks Sydow
  96. Macintosh Programming for Dummies by Dan Parks Sydow
  97. The C Programming Primer from Dave Mark
  98. Learn C on the Macintosh by Dave Mark
  99. Learn C++ on the Macintosh by Dave Mark
  100. Symantec C++ Programming for the Macintosh  by ???
  101. How to Write Macintosh Software, Third Edition
  102. "Macintosh Programming Secrets" 2nd edition by ???
  103. Debugging Macintosh Software With MacsBug
  104.  
  105. the Waite Group's C Primer Plus
  106. the Waite Group's C++ Primer (or something like that)
  107. C++ Primer (Addison Wesley)
  108. C++ Programming Language (Addison Wesley)
  109. K&R's The C Programming Language, 2nd Edition.
  110.  
  111.  
  112. Any books I'm missing that might be useful for complete novices?
  113.  
  114. Thanks for your reply.  This info will be very useful to me and many others.
  115. (I may start a "getting started with mac programming FAQ.")
  116.  
  117. @@@@@ Robert Stone (stone@phoenix.cs.uga.edu)
  118. @@@@@ Some Sort of Computer-Related Person, UGA - Extension Dairy Sci.
  119. @@@@@ Windows - n. a software package designed to cure the DOS virus, but
  120.         which proved to be ineffective.  While removing the 640K limit
  121.         symptom, the system performance becomes degraded even further.
  122.             Also increases chance of system crash and consumes additional
  123.         disk space.
  124.  
  125.  
  126. +++++++++++++++++++++++++++
  127.  
  128. >From nick+@pitt.edu ( nick.c )
  129. Date: Sun, 25 Sep 94 01:28:48 GMT
  130. Organization: The Pitt, Chemistry
  131.  
  132. In Article <36282p$n72@hobbes.cc.uga.edu>, stone@phoenix.cs.uga.edu (Robert)
  133. wrote:
  134.  
  135.  
  136. >Inside Macintosh: Overview - worth it or not?  necessary?  What Inside mac
  137. >books are absolutely essential for any mac programmer?
  138.  
  139.     A good introduction to the general structure of the essentials of 
  140.       a mac program.  Read it - once.  Not necessary, but helpfull.
  141.  
  142.     The essential NIM?  Depends on what you're doing.  In general I'd
  143.       say Toolbox, More Toolbox, Imaging with Quickdraw, and Files.
  144.       I found "Text" very usefull, not sure I'd call it essential.
  145.       Some folks say "Memory" is essential, not sure I'd agree.
  146.  
  147. >Power Macintosh Programming Starter Kit (book + CD)  Anyone used it?  Is it
  148. >useful for people who have, say, CW gold but no PowerPC?  What is the "special"
  149. >version of MW CodeWarrior included on the CD like?  (i.e. how stripped down?)
  150.  
  151.     A neat book, it discusses some issues unique to the Power Mac that
  152.       I know of no other source for.  It also presents some unique mac
  153.       programming techniques (eg Rez) that are not usually brought up
  154.       in introductory books.  The version of CW included will only allow
  155.       you to open existing projects, not create new ones.  There are 
  156.       example projects on the CD, so you have a fully functional environment
  157.       for learning/evaluating CW - but you won't be able to use it to 
  158.       generate your own projects.  I'd recommend this book to someone
  159.       who wants to familiarize themselves with the CW environment, or
  160.       is considering buying CW, or who has an interest in programming
  161.       for the powermac.  I would not recommend this for someone entirely
  162.       new to mac programming.
  163.  
  164. >Other books:  (How suitable for complete neophytes?  How "good" in general?)
  165. >
  166. >Think THINK C by Dan Parks Sydow
  167.  
  168.     It's been highly recommended on the net, and Dan is a good author,
  169.       but I haven't read it.
  170.  
  171. >Macintosh Programming for Dummies by Dan Parks Sydow
  172. >The C Programming Primer from Dave Mark
  173.  
  174.     A little out of date, but it's what I learned with, and I'd still
  175.       recommend it for someone who knows C but is unfamiliar with
  176.       programming on the mac.  Written in plain old english,
  177.       it presents the concepts and implementation of basic macintosh
  178.       programming techniques such as how to use menus and how to
  179.       manage windows.  It's still very relevant, and extremely well
  180.       written.
  181.  
  182. >Learn C on the Macintosh by Dave Mark
  183.  
  184.     The mac toolbox is a collection of rom "tools" that you use to
  185.       generate many of the common elements of the macintosh interface:
  186.       both it's visible interface and it's "method" for dealing with
  187.       user interactions.  A program is a recipe for getting a job
  188.       done that the computer will read and follow.  You can tell the
  189.       computer to use the "tools" in the rom toolbox as well as other
  190.       actions but you have to tell the computer in a language it'll
  191.       understand.  The most common language for creating these recipes
  192.       on the mac is C.  You have to learn to a language before you
  193.       can do anything else, if you choose to learn C, Dave Mark's book
  194.       is a clear, effective, and well structured introduction to that
  195.       language.  Recommended as the first book you buy to learn macintosh
  196.       programming.
  197.  
  198. >Learn C++ on the Macintosh by Dave Mark
  199.  
  200.     C++ is a superset of C, and should not be the first language you
  201.       learn.  This was one of two books I read when I learned C++,
  202.       and I recommend it, however I'd consider this book the un-official
  203.       "volume 2" to Dave Mark's _Learn C on the Macintosh_.  Learn
  204.       C first, then learn the toolbox.  Program for a while, and when
  205.       you're confident with that this book is a good intro to the joys
  206.       and frustrations of a new *style* of programming called OOP.
  207.       C++, an enhanced version of C, is a good choice to implement 
  208.       that style.
  209.  
  210. >Symantec C++ Programming for the Macintosh  by ???
  211.  
  212.     Eh.  A good introduction to the Symantec environment, and a handy
  213.       reference - but not a must have.  It general learning the compiler
  214.       is the easy part, learning what you can do with it - that's the
  215.       art.
  216.  
  217.     Does re-introduce a lot of C++ concepts, but not the place to learn
  218.       'em.
  219.  
  220. >How to Write Macintosh Software, Third Edition
  221. >"Macintosh Programming Secrets" 2nd edition by ???
  222.  
  223.     A good, *fun* book that includes so many "in-jokes" it's hard
  224.       to read with a straight face.  I don't think this is intended
  225.       as a "first" book on the toolbox, but it's good supplemental
  226.       reading - and a lot of fun to read.
  227.  
  228. >Debugging Macintosh Software With MacsBug
  229. >the Waite Group's C Primer Plus
  230. >the Waite Group's C++ Primer (or something like that)
  231. >C++ Primer (Addison Wesley)
  232. >C++ Programming Language (Addison Wesley)
  233.  
  234.     As close to the definitive reference on C++ as exists.  As I said
  235.       above, don't start to C++, but when you want to learn C++ this is
  236.       a must have.  Reads like stereo instructions, but an essential
  237.       *reference*.
  238.  
  239. >K&R's The C Programming Language, 2nd Edition.
  240.  
  241.     The classic.  If you program in C, you have this book.  I wouldn't
  242.       learn C from it, but I wouldn't learn C without it.
  243.  
  244. >Any books I'm missing that might be useful for complete novices?
  245. >
  246. >Thanks for your reply.  This info will be very useful to me and many others.
  247. >(I may start a "getting started with mac programming FAQ.")
  248.  
  249.     Overdue, please do.
  250.  
  251.                                                 -- nick
  252.  
  253.  
  254.  
  255.                                     _/   _/  _/  _/_/_/   _/   _/  
  256.      Interet: nick@pitt.edu        _/_/ _/  _/  _/   _/  _/_/_/    
  257.       eWorld: nick                _/ _/_/  _/  _/       _/ _/      
  258.          CIS: 71232,766          _/   _/  _/   _/_/_/  _/   _/     
  259.  
  260.  
  261. +++++++++++++++++++++++++++
  262.  
  263. >From thundero@news.delphi.com (THUNDERONE@DELPHI.COM)
  264. Date: 25 Sep 1994 03:43:25 -0000
  265. Organization: Delphi Internet Services Corporation
  266.  
  267. nick+@pitt.edu ( nick.c ) writes:
  268.  
  269. >In Article <36282p$n72@hobbes.cc.uga.edu>, stone@phoenix.cs.uga.edu (Robert)
  270. >wrote:
  271. [snip]
  272.  
  273. >>Learn C on the Macintosh by Dave Mark
  274.  
  275. [explaination of mac programming paradigm deleted]
  276. >      on the mac is C.  You have to learn to a language before you
  277. >      can do anything else, if you choose to learn C, Dave Mark's book
  278. >      is a clear, effective, and well structured introduction to that
  279. >      language.  Recommended as the first book you buy to learn macintosh
  280. >      programming.
  281.  
  282. >>Learn C++ on the Macintosh by Dave Mark
  283.  
  284. >    C++ is a superset of C, and should not be the first language you
  285. >      learn.  This was one of two books I read when I learned C++,
  286. >      and I recommend it, however I'd consider this book the un-official
  287. >      "volume 2" to Dave Mark's _Learn C on the Macintosh_.  Learn
  288. >      C first, then learn the toolbox.  Program for a while, and when
  289. >      you're confident with that this book is a good intro to the joys
  290. >      and frustrations of a new *style* of programming called OOP.
  291. >      C++, an enhanced version of C, is a good choice to implement 
  292. >      that style.
  293.  
  294. [rest deleted]
  295.  
  296. I disagree.  There are much better books that assume no 
  297. platform-specifics which are better introductions to C and C++ as 
  298. languges.  Dave Mark's Learn C/++ on the Mac books are an incredible 
  299. waste of trees.
  300.  
  301. 1.  They only teach you the very basics of the languges.  
  302. Platform-null books go into much greater detail.
  303.  
  304. 2.  He doesn't know how to program effective C++ (or didn't at the 
  305. time he wrote the book).
  306.  
  307. 3.  Both of these books are specific to programming DOS/Unix boxes 
  308. using Think C.  I repeat: there are much better books for this 
  309. purpose.
  310.  
  311. Such as:
  312. C++ Inside Out
  313. The Waite Group's stuff
  314. Teach Yourself C++ by Al Stevens
  315.  
  316. I think almost any C/C++ book that is platform-null will do the job 
  317. well.
  318.  
  319. ........................................................................
  320. Chris Thomas, thunderone@delphi.com, Project KillThinkRef @ Echo Software
  321.  
  322. +++++++++++++++++++++++++++
  323.  
  324. >From afcsusan@aol.com (AFC Susan)
  325. Date: 25 Sep 1994 04:17:02 -0400
  326. Organization: America Online, Inc. (1-800-827-6364)
  327.  
  328. Re article <nick+.1130844168C@usenet.pitt.edu>, nick+@pitt.edu ( nick.c ):
  329.  
  330.   Thank you for your thorough response. Sorry I must disagree on
  331.   these two books.
  332.  
  333. > > Learn C on the Macintosh by Dave Mark ...You have to learn to a
  334. > language before you can do anything else, if you choose to learn
  335. > C, Dave Mark's book is a clear, effective, and well structured
  336. > introduction to that language.  Recommended as the first book you
  337. > buy to learn macintosh programming....
  338.  
  339.   This book has the surface appearance of a new wonder drug, touted
  340.   as containing the C language, a compiler, reference material, a
  341.   glossary, and programming examples. Too bad people fall for slick
  342.   packaging. It is really sad to see a discipline accepting of such
  343.   nonsense, when a rock solid foundation is needed instead.
  344.  
  345. > > Learn C++ on the Macintosh by Dave Mark... C++ is a superset of
  346. > C, and should not be the first language you learn.  This was one
  347. > of two books I read when I learned C++, and I recommend it,
  348. > however I'd consider this book the un-official "volume 2" to Dave
  349. > Mark's _Learn C on the Macintosh_.  Learn C first, then learn the
  350. > toolbox....
  351.  
  352.   Pardon the paraphrase. As a much brighter brain than mine said
  353.   regarding plummeting educational standards in the USA, in
  354.   Doonesbury, "Maybe we could call ourselves Programming High School
  355.   and get away with it."
  356.   
  357.   Something tells me that continued recommendation of Mr. Mark's
  358.   books, which is apparently based on his Primer fame, in
  359.   professional circles like c.s.m.p is an emergency that just won't
  360.   go away.
  361.  
  362. Susan Lesch (AFC Susan)
  363. Forum Consultant, Macintosh Utilities Forum
  364. America Online, Inc.
  365.  
  366.   Speaking only for myself and my colleagues. "You be me for a
  367.   while. And I'll be you." --Paul Westerberg, and The Replacements,
  368.   circa 1989.
  369.  
  370. +++++++++++++++++++++++++++
  371.  
  372. >From Gilles Dignard <gdignard@hookup.net>
  373. Date: 25 Sep 1994 13:40:34 GMT
  374. Organization: HookUp Communication Corporation, Oakville, Ontario, CANADA
  375.  
  376. In article <36282p$n72@hobbes.cc.uga.edu> Robert,
  377. stone@phoenix.cs.uga.edu writes:
  378. >Any books I'm missing that might be useful for complete novices?
  379.  
  380. Actually, your list is missing the two I consider were the most helpful
  381. to me learning C++. Neither is Macintosh specific, though.
  382.  
  383. The first is essentially a textbook. It is "Classic Data Structures in
  384. C++" by Timothy A. Budd, published by Addison Wesley, ISBN 0-201-50889-3.
  385. What I found particularly useful were the numerous code snippets and
  386. source to a large number of important classes that are included (Linked
  387. lists, string classes, vectors, queues, matrices, etc.). Most
  388. importantly, it isn't just a cookbook of classes, however. The classes
  389. are discussed in detail, and while it may or may not be something new,
  390. what the classes represent in a more general computational sense is also
  391. discussed.
  392.  
  393. Once you get your feet wet, and want to know how to best use your
  394. new-found C++ abilities, the book to get is "Effective C++ / 50 Specific
  395. Ways to Improve Your Programs and Designs" by Scott Meyers, published by
  396. Addison-Wesley, ISBN 0-201-56364-9. One of the best "programming" books
  397. I've ever run across. A must-have for all C++ programmers.
  398.  
  399. - --------------------
  400. ####      /\      ####  Gilles Dignard - gdignard@hookup.net
  401. ####  ]\/\  /\/[  ####
  402. ####  \ \    / /  ####  The human mind treats a new idea the way the
  403. ####  /--------\  ####  body treats a strange protein; it rejects it.
  404. ####      ][      ####                   - P.B. Medawar
  405. - --------------------
  406.  
  407. +++++++++++++++++++++++++++
  408.  
  409. >From howard@netcom.com (Howard Berkey)
  410. Date: Sun, 25 Sep 1994 20:53:18 GMT
  411. Organization: Psychonaut Foundation
  412.  
  413. In article <nick+.1130844168C@usenet.pitt.edu>, nick+@pitt.edu ( nick.c ) wrote:
  414.  
  415. > >Debugging Macintosh Software With MacsBug
  416. > >the Waite Group's C Primer Plus
  417. > >the Waite Group's C++ Primer (or something like that)
  418. > >C++ Primer (Addison Wesley)
  419. > >C++ Programming Language (Addison Wesley)
  420. >     As close to the definitive reference on C++ as exists.  As I said
  421. >       above, don't start to C++, but when you want to learn C++ this is
  422. >       a must have.  Reads like stereo instructions, but an essential
  423. >       *reference*.
  424.  
  425. ARM.  ARM.  ARM.   Must have.
  426.  
  427. (until I can get the ANSI standard, that is :-)
  428.  
  429. Really, the Annotated Reference Manual is as close to definitive as it gets 
  430. for C++, at least as a target for current compilers, which is what is
  431. really important unless you can head-compile your code and speak in
  432. assembler :-)
  433.  
  434. >
  435. > >Thanks for your reply.  This info will be very useful to me and many others.
  436. > >(I may start a "getting started with mac programming FAQ.")
  437. >     Overdue, please do.
  438.  
  439.  
  440. Jon's is a good start at least...  you might check it out, he posts it
  441. here regularly.
  442.  
  443. -H-
  444.  
  445. -- 
  446. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  447. Howard Berkey                                     howard@netcom.com
  448. Segmentation Fault (core dumped)
  449.  
  450. +++++++++++++++++++++++++++
  451.  
  452. >From h+@nada.kth.se (Jon W{tte)
  453. Date: Mon, 26 Sep 1994 19:29:02 +0100
  454. Organization: Royal Institute of Something or other
  455.  
  456. In article <363uki$rap@relay.tor.hookup.net>,
  457. Gilles Dignard <gdignard@hookup.net> wrote:
  458.  
  459. >Once you get your feet wet, and want to know how to best use your
  460. >new-found C++ abilities, the book to get is "Effective C++ / 50 Specific
  461. >Ways to Improve Your Programs and Designs" by Scott Meyers, published by
  462.  
  463. May I pop in with a recommendation for "Writing Solid Code" by 
  464. Steve Maguire? Once you've gotten through your first C or C++ 
  465. or even Pascal book, this book will teach you lots of good 
  466. habits which will help you a LOT. It also goes through known 
  467. problem areas, especially when writing C code, and tells you 
  468. what you can do about it.
  469.  
  470. Or maybe I should keep quiet about it and treat it as a secret 
  471. corporate advantage? :-)
  472.  
  473. Cheers,
  474.  
  475.                 / h+
  476.  
  477.  
  478. --
  479.   Jon W‰tte (h+@nada.kth.se), Hagagatan 1, 113 48 Stockholm, Sweden
  480.   "Psychotherapist" - "Psycho-The-Rapist"
  481.    Pure coincidence? You decide!
  482.  
  483.  
  484. +++++++++++++++++++++++++++
  485.  
  486. >From garyg@oak.circa.ufl.edu (gary greenberg)
  487. Date: 26 Sep 1994 01:39:36 GMT
  488. Organization: Center for Instructional and Research Computing Activities
  489.  
  490. In article <36282p$n72@hobbes.cc.uga.edu>, stone@phoenix.cs.uga.edu (Robert) writes:
  491. >I need YOUR opinion!  
  492.     [massive snip]
  493. >Any books I'm missing that might be useful for complete novices?
  494. >
  495. >Thanks for your reply.  This info will be very useful to me and many others.
  496. >(I may start a "getting started with mac programming FAQ.")
  497. >
  498. >@@@@@ Robert Stone (stone@phoenix.cs.uga.edu)
  499.  
  500. Here's advice from a _true neophyte_ fwiw,
  501. In the last few months, I've spent a good deal of time in the books.
  502. I've started at the ANSI C level 'cause I need it for work, and I'm
  503. teaching myself for fun. I've read several Smalltalk books, some UNIX C,
  504. and am working my way thru several Mac Programming books. Rather than
  505. offer specific comments about any single book compared to another, I'll
  506. post the following note cause I think *everyone* reading this list will
  507. want the information included. There is an online source to these books;
  508. several actually. Addison Wesley has an online Gopher, and probably a
  509. WWW. O'Reilly and Associates does also. I don't have the A/W handy, but
  510. O'Reilly is at nuts@ora.com for general questions (they do the *great*
  511. Nutshell books -- I just finished their VI book and its A++). To
  512. get their catalog, send mail to catalog@ora.com, and to get info about
  513. their gopher send to gopher@ora.com. Now, ...
  514. for more Mac Specific books & everything else ...
  515.     ____ begin included ______________
  516. From:   MX%"books@softproeast.com" 22-SEP-1994 17:51:03.62
  517. To:     me
  518. Subj:   Softpro Internet Resources
  519.  
  520. [snip header; increase other's reading pleasure ;-) ]
  521.  
  522. ===============================================================
  523.  ... Below you will find additional information for
  524. accessing our on-line resources such as our Gopher and Mosaic
  525. Catalog services.
  526. If you have any additional questions, feel free to e-mail, write,
  527.  fax, or give us a call.
  528.  
  529. David Vins
  530. Softpro
  531. ==================================================================
  532. Softpro offers both on-line Gopher and World Wide Web/Mosaic services
  533. complete with browse, search, and on-line order capabilities.
  534. Our booklist is also availble via FTP.  To access these services,
  535. follow the information provided below.
  536.  
  537.          FTP: -> Anonymous ftp to "ftp.std.com"
  538.               -> Our booklist can be obtained as the following...
  539.                  "customers/books/Softpro/booklist"
  540.  
  541.       Gopher: -> "gopher storefront.xor.com"
  542.               -> Select the "Softpro Books" menu item.
  543.  
  544.   WWW/Mosaic: -> "xmosaic http://storefront.xor.com"
  545.               -> Select the "Softpro Books" menu item.
  546.  
  547.               -> Mosaic for Windows/Mac users please note, our URL
  548.                  (Universal Resource Locator) for Softpro is
  549.                  "http://storefront.xor.com/"
  550. ================================================================
  551.  
  552. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  553. - Softpro Books & Software                                      -=-
  554. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= =
  555.   - 112 Burlington Mall Rd.         Hours:  Mon-Fri   9am to 8pm  -
  556.   = Burlington, MA 01803-5300              Saturday  10am to 6pm  =
  557.   -                                          Sunday  12pm to 5pm  -
  558.   =  Sales: +1.617.273.2919                                       =
  559.   -    Fax: +1.617.273.2499                                       -
  560. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= =
  561. -     E-Mail -> books@softproeast.com                           -=-
  562. = WWW/Mosaic -> http://storefront.xor.com                         =
  563. -     Gopher -> gopher storefront.xor.com                         -
  564. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  565. __________________ End Included ____________________
  566. The folks at SoftPro have it all; books on C, C++, LISP, Smalltalk,
  567. UNIX, Windoze, whatever & the description of many books is also
  568. on line -- lots of the FAQ is there for the _including_.
  569. For ANSI C stuff, there are also online training courses avaliable,
  570. go to rtfm at mit, look in the Usenet FAQs for comp.lang.c and
  571. comp.lang.c++ -- they also include and rate books that are 
  572. basically platform independent. Of course, to really code on the
  573. Mac you'll still need the Toolbox books at a minimum.
  574.  
  575. Well, I've already told you more than I know, but hey ...
  576. at this price it's a good deal ;-)
  577. Cheers,
  578. Gary
  579.  
  580. +++++++++++++++++++++++++++
  581.  
  582. >From tblanch@lookout (Todd Blanchard)
  583. Date: Mon, 26 Sep 1994 15:56:48 GMT
  584. Organization: US WEST Information Technologies
  585.  
  586. Robert (stone@phoenix.cs.uga.edu) wrote:
  587. : I need YOUR opinion!  Here are some books that I've heard of, and I want to
  588. : know how they rate.  Also, let me know if you have any good suggestions on
  589. : where to get them (mail order or otherwise.)  Note that I'm interested in
  590. : books for people who know little or nothing about mac programming in general
  591. : (but who know something about programming on other platforms.)
  592.  
  593. I rely on the following pretty heavily:
  594.  
  595. The Annotated C++ Reference Manual (ARM) Ellis & Stroustrup
  596. Effective C++, Scott Meyers - (Awesome book!)
  597. C++ IOStreams Handbook, Teale
  598. The C Programming Language, K&R
  599. Think Ref, Mac online refernce from Symantec.
  600.  
  601. Apart from the last one, these are more general C++ references rather
  602. than Mac-specific. I'll leave the Mac stuff to those who actually do
  603. Macs for a living (I play for fun).
  604.  
  605. Todd Blanchard
  606.  
  607. ---------------------------
  608.  
  609. >From hecht@vnet.net (Michael Hecht)
  610. Subject: Changing to new toolbox routine names with MacPerl
  611. Date: 25 Sep 1994 06:41:58 GMT
  612. Organization: Vnet Internet Access, Charlotte, NC -  info@char.vnet.net
  613.  
  614. The new Universal Headers rename many (~135) of the existing toolbox
  615. routines as part of the switch from a trap-based system to a code fragment
  616. system. For example, DisposHandle is now DisposeHandle. Apple suggests
  617. that you change your code to use the new names. Currently, they provide
  618. #defines to map the old name to the new one, but they claimed at the WWDC
  619. that the #defines will go away eventually.
  620.  
  621. Those of you with MPW can use its canon tool to change the toolbox
  622. routines in all your source code easily. Those of you (like me) without
  623. MPW or canon can do the job using the MacPerl scripts I wrote.
  624.  
  625. The first script searches the Universal Headers for #defines that look
  626. like old-->new name mappings. I included it for your edification--you
  627. don't need to actually run it. The second script applies the changes (read
  628. from the end of the script) to a group of .c files. Someone could probably
  629. turn this one into a MacPerl droplet if they were so inclined.
  630.  
  631. Anyway, here they are.
  632. --Michael
  633.  
  634. ============= begin "mkcanon.pl"
  635. # This is the directory where the Universal Headers live on my Mac
  636. $syshdir = 'Wynonna:Development:Symantec C++ for Macintosh:Mac
  637. #includes:Universal Headers:';
  638.  
  639. # Get a list of all Universal Header files
  640. opendir( SYSHDIR, $syshdir ) || die;
  641. @sysh = grep( /\.h$/, readdir( SYSHDIR ));
  642. closedir( SYSHDIR );
  643.  
  644. # For each header file
  645. foreach $sysh ( @sysh ) {
  646.  
  647.    # Read the header file
  648.    open( SYSH, "<$syshdir$sysh" ) || die;
  649.    while( <SYSH> ) {
  650.  
  651.       # Look for #defines with parameters
  652.       next unless /^#define \w+\(/;
  653.  
  654.       # Read in multiline #defines
  655.       $_ = $` . <SYSH> while /\\\n$/;
  656.  
  657.       # Look for #defines that simply rename a function call
  658.       next unless /^#define (\w+)(\([^)]*\)) (\w+)\2/;
  659.  
  660.       # Get old & new names
  661.       ( $old, $new ) = ( $1, $3 );
  662.  
  663.       # The "IU" routines are confused in <TextUtils.h>    Apple?
  664.       ( $new, $old ) = ( $old, $new ) if $new =~ /^IU/i;
  665.  
  666.       print "$old --> $new\n";
  667.    }
  668.    close( SYSH );
  669. }
  670. ============= end "mkcanon.pl"
  671.  
  672. ============= begin "canon.pl"
  673. # This is the directory of source code to be changed
  674. $projdir = 'Wynonna:MyProject:';
  675.  
  676. # This is the directory that the changed files will be written to
  677. $outdir  = 'Wynonna:MyProject Out:';
  678.  
  679. # Unbuffer STDOUT
  680. $| = 1;
  681.  
  682. # Initialize substitution command string
  683. $s = "";
  684. $npairs = 0;
  685.  
  686. print "\nReading mapping pairs... ";
  687.  
  688. # Read mapping pairs
  689. while( <DATA> ) {
  690.  
  691.    # Split up this mapping pair
  692.    chop;
  693.    ( $old, $new ) = split( / --> / );
  694.  
  695.    # Append substitution command to string
  696.    $s .= "\$n = s/\\b$old\\b/$new/g; \$canon{ '$_' } += \$n if \$n;\n";
  697.  
  698.    # Count pairs
  699.    $npairs++;
  700. }
  701.  
  702. print "$npairs\n";
  703.  
  704. # Uncomment next line to see what kind of code we're generating
  705. #print $s;
  706.  
  707. # Get a list of all the source files in the project directory
  708. opendir( PROJDIR, $projdir ) || die;
  709. @proj = grep( /\.cp{0,2}$/, readdir( PROJDIR ));
  710. closedir( PROJDIR );
  711.  
  712. # Read entire file at once rather than line-by-line
  713. undef $/;
  714. $* = 1;
  715.  
  716. # Go through the list of files
  717. foreach $proj ( @proj ) {
  718.  
  719.    # Read this file
  720.    open( PROJ, "<$projdir$proj" ) || die;
  721.    ( $fcreator, $ftype ) = &MacPerl'GetFileInfo( "$projdir$proj" );
  722.    $_ = <PROJ>;
  723.    close( PROJ );
  724.  
  725.    # Reset our count of substitutions made, and perform all substitutions
  726.    undef %canon;
  727.    eval $s;
  728.  
  729.    # Continue if no changes were made
  730.    next unless %canon;
  731.  
  732.    # Log the changes
  733.    print "\n$proj:\n";
  734.    foreach $change ( sort keys %canon ) {
  735.       print "$change: $canon{$change}\n";
  736.    }
  737.  
  738.    # Uncomment next line to skip writing the changed file
  739. #   next;
  740.  
  741.    # Write the file
  742.    open( PROJ, ">$outdir$proj" ) || die;
  743.    &MacPerl'SetFileInfo( $fcreator, $ftype, "$outdir$proj" );
  744.    print PROJ;
  745.    close( PROJ );
  746. }
  747.  
  748. __END__
  749. SetCTitle --> SetControlTitle
  750. GetCTitle --> GetControlTitle
  751. UpdtControl --> UpdateControls
  752. SetCtlValue --> SetControlValue
  753. GetCtlValue --> GetControlValue
  754. SetCtlMin --> SetControlMinimum
  755. GetCtlMin --> GetControlMinimum
  756. SetCtlMax --> SetControlMaximum
  757. GetCtlMax --> GetControlMaximum
  758. SetCRefCon --> SetControlReference
  759. GetCRefCon --> GetControlReference
  760. SetCtlAction --> SetControlAction
  761. GetCtlAction --> GetControlAction
  762. SetCtlColor --> SetControlColor
  763. GetAuxCtl --> GetAuxiliaryControlRecord
  764. GetCVariant --> GetControlVariant
  765. getctitle --> getcontroltitle
  766. setctitle --> setcontroltitle
  767. DisposDialog --> DisposeDialog
  768. UpdtDialog --> UpdateDialog
  769. GetDItem --> GetDialogItem
  770. SetDItem --> SetDialogItem
  771. HideDItem --> HideDialogItem
  772. ShowDItem --> ShowDialogItem
  773. SelIText --> SelectDialogItemText
  774. GetIText --> GetDialogItemText
  775. SetIText --> SetDialogItemText
  776. FindDItem --> FindDialogItem
  777. GetAlrtStage --> GetAlertStage
  778. ResetAlrtStage --> ResetAlertStage
  779. DlgCut --> DialogCut
  780. DlgPaste --> DialogPaste
  781. DlgCopy --> DialogCopy
  782. DlgDelete --> DialogDelete
  783. SetDAFont --> SetDialogFont
  784. getitext --> getdialogitemtext
  785. setitext --> setdialogitemtext
  786. findditem --> finddialogitem
  787. KeyTrans --> KeyTranslate
  788. LDoDraw --> LSetDrawingMode
  789. LFind --> LGetCellDataLocation
  790. lfind --> lgetcelldatalocation
  791. ApplicZone --> ApplicationZone
  792. MFTempNewHandle --> TempNewHandle
  793. MFMaxMem --> TempMaxMem
  794. MFFreeMem --> TempFreeMem
  795. MFTempHLock --> TempHLock
  796. MFTempHUnlock --> TempHUnlock
  797. MFTempDisposHandle --> TempDisposeHandle
  798. MFTopMem --> TempTopMem
  799. ResrvMem --> ReserveMem
  800. DisposPtr --> DisposePtr
  801. DisposHandle --> DisposeHandle
  802. ReallocHandle --> ReallocateHandle
  803. AddResMenu --> AppendResMenu
  804. InsMenuItem --> InsertMenuItem
  805. DelMenuItem --> DeleteMenuItem
  806. SetItem --> SetMenuItemText
  807. GetItem --> GetMenuItemText
  808. GetMHandle --> GetMenuHandle
  809. DelMCEntries --> DeleteMCEntries
  810. DispMCInfo --> DisposeMCInfo
  811. addresmenu --> appendresmenu
  812. getitem --> getmenuitemtext
  813. setitem --> setmenuitemtext
  814. insmenuitem --> insertmenuitem
  815. OSAComponentFunctionInline --> ComponentCallNow
  816. LongDate2Secs --> LongDateToSeconds
  817. LongSecs2Date --> LongSecondsToDate
  818. IUMetric --> IsMetric
  819. Date2Secs --> DateToSeconds
  820. Secs2Date --> SecondsToDate
  821. DisposPictInfo --> DisposePictInfo
  822. DisposPixMap --> DisposePixMap
  823. DisposPixPat --> DisposePixPat
  824. DisposCTable --> DisposeCTable
  825. DisposCCursor --> DisposeCCursor
  826. DisposCIcon --> DisposeCIcon
  827. DisposGDevice --> DisposeGDevice
  828. NDrawJust --> DrawJustified
  829. NMeasureJust --> MeasureJustified
  830. NPortionText --> PortionLine
  831. SizeResource --> GetResourceSizeOnDisk
  832. MaxSizeRsrc --> GetMaxResourceSize
  833. RmveResource --> RemoveResource
  834. SetSysJust --> SetSysDirection
  835. GetSysJust --> GetSysDirection
  836. Font2Script --> FontToScript
  837. GetEnvirons --> GetScriptManagerVariable
  838. SetEnvirons --> SetScriptManagerVariable
  839. IUGetIntl --> GetIntlResource
  840. IUSetIntl --> SetIntlResource
  841. IUClearCache --> ClearIntlResourceCache
  842. IUGetItlTable --> GetIntlResourceTable
  843. TESetJust --> TESetAlignment
  844. TextBox --> TETextBox
  845. TEStylNew --> TEStyleNew
  846. SetStylHandle --> TESetStyleHandle
  847. GetStylHandle --> TEGetStyleHandle
  848. GetStyleHandle --> TEGetStyleHandle
  849. TEStylPaste --> TEStylePaste
  850. GetStylScrap --> TEGetStyleScrapHandle
  851. GetStyleScrap --> TEGetStyleScrapHandle
  852. SetStylScrap --> TEUseStyleScrap
  853. SetStyleScrap --> TEUseStyleScrap
  854. TEStylInsert --> TEStyleInsert
  855. TESetScrapLen --> TESetScrapLength
  856. TEGetScrapLen --> TEGetScrapLength
  857. SetClikLoop --> TESetClickLoop
  858. SetWordBreak --> TESetWordBreak
  859. IULDateString --> LongDateString
  860. iuldatestring --> longdatestring
  861. IULDateString --> LongTimeString
  862. iultimestring --> longtimestring
  863. String2Date --> StringToDate
  864. String2Time --> StringToTime
  865. UprString --> UpperString
  866. uprstring --> upperstring
  867. IUCompPString --> CompareString
  868. iucomppstring --> comparestring
  869. IUMagPString --> CompareText
  870. IUMagIDPString --> IdenticalText
  871. IUEqualPString --> IdenticalString
  872. iuequalpstring --> identicalstring
  873. IULangOrder --> LanguageOrder
  874. IUTextOrder --> TextOrder
  875. IUStringOrder --> StringOrder
  876. Str2Format --> StringToFormatRec
  877. Format2Str --> FormatRecToString
  878. FormatX2Str --> ExtendedToString
  879. FormatStr2X --> StringToExtended
  880. IUDatePString --> DateString
  881. iudatepstring --> datestring
  882. IUTimePString --> TimeString
  883. iutimepstring --> timestring
  884. ============= end "canon.pl"
  885.  
  886. +++++++++++++++++++++++++++
  887.  
  888. >From neeri@iis.ee.ethz.ch (Matthias Neeracher)
  889. Date: 25 Sep 1994 12:26:08 GMT
  890. Organization: Swiss Federal Institute of Technology (ETHZ)
  891.  
  892. hecht@vnet.net (Michael Hecht) writes:
  893. >Those of you with MPW can use its canon tool to change the toolbox
  894. >routines in all your source code easily. Those of you (like me) without
  895. >MPW or canon can do the job using the MacPerl scripts I wrote.
  896.  
  897. K001. Hope you don't mind me borrowing these for my MacPerl hall of fame?
  898.  
  899. >============= begin "mkcanon.pl"
  900. ># This is the directory where the Universal Headers live on my Mac
  901. >$syshdir = 'Wynonna:Development:Symantec C++ for Macintosh:Mac
  902. >#includes:Universal Headers:';
  903.  
  904. For those taking the script out of this article & try to run it:
  905. The above two lines are in fact one long word wrapped line.
  906.  
  907. Matthias
  908.  
  909. - ---
  910. Matthias Neeracher <neeri@iis.ee.ethz.ch> http://err.ethz.ch/members/neeri.html
  911.   "And that's why I am going to turn this world upside down, and make
  912.    of it a fire so *bright* that someone real will notice"
  913.                                 -- Vernor Vinge, _Tatja Grimm's World_
  914.  
  915. ---------------------------
  916.  
  917. >From mars@netcom.com (Darren Giles)
  918. Subject: Cleanest way to turn AppleTalk on-off
  919. Date: Thu, 15 Sep 1994 08:04:28 GMT
  920. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  921.  
  922.  
  923. What is the cleanest way to turn AppleTalk on & off?  I've used MPPOpen and
  924. MPPClose with some success in the past, but it's no longer in the universal
  925. headers.  There's a mention of using OpenDriver in IM, but I'm a little
  926. leery of using it without more info than given.
  927.  
  928. Basically, what I'm trying to do is simulate clicking on the "AppleTalk on/off"
  929. buttons in the Chooser.  Has anyone done this?
  930.  
  931. - Darren
  932.  
  933. <Std. Disclaimer>  I know this is not something that should "normally" be done.
  934. I'm working on an embedded application, where the user will never even see the
  935. screen... so "normal" doesn't seem to apply.
  936.  
  937. +++++++++++++++++++++++++++
  938.  
  939. >From mars@netcom.com (Darren Giles)
  940. Date: Mon, 26 Sep 1994 02:27:06 GMT
  941. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  942.  
  943. In article <marsCw5vrG.JtM@netcom.com>, I asked:
  944. >
  945. >What is the cleanest way to turn AppleTalk on & off?
  946. >
  947. >Basically, what I'm trying to do is simulate clicking on the "AppleTalk on/off"
  948. >buttons in the Chooser.  Has anyone done this?
  949.  
  950. I got answers from several people, request for the info from several others.
  951. Here's the code I'm now using, which works great:
  952.  
  953. ////////////////////////////////////////////////////////////////////////////////
  954. //    Must reboot after an off -> on transition for change to take effect
  955. ////////////////////////////////////////////////////////////////////////////////
  956. void cdev_atalk_on (void) {
  957.     LMSetSPConfig (useATalk);
  958. }
  959.  
  960.  
  961. ////////////////////////////////////////////////////////////////////////////////
  962. void cdev_atalk_off (void) {
  963.     LMSetSPConfig (useAsync);
  964. }
  965.  
  966.  
  967.  
  968.  
  969. ---------------------------
  970.  
  971. >From startz@u.washington.edu (Dick Startz)
  972. Subject: Dialog Edit text> 256 characters
  973. Date: Thu, 22 Sep 1994 08:45:43 +0800
  974. Organization: University of Washington
  975.  
  976. I have a desparate need to display very long edit text items in dialogs.
  977. Can anyone suggest a kludge to let me do this? BTW, sometimes I have more
  978. than one per dialog.
  979.  
  980. Thanks to all.
  981. -Dick Startz
  982.  
  983. +++++++++++++++++++++++++++
  984.  
  985. >From rmah@panix.com (Robert Mah)
  986. Date: Thu, 22 Sep 1994 15:47:54 -0500
  987. Organization: One Step Beyond
  988.  
  989. startz@u.washington.edu (Dick Startz) wrote:
  990.  
  991. ) I have a desparate need to display very long edit text items in dialogs.
  992. ) Can anyone suggest a kludge to let me do this? BTW, sometimes I have
  993. ) more than one per dialog.
  994.  
  995. I just answered this in another post yesterday (complete with untested
  996. sample code).  I'm afraid I can't remember the subject line, but it was
  997. similar to yours.
  998.  
  999. Cheers,
  1000. Rob
  1001. _____________________________________________________________________
  1002. Robert S. Mah           Software Development          +1.212.947.6507
  1003. One Step Beyond        and Network Consulting          rmah@panix.com
  1004.  
  1005. +++++++++++++++++++++++++++
  1006.  
  1007. >From peter.lewis@info.curtin.edu.au (Peter N Lewis)
  1008. Date: Fri, 23 Sep 1994 10:39:58 +0800
  1009. Organization: NCRPDA, Curtin University
  1010.  
  1011. In article <startz-2209940845440001@128.95.72.95>, startz@u.washington.edu
  1012. (Dick Startz) wrote:
  1013.  
  1014. >I have a desparate need to display very long edit text items in dialogs.
  1015. >Can anyone suggest a kludge to let me do this? BTW, sometimes I have more
  1016. >than one per dialog.
  1017.  
  1018. Just write a dialog user item proc, and use TextBox (or better yet, use
  1019. NeoTextBox as described in develop a few issues back (16?)).
  1020.    Peter.
  1021. -- 
  1022. Peter N Lewis <peter.lewis@info.curtin.edu.au> - Macintosh TCP fingerpainter
  1023. FTP my programs from redback.cs.uwa.edu.au:Others/PeterLewis/ or
  1024. amug.org:pub/peterlewis/ or nic.switch.ch:software/mac/peterlewis/
  1025.  
  1026. +++++++++++++++++++++++++++
  1027.  
  1028. >From fyock@mathworks.com (Lee Fyock)
  1029. Date: Fri, 23 Sep 1994 10:23:59 -0400
  1030. Organization: The MathWorks, Inc.
  1031.  
  1032. In article <peter.lewis-2309941039580001@rocky.curtin.edu.au>,
  1033. peter.lewis@info.curtin.edu.au (Peter N Lewis) wrote:
  1034.  
  1035. > In article <startz-2209940845440001@128.95.72.95>, startz@u.washington.edu
  1036. > (Dick Startz) wrote:
  1037. > >I have a desparate need to display very long edit text items in dialogs.
  1038. > >Can anyone suggest a kludge to let me do this? BTW, sometimes I have more
  1039. > >than one per dialog.
  1040. > Just write a dialog user item proc, and use TextBox (or better yet, use
  1041. > NeoTextBox as described in develop a few issues back (16?)).
  1042.  
  1043. This is too tough.  Just get the TEHandle associated with the dialog item,
  1044. and set the hText to whatever you'd like.  The Dialog Manager does fine at
  1045. displaying the item and editing it.
  1046.  
  1047. To set it up, do like so:
  1048.  
  1049.    dlogPtr = GetNewDialog(DISPLAY_DLOG, nil, (WindowPtr) -1);
  1050.    SetPort(dlogPtr);
  1051.  
  1052.    GetDItem(dlogPtr,TEXT_ITEM,&iType,&iHandle,&iRect);
  1053.  
  1054.    teH = ((DialogPeek) dlogPtr)->textH;
  1055.  
  1056.    // textH contains the >255 character text to put into the dialog
  1057.    SetHandleSize((**teH).hText, 0);
  1058.    HLock(textH);
  1059.    err = HandAndHand(textH, (**teH).hText);
  1060.    HUnlock(textH);
  1061.    TECalText(teH);
  1062.  
  1063. The "GetDItem" is necessary to get the Dialog Manager to actually load the
  1064. dialog and set it up...  You may need to add some stuff for more than one
  1065. text item in the dialog, since the dialog has only one TextEdit record
  1066. that is switched between the text items.
  1067.  
  1068. Getting the data back out is similar and is left as an exercise to the reader.
  1069.  
  1070. Have fun!
  1071. Lee
  1072.  
  1073.  
  1074. - ------------------------------------------------------------------
  1075. Lee Fyock                                    "I think I would remain
  1076. fyock@mathworks.com                                perfectly still."
  1077.  
  1078. +++++++++++++++++++++++++++
  1079.  
  1080. >From gurgle@dnai.com (Pete Gontier)
  1081. Date: Sat, 24 Sep 1994 10:19:35 -0800
  1082. Organization: Integer Poet Software
  1083.  
  1084. In article <startz-2209940845440001@128.95.72.95>, startz@u.washington.edu
  1085. (Dick Startz) wrote:
  1086.  
  1087. > I have a desparate need to display very long edit text items in dialogs.
  1088. > Can anyone suggest a kludge to let me do this? BTW, sometimes I have more
  1089. > than one per dialog.
  1090.  
  1091. My understanding is that although the system calls which access the
  1092. editText items take Pascal strings and thus are limited to 255 characters,
  1093. it's possible to have larger pieces of text in an editText item. You just
  1094. can't get that text out using the standard routines. You might want to
  1095. reverse-engineer just exactly what kind of handle is returned to you by
  1096. GetDItem. It may be a text handle and it may be a TE handle. Let us know
  1097. what you discover.
  1098.  
  1099. -- 
  1100.  
  1101.  Pete Gontier // CTO, Integer Poet Software // gurgle@dnai.com
  1102.  
  1103.  "Anything the Windows gang hates this much can't be all bad."
  1104.    -- Andrew Gore <agore@eworld.com>, on OpenDoc, MacWEEK 9/19/94
  1105.  
  1106. +++++++++++++++++++++++++++
  1107.  
  1108. >From gurgle@dnai.com (Pete Gontier)
  1109. Date: Mon, 26 Sep 1994 09:02:59 -0800
  1110. Organization: Integer Poet Software
  1111.  
  1112. In article <364jlo$rg6@uropax.contrib.de>, stk@uropax.contrib.de (Stefan
  1113. Kurth) wrote:
  1114.  
  1115. > In article <gurgle-2409941019350001@dynamic-229.dnai.com>,
  1116. > gurgle@dnai.com (Pete Gontier) wrote:
  1117. > > You might want to reverse-engineer just exactly what kind of handle is
  1118. > > returned to you by GetDItem. It may be a text handle and it may be a TE
  1119. > > handle. Let us know what you discover.
  1120. > Think Reference says it's the hText field of a TE handle, and that
  1121. > sounds reasonable to me, because there is only one TE handle in a
  1122. > dialog, even if there are several text fields.
  1123.  
  1124. However, if you call 'GetDItem' for an editText which is not active (does
  1125. not have the insertion point), the handle cannot be directly from the
  1126. 'hText' field. Perhaps it's
  1127. the-handle-which-might-be-in-the-'htext'-field. :-)
  1128.  
  1129. Anyway, it would be interesting if this sort of thing is an
  1130. Apple-documented behavior. I can't remember ever seeing documentation to
  1131. this effect; your THINK Reference, er, reference is news to me.
  1132.  
  1133. I'm not saying it's a bad idea to rely on this, but it would be nice to
  1134. see an Apple sanction, just to make it official.
  1135.  
  1136. -- 
  1137.  
  1138.  Pete Gontier // CTO, Integer Poet Software // gurgle@dnai.com
  1139.  
  1140.  "One of (Misty's) recent paintings, 'Interring the Terrier', 1993, which
  1141.  appears to show a small headless dog being stuffed inside a red armchair by
  1142.  two frogs and a sardine, sold at auction for $21,000 -- a record price..."
  1143.                            -- Busch and Silver, 'Why Cats Paint', p55
  1144.  
  1145. ---------------------------
  1146.  
  1147. >From craig@raru.adelaide.edu.au (Craig Kloeden)
  1148. Subject: Fast zeroing on PPC
  1149. Date: Sun, 18 Sep 1994 00:56:26 +0930
  1150. Organization: University of Adelaide
  1151.  
  1152. I have the following piece of code:
  1153.  
  1154. - -
  1155.  
  1156. Byte  plane[maxX][maxY];
  1157.  
  1158. for (i=0;i<maxX;i++)
  1159.   for (j=0;j<maxY;j++)
  1160.     plane[i][j] = 0;
  1161.  
  1162. - -
  1163.  
  1164. Believe it or not, this is a bottleneck in my program.
  1165. I need to make this as fast as possible on the PPC.
  1166.  
  1167. Any advice would be appreciated.
  1168.  
  1169. Craig
  1170.  
  1171. -- 
  1172. Craig Kloeden                 E-mail: craig@raru.adelaide.edu.au
  1173. Road Accident Research Unit   Phone : +61 8 303 5885
  1174. The University of Adelaide    Fax   : +61 8 232 4995
  1175. Australia                     Disclaimer: Not this little black duck!
  1176.  
  1177. +++++++++++++++++++++++++++
  1178.  
  1179. >From 103t_english@west.cscwc.pima.edu
  1180. Date: 17 Sep 94 11:06:28 MST
  1181. Organization: (none)
  1182.  
  1183. In article <craig-1809940056260001@ckloeden.dialup.adelaide.edu.au>, craig@raru.adelaide.edu.au (Craig Kloeden) writes:
  1184. > I have the following piece of code:
  1185. > ---
  1186. > Byte  plane[maxX][maxY];
  1187. > for (i=0;i<maxX;i++)
  1188. >   for (j=0;j<maxY;j++)
  1189. >     plane[i][j] = 0;
  1190. > ---
  1191. > Believe it or not, this is a bottleneck in my program.
  1192. > I need to make this as fast as possible on the PPC.
  1193. > Any advice would be appreciated.
  1194.  
  1195. Please note that I've cross-posted this to c.s.powerpc, (which is where it
  1196. belongs, IMHO).
  1197.  
  1198. Several things that you can do here:
  1199.  
  1200. First, understand that you are dealing with a cached memory, where x values can
  1201. fit in cache lines, and you want to deal with things one cache line at a time.
  1202. Make the x loop your inner loop.
  1203.  
  1204. Second, recognize that you are dealing with 1 byte numbers when you could easily
  1205. be dealing with 4-byte numbers (or 8 if you are doing this directly to video
  1206. where the video bus latency makes up for the slow speed of doing floating point
  1207. load stores). Redo your loop as manipulating longs, and it will go much faster.
  1208.  
  1209. Third, remember that the MPC601 chip "pipelines" loads and stores, so if you
  1210. "unroll/unwrap" your inner loop so that you are performing [at least] 4
  1211. loads/stores each time through, you will see a tremendous speedup.
  1212.  
  1213. Finally, if you have access to the PPCAsm, you can directly zero out this
  1214. memory (if it all fits in the L1 cache) by simply using the assembly language
  1215. instruction that zeros the cache rather than loading it from memory and THEN
  1216. zeroing it. This would give you a HUGE speedup from what I understand. I don't
  1217. have my MPC601 user's manual handy, and this isn't something that I really know
  1218. how to do, so if some kind soul that DOES know how to do this would go into
  1219. greater detail for him (and me)?
  1220.  
  1221. If you don't have the PPCAsm, maybe we could compose this routine on-line for
  1222. you, and I or somebody else could assemble it and either post it here in .hqx
  1223. format or just e-mail it to you... That way, you could just link it to your
  1224. program as a library routine...
  1225.  
  1226.  
  1227. Lawson
  1228.  
  1229. +++++++++++++++++++++++++++
  1230.  
  1231. >From jrb@mitre.org (Bob Boonstra)
  1232. Date: Sat, 17 Sep 1994 18:22:30 -0400
  1233. Organization: MITRE Corp.
  1234.  
  1235. In article <craig-1809940056260001@ckloeden.dialup.adelaide.edu.au>,
  1236. craig@raru.adelaide.edu.au (Craig Kloeden) wrote:
  1237.  
  1238. > I have the following piece of code:
  1239. > Byte  plane[maxX][maxY];
  1240. > for (i=0;i<maxX;i++)
  1241. >   for (j=0;j<maxY;j++)
  1242. >     plane[i][j] = 0;
  1243. > Believe it or not, this is a bottleneck in my program.
  1244. > I need to make this as fast as possible on the PPC.
  1245. > Any advice would be appreciated.
  1246.  
  1247. Others can probably do better, but you can get a significant improvement
  1248. by writing in units larger than bytes and by loop unrolling. For example, 
  1249. the following code is more than 4 times faster than the original:
  1250.  
  1251. register long double *p,*q; 
  1252. register long double zero=0;
  1253.  
  1254. p = (long double *)plane; 
  1255. q = p + maxX*maxY/sizeof(long double); 
  1256. /* This assumes maxY is a multiple of long double in size */ 
  1257. /* If not, add a cleanup loop at the end. */
  1258.  
  1259. while (p<q) { 
  1260.   *p = zero; *(p+1)=zero; *(p+2)=zero; *(p+3)=zero; 
  1261.   p += 4; 
  1262. }
  1263.  
  1264. This generates the following rather efficient PPC code using
  1265. Metrowerks CW4 (with maxX=64 and maxY=256):
  1266.  
  1267. 00000000: 80620000  lwz      r3,@41(RTOC)
  1268. 00000004: 80820000  lwz      r4,plane(RTOC)
  1269. 00000008: C8030000  lfd      fp0,0(r3)
  1270. 0000000C: 38044000  addi     r0,r4,16384
  1271. 00000010: 42800018  bc       ALWAYS,cr0_LT,*+24      ; $00000028
  1272. 00000014: D8040000  stfd     fp0,0(r4)
  1273. 00000018: D8040008  stfd     fp0,8(r4)
  1274. 0000001C: D8040010  stfd     fp0,16(r4)
  1275. 00000020: D8040018  stfd     fp0,24(r4)
  1276. 00000024: 38840020  addi     r4,r4,32
  1277. 00000028: 7C040040  cmplw    r4,r0
  1278. 0000002C: 4180FFE8  blt      *-24                    ; $00000014
  1279. 00000030: 4E800020  blr
  1280.  
  1281. For further info on PPC optimization, I suggest you look at the article
  1282. by Dave Evans in develop 18, the article by Dave Radcliffe in develop
  1283. 16, and a collection of articles in recent issues of MacTech by Richard
  1284. Clark.
  1285. -- 
  1286. -- Bob Boonstra
  1287. -- jrb@mitre.org
  1288. -- My opinion, not my employer's
  1289.  
  1290. +++++++++++++++++++++++++++
  1291.  
  1292. >From pchang@Xenon.Stanford.EDU (The Weasel)
  1293. Date: 18 Sep 1994 18:54:03 GMT
  1294. Organization: Computer Science Department, Stanford University.
  1295.  
  1296. >In article <craig-1809940056260001@ckloeden.dialup.adelaide.edu.au>,
  1297. >craig@raru.adelaide.edu.au (Craig Kloeden) wrote:
  1298. >
  1299. >> I have the following piece of code:
  1300. >> Byte  plane[maxX][maxY];
  1301. >> for (i=0;i<maxX;i++)
  1302. >>   for (j=0;j<maxY;j++)
  1303. >>     plane[i][j] = 0;
  1304. >> 
  1305. >> Believe it or not, this is a bottleneck in my program.
  1306. >> I need to make this as fast as possible on the PPC.
  1307. >> Any advice would be appreciated.
  1308.  
  1309. [ Good suggestions deleted ]
  1310.  
  1311. Another things you might try is to allocate your memory in a single
  1312. continous block and running through it linearly. The array references
  1313. that you have above is sort of equivilant to:
  1314.  
  1315.     plane[i * kMaxY + j] = ...
  1316.  
  1317. Additionally, this may not be true based on your snippet, but if you
  1318. are allocating the memory dynamically then allocating a single block
  1319. is definitely cheaper and easier on the cache.
  1320.  
  1321. Peter
  1322.  
  1323.  
  1324. +++++++++++++++++++++++++++
  1325.  
  1326. >From Bruce@hoult.actrix.gen.nz (Bruce Hoult)
  1327. Date: Sun, 18 Sep 1994 14:38:12 +1200 (NZST)
  1328. Organization: (none)
  1329.  
  1330. craig@raru.adelaide.edu.au (Craig Kloeden) writes:
  1331. > I have the following piece of code:
  1332. > ---
  1333. > Byte  plane[maxX][maxY];
  1334. > for (i=0;i<maxX;i++)
  1335. >   for (j=0;j<maxY;j++)
  1336. >     plane[i][j] = 0;
  1337. > ---
  1338. > Believe it or not, this is a bottleneck in my program.
  1339. > I need to make this as fast as possible on the PPC.
  1340. > Any advice would be appreciated.
  1341.  
  1342. The quality of code generation doesn't matter much here -- it's all
  1343. in how efficiently you bash the memory subsystem.
  1344.  
  1345. The problem with the straight C code is that the processor has to read
  1346. the old data from RAM, then you zero it, then you write it back.  It's
  1347. twice as fast if you only have to write the data out.
  1348.  
  1349. This is exactly what the PPC "dcbz" instruction (Data Cache Block Zero)
  1350. does -- it zeros 32 bytes of memory without first reading it from external
  1351. RAM.  i.e. it totally ignores the previous contents.
  1352.  
  1353. This is useful no matter what you want to write into the memory, but it
  1354. you happen to *want* zeros, then you don't need to do anything else.
  1355.  
  1356. Here's a little PPC assembly routine that makes this instruction
  1357. available to you in C, and an XCOFF object file that you can use from
  1358. botht eh MPW and CodeWarrior compilers:
  1359.  
  1360. - -------------------------------
  1361. ; void Zero32Bytes(void *p)
  1362. ; function that zeros a 32 byte range of memory using dcbz
  1363.  
  1364.    export Zero32Bytes[DS]
  1365.    export .Zero32Bytes[PR]
  1366.  
  1367.    toc
  1368.    tc Zero32Bytes[TC], Zero32Bytes[DS]
  1369.  
  1370.    csect Zero32Bytes[DS]
  1371.    dc.l .Zero32Bytes[PR]
  1372.    dc.l TOC[tc0]
  1373.    dc.l 0
  1374.  
  1375.    csect .Zero32Bytes[PR]
  1376.    dcbz r0,r3 ;implicit r0=0
  1377.    blr
  1378. - -------------------------------
  1379. - -------------------------------
  1380.  
  1381.  
  1382. Be careful!  This is somewhat of a shotgun!  It zeros not the 32
  1383. bytes starting at the pointer, but the 32 bytes *around* the
  1384. pointer -- from p&~31 to p|31.  Make sure you don't want anything
  1385. that's already there next to your array!
  1386.  
  1387. *IF* your array is aligned to a 32-byte boundary AND each row is
  1388. a multiple of 32 bytes long, then all you need to use this is
  1389. (in C -- in C++ you'll need 'extern "C"'):
  1390.  
  1391. - -------------------------------
  1392. extern void Zero32Bytes(void *p);
  1393.  
  1394. Byte  plane[maxX][maxY];
  1395.  
  1396. for (i=0;i<maxX;i++)
  1397.   for (j=0;j<maxY;j+=32)
  1398.     Zero32Bytes(&plane[i][j]);
  1399. - -------------------------------
  1400.  
  1401. Hope this helps.
  1402.  
  1403. Oh, yeah, if you try to use this on non-cachable memory (such as the
  1404. video memory) you'll get an alignment exception trap.
  1405.  
  1406. -- Bruce
  1407.  
  1408. +++++++++++++++++++++++++++
  1409.  
  1410. >From al@crucible.powertools.com (Al Evans)
  1411. Date: 19 Sep 94 13:43:14 GMT
  1412. Organization: PowerTools, Austin, Texas
  1413.  
  1414. In article <craig-1809940056260001@ckloeden.dialup.adelaide.edu.au> craig@raru.adelaide.edu.au (Craig Kloeden) writes:
  1415.  
  1416. >I have the following piece of code:
  1417.  
  1418. >---
  1419. >
  1420. >Byte  plane[maxX][maxY];
  1421. >
  1422. >for (i=0;i<maxX;i++)
  1423. >  for (j=0;j<maxY;j++)
  1424. >    plane[i][j] = 0;
  1425. >
  1426. >---
  1427.  
  1428. >Believe it or not, this is a bottleneck in my program.
  1429. >I need to make this as fast as possible on the PPC.
  1430.  
  1431. Here's an answer I haven't seen yet.
  1432.  
  1433. If you've got the memory to spare, you can initialize one copy of
  1434. your plane array, then use
  1435.  
  1436.     BlockMoveData(inittedMaster, plane, maxX * maxY);
  1437.  
  1438. To rapidly initialize the "real" plane. If plane is particularly large,
  1439. it will be hard to beat this technique for speed. And since BlockMove()
  1440. is a ROM routine, you can be certain it's optimized for each Mac model.
  1441.  
  1442.                     --Al Evans--
  1443. -- 
  1444. Al Evans        |   Graphic Elements: A new standard for 
  1445. ________________________|__ high-performance interactive Macintosh graphics.
  1446. al@crucible.powertools.com |  Available from mac.archive.umich.edu
  1447. - -------------------------| /mac/development/libraries/graphicelements2.sit.hqx
  1448.  
  1449. +++++++++++++++++++++++++++
  1450.  
  1451. >From Darrin Cardani <Darrin.Cardani@AtlantaGA.NCR.COM>
  1452. Date: Mon, 19 Sep 1994 14:42:50 GMT
  1453. Organization: AT&T Global Information Solutions, Atlanta
  1454.  
  1455. >In article <35i2cb$2ug@Times.Stanford.EDU> The Weasel writes: 
  1456. >>In article <craig-1809940056260001@ckloeden.dialup.adelaide.edu.au>,
  1457. >>craig@raru.adelaide.edu.au (Craig Kloeden) wrote:
  1458. >>
  1459. >>> I have the following piece of code:
  1460. >>> Byte  plane[maxX][maxY];
  1461. >>> for (i=0;i<maxX;i++)
  1462. >>>   for (j=0;j<maxY;j++)
  1463. >>>     plane[i][j] = 0;
  1464. >>> 
  1465. >>> Believe it or not, this is a bottleneck in my program.
  1466. >>> I need to make this as fast as possible on the PPC.
  1467. >>> Any advice would be appreciated.
  1468. >
  1469. >[ Good suggestions deleted ]
  1470. >
  1471. >Another things you might try is to allocate your memory in a single
  1472. >continous block and running through it linearly. The array references
  1473. >that you have above is sort of equivilant to:
  1474. >
  1475. >    plane[i * kMaxY + j] = ...
  1476.  
  1477. What about
  1478.  
  1479. Ptr plane;
  1480.  
  1481. plane = NewPtrClear (maxX*maxY);
  1482.  
  1483. Or is NewPtrClear not very efficient?
  1484.  
  1485. Darrin
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493. +++++++++++++++++++++++++++
  1494.  
  1495. >From weare@galaxy.ucr.edu (christopher weare)
  1496. Date: 19 Sep 1994 10:47:33 -0700
  1497. Organization: University of California, Riverside
  1498.  
  1499. <fast zeroing stuff deleted>
  1500.  
  1501. You might want to try unrolling your loops abit:
  1502.  
  1503. long    numFloats, i;
  1504. float    *pointer,*temp;
  1505.     
  1506.     pointer = (float *)NewPointer(sizeof(float)*numFloats);
  1507.     temp = pointer;
  1508.  
  1509.     for(i=0;i<numFloats;i+=4){
  1510.         *(temp) = 0.0;
  1511.         *(temp+1) = 0.0;
  1512.         *(temp+2) = 0.0;
  1513.         *(temp+3) = 0.0;
  1514.  
  1515.         temp += 4;
  1516.     }
  1517.  
  1518. ...
  1519.  
  1520. ofcourse this assumes that numFloats is divisable by for.  If not just clean
  1521. up at the end of the main loop.  Notice that this requires only addition in
  1522. calculating offsets and should keep the pipelines busy.  Experiment with the 
  1523. amount of unrolling.  As always, your milage may vary.
  1524.  
  1525. Chris
  1526. weare@galaxy.ucr.edu 
  1527.  
  1528.  
  1529.  
  1530. +++++++++++++++++++++++++++
  1531.  
  1532. >From dsemchi@glenayre.com (Dale Semchishen [4597])
  1533. Date: Mon, 19 Sep 1994 19:24:55 GMT
  1534. Organization: Glenayre Electronics Ltd.
  1535.  
  1536. In article 2ug@Times.Stanford.EDU, pchang@Xenon.Stanford.EDU (The Weasel) writes:
  1537. >>In article <craig-1809940056260001@ckloeden.dialup.adelaide.edu.au>,
  1538. >>craig@raru.adelaide.edu.au (Craig Kloeden) wrote:
  1539. >>
  1540. >>> I have the following piece of code:
  1541. >>> Byte  plane[maxX][maxY];
  1542. >>> for (i=0;i<maxX;i++)
  1543. >>>   for (j=0;j<maxY;j++)
  1544. >>>     plane[i][j] = 0;
  1545. >>> 
  1546. >>> Believe it or not, this is a bottleneck in my program.
  1547. >>> I need to make this as fast as possible on the PPC.
  1548. >>> Any advice would be appreciated.
  1549.  
  1550. You write a function that zeros a generic buffer as follows:
  1551.  
  1552.     - two parameters (buffer_pointer and number_of_bytes)
  1553.     - calculate how many longs are in buffer by shifting number_of_bytes
  1554.       right twice
  1555.     - clear the calculated number of longs and then the remaining bytes
  1556.  
  1557. If you are compiling your source code for PPC and the Plain Jane 68000,
  1558. then your function must make sure it does not write a long to an odd address.
  1559.  
  1560. - -
  1561. Dale Semchishen           | dsemchi@glenayre.com
  1562. Glenayre Electronics Ltd  | (604) 293-1611
  1563. Vancouver, BC, CANADA     |
  1564.  
  1565.  
  1566.  
  1567. +++++++++++++++++++++++++++
  1568.  
  1569. >From zstern@adobe.com (Zalman Stern)
  1570. Date: Tue, 20 Sep 1994 02:30:52 GMT
  1571. Organization: Adobe Systems Incorporated
  1572.  
  1573. Al Evans writes
  1574. > If you've got the memory to spare, you can initialize one copy of
  1575. > your plane array, then use
  1576. >     BlockMoveData(inittedMaster, plane, maxX * maxY);
  1577. > To rapidly initialize the "real" plane. If plane is particularly large,
  1578. > it will be hard to beat this technique for speed. And since BlockMove()
  1579. > is a ROM routine, you can be certain it's optimized for each Mac model.
  1580.  
  1581. This is a bad answer as it takes approximately twice the memory bandwidth.  
  1582. (And introduces another read latency into a conceptually write only  
  1583. operation.) To put it mildly, there is a reason you haven't this mentioned  
  1584. yet.
  1585.  
  1586. In theory, the right solution is "memset(plane, 0, sizeof(plane));" but  
  1587. Apple blew it big time in implementing memset. A really good PowerPC  
  1588. implementation of this operation might try to use the data cache block zero  
  1589. instruction, though  it cannot be used on uncached memory and you p[retty  
  1590. much have to know the cache block size to implement the code. (In other  
  1591. words, doing it portably requires dynamic code generation.)
  1592.  
  1593. For this application, an unrolled loop that writes longs will probably work  
  1594. fine. Writing floating-point values on the MPC601 is dubious as you can only  
  1595. get in one floating-point store per 3 cycles. If you're going to uncached  
  1596. memory that is probably the right thing. Otherwise not.
  1597. --
  1598. Zalman Stern           zalman@adobe.com            (415) 962 3824
  1599. Adobe Systems, 1585 Charleston Rd., POB 7900, Mountain View, CA 94039-7900
  1600.  Please do not change color while I am talking to you -- MC 900 Ft Jesus.
  1601.  
  1602. +++++++++++++++++++++++++++
  1603.  
  1604. >From ari@world.std.com (Ari I Halberstadt)
  1605. Date: Tue, 20 Sep 1994 02:30:40 GMT
  1606. Organization: The World Public Access UNIX, Brookline, MA
  1607.  
  1608. In article <2862743892@hoult.actrix.gen.nz>,
  1609. Bruce Hoult <Bruce@hoult.actrix.gen.nz> wrote:
  1610. >craig@raru.adelaide.edu.au (Craig Kloeden) writes:
  1611. >> I have the following piece of code:
  1612. >> 
  1613. >> ---
  1614. >> 
  1615. >> Byte  plane[maxX][maxY];
  1616. >> 
  1617. >> for (i=0;i<maxX;i++)
  1618. >>   for (j=0;j<maxY;j++)
  1619. >>     plane[i][j] = 0;
  1620. >> 
  1621. >> ---
  1622. >> 
  1623. >> Believe it or not, this is a bottleneck in my program.
  1624. >> I need to make this as fast as possible on the PPC.
  1625. >> 
  1626. >> Any advice would be appreciated.
  1627. >
  1628. >The quality of code generation doesn't matter much here -- it's all
  1629. >in how efficiently you bash the memory subsystem.
  1630.  
  1631. Actually, the quality of code generation is quite important. Compilers
  1632. can do all sorts of tricks to speed up loops like the above. Things
  1633. that are often done manually, such as loop unrolling, pointer
  1634. arithmetic, common subexpression elimination, etc. can all be handled
  1635. by the compiler. And the compiler may be better suited to make decisions
  1636. on pipelining instructions for a RISC processor.
  1637.  
  1638. What the original poster needs is to zero a block of memory of maxY by
  1639. maxX bytes. The simple call memset(p,0,n) is almost always sufficient
  1640. and it's portable. Assuming the compiler's optimizer or implementation
  1641. of memset is pathetic, he can hand-code all sorts of optimizations,
  1642. most of which have already been suggested.  One other way to unroll a
  1643. loop is to use a fancy (or obscure, take your pick) switch statement;
  1644. most C texts have it as an exercise in "what does this do", but I
  1645. don't know if it really is any faster than a more obvious loop
  1646. unrolling. The use of a dedicated processor instruction (as suggested
  1647. by Bruce) along with the other optimizations should result in a
  1648. memory-zeroing routine that is as fast as can be made.
  1649.  
  1650. Further optimizations would have to examine the need for the zeroed
  1651. memory.
  1652.  
  1653. Does the memory have to be zeroed, or is it just being filled up with
  1654. data later on that don't need to be zeroed initially?
  1655.  
  1656. Is the array being used to represent a data structure that would be
  1657. better represented in some other form?
  1658.  
  1659. Is the algorithm written in such a way that the memory zeroing code is
  1660. being called more than may be necessary?
  1661.  
  1662. Could the memory be zeroed in small chunks over time, rather than all
  1663. at once? You could spawn a thread to do the zeroing, and run it in the
  1664. background while the user is figuring out which buttons to click. By
  1665. the time the user is ready to do something, the memory is zeroed, and
  1666. the user will notice no delay. If the user is real speedy, you can
  1667. always wait for the thread to complete before proceeding. (This is an
  1668. approximation of parallelization, where a second processor and
  1669. instruction set are simulated via a thread.)
  1670.  
  1671.  
  1672.  
  1673.  
  1674. -- 
  1675. Ari Halberstadt                                 ari@world.std.com
  1676. One generation passes away, and another generation comes: but the
  1677. earth abides for ever. -- Ecclesiastes, 1:4.
  1678.  
  1679. +++++++++++++++++++++++++++
  1680.  
  1681. >From Bruce@hoult.actrix.gen.nz (Bruce Hoult)
  1682. Date: Tue, 20 Sep 1994 16:10:12 +1200 (NZST)
  1683. Organization: (none)
  1684.  
  1685. 103t_english@west.cscwc.pima.edu writes:
  1686. > > Byte  plane[maxX][maxY];
  1687. > > 
  1688. > > for (i=0;i<maxX;i++)
  1689. > >   for (j=0;j<maxY;j++)
  1690. > >     plane[i][j] = 0;
  1691. > Finally, if you have access to the PPCAsm, you can directly zero out this
  1692. > memory (if it all fits in the L1 cache) by simply using the assembly language
  1693. > instruction that zeros the cache rather than loading it from memory and THEN
  1694. > zeroing it. This would give you a HUGE speedup from what I understand. I don't
  1695. > have my MPC601 user's manual handy, and this isn't something that I really know
  1696. > how to do, so if some kind soul that DOES know how to do this would go into
  1697. > greater detail for him (and me)?
  1698. > If you don't have the PPCAsm, maybe we could compose this routine on-line for
  1699. > you, and I or somebody else could assemble it and either post it here in .hqx
  1700. > format or just e-mail it to you... That way, you could just link it to your
  1701. > program as a library routine...
  1702.  
  1703. Already done :-)
  1704.  
  1705. +++++++++++++++++++++++++++
  1706.  
  1707. >From craig@raru.adelaide.edu.au (Craig Kloeden)
  1708. Date: Tue, 20 Sep 1994 22:55:44 +0930
  1709. Organization: University of Adelaide
  1710.  
  1711. In article <2862743892@hoult.actrix.gen.nz>, Bruce@hoult.actrix.gen.nz
  1712. (Bruce Hoult) wrote:
  1713. - > Byte  plane[maxX][maxY];
  1714. - > 
  1715. - > for (i=0;i<maxX;i++)
  1716. - >   for (j=0;j<maxY;j++)
  1717. - >     plane[i][j] = 0;
  1718. - > Believe it or not, this is a bottleneck in my program.
  1719. - > I need to make this as fast as possible on the PPC.
  1720. - > 
  1721. - > Any advice would be appreciated.
  1722. - The quality of code generation doesn't matter much here -- it's all
  1723. - in how efficiently you bash the memory subsystem.
  1724. - The problem with the straight C code is that the processor has to read
  1725. - the old data from RAM, then you zero it, then you write it back.  It's
  1726. - This is exactly what the PPC "dcbz" instruction (Data Cache Block Zero)
  1727. - does -- it zeros 32 bytes of memory without first reading it from external
  1728. - RAM.  i.e. it totally ignores the previous contents.
  1729. - This is useful no matter what you want to write into the memory, but it
  1730. - you happen to *want* zeros, then you don't need to do anything else.
  1731. - Here's a little PPC assembly routine that makes this instruction
  1732. - available to you in C, and an XCOFF object file that you can use from
  1733. - botht eh MPW and CodeWarrior compilers:
  1734.  
  1735. Many many thanks. This is exactly what i needed.
  1736. Check out ftp://raru.adelaide.edu.au/rotater/
  1737. if you want to see the final program.
  1738.  
  1739. thanks again
  1740.  
  1741. Craig
  1742.  
  1743. -- 
  1744. Craig Kloeden                 E-mail: craig@raru.adelaide.edu.au
  1745. Road Accident Research Unit   Phone : +61 8 303 5885
  1746. The University of Adelaide    Fax   : +61 8 232 4995
  1747. Australia                     Disclaimer: Not this little black duck!
  1748.  
  1749. +++++++++++++++++++++++++++
  1750.  
  1751. >From mcgrath@egret.SLAC.Stanford.EDU (Gary G. McGrath)
  1752. Date: Tue, 20 Sep 1994 20:25:54 GMT
  1753. Organization: University of California, Department of Physics
  1754.  
  1755.  
  1756. |> If you've got the memory to spare, you can initialize one copy of
  1757. |> your plane array, then use
  1758. |> 
  1759. |>     BlockMoveData(inittedMaster, plane, maxX * maxY);
  1760. |> 
  1761. |> To rapidly initialize the "real" plane. If plane is particularly large,
  1762. |> it will be hard to beat this technique for speed. And since BlockMove()
  1763. |> is a ROM routine, you can be certain it's optimized for each Mac model.
  1764.  
  1765. -- 
  1766.  
  1767. Maybe some apple folks can better tell us the validity of this last sentence.  Can
  1768. we be sure that BlockMoveData will be optimized for whatever platform it is on?  I
  1769. seem to remember a MacTech article on 040 assembly optimization of BlockMoveData
  1770. where he got something like a factor 2+ on small to medium size routines because of
  1771. less overhead.  I would say that is consistent with my experience.
  1772.  
  1773.                     Sincerely,
  1774.                     Gary McGrath
  1775.  
  1776. +---------------------+--------------------------------------------
  1777. | _ O _    O      O   | Gary McGrath                               \
  1778. |  \|/   _/|\_   |||  | Stanford Linear Accelerator Center, MS-95   \
  1779. |   |      |      |   | PO Box 4349                                  \
  1780. | _/ \_  _/ \_  _/ \_ | Stanford, CA 94307 |  27887::gary             \ 
  1781. |---------------------|                    |  gmcgrath@uci.edu         \
  1782. | Shiny, Happy People | (415) 926-3593     |  mcgrath@slac.stanford.edu \
  1783. +---------------------+--------------------+------------------------------
  1784.  
  1785. * My opinions do not represent those of Stanford University,
  1786. the University of California, or the D.O.E.
  1787.  
  1788. +++++++++++++++++++++++++++
  1789.  
  1790. >From 103t_english@west.cscwc.pima.edu
  1791. Date: 21 Sep 94 08:39:09 MST
  1792. Organization: (none)
  1793.  
  1794. In article <2862743892@hoult.actrix.gen.nz>, Bruce@hoult.actrix.gen.nz (Bruce Hoult) writes:
  1795. > craig@raru.adelaide.edu.au (Craig Kloeden) writes:
  1796. >> I have the following piece of code:
  1797. >> 
  1798. >> ---
  1799. >> 
  1800. >> Byte  plane[maxX][maxY];
  1801. >> 
  1802. >> for (i=0;i<maxX;i++)
  1803. >>   for (j=0;j<maxY;j++)
  1804. >>     plane[i][j] = 0;
  1805. >> 
  1806. >> ---
  1807. >> 
  1808. >> Believe it or not, this is a bottleneck in my program.
  1809. >> I need to make this as fast as possible on the PPC.
  1810. >> 
  1811. >> Any advice would be appreciated.
  1812. > The quality of code generation doesn't matter much here -- it's all
  1813. > in how efficiently you bash the memory subsystem.
  1814. > The problem with the straight C code is that the processor has to read
  1815. > the old data from RAM, then you zero it, then you write it back.  It's
  1816. > twice as fast if you only have to write the data out.
  1817. > This is exactly what the PPC "dcbz" instruction (Data Cache Block Zero)
  1818. > does -- it zeros 32 bytes of memory without first reading it from external
  1819. > RAM.  i.e. it totally ignores the previous contents.
  1820. > This is useful no matter what you want to write into the memory, but it
  1821. > you happen to *want* zeros, then you don't need to do anything else.
  1822. > Here's a little PPC assembly routine that makes this instruction
  1823. > available to you in C, and an XCOFF object file that you can use from
  1824. > botht eh MPW and CodeWarrior compilers:
  1825. > ---------------------------------
  1826. > ; void Zero32Bytes(void *p)
  1827. > ; function that zeros a 32 byte range of memory using dcbz
  1828. >    export Zero32Bytes[DS]
  1829. >    export .Zero32Bytes[PR]
  1830. >    toc
  1831. >    tc Zero32Bytes[TC], Zero32Bytes[DS]
  1832. >    csect Zero32Bytes[DS]
  1833. >    dc.l .Zero32Bytes[PR]
  1834. >    dc.l TOC[tc0]
  1835. >    dc.l 0
  1836. >    csect .Zero32Bytes[PR]
  1837. >    dcbz r0,r3 ;implicit r0=0
  1838. >    blr
  1839. > ---------------------------------
  1840. > (This file must be converted with BinHex 4.0)
  1841. > :$eTPFQmc-N*jG'9c,R-ZE`"B3dp'69"6)!%!!!!"L3!!!!#qA!(I!!+USJ#p!!!
  1842. > !QJ!!!!X!!!!!,R4PH(3!!!!!!!!!!!!!!!!!!!J!!!"N!!!!!!!!!!!!!!!!!!!
  1843. > !)#jNBA4K!!!!!!!!#!!!!!J!!!!3!!!!E!!!!(`!!!!!!!-!!!!!!%"m!"rX6S!
  1844. > !)!!!!!!!!!!8!!!!!!!!!!J!!!!)!!!!#4m!!!!!$!!!!!-I!!!!!"3!!!!((`"
  1845. > NBf*k,R-!!!!!!!$rrJ`"C`!!!!!!!!!!!!!!!!!!!3!!D`%!!!!!!!!!!!!!%3!
  1846. > !!!!!!!"86d-!!!!!!!!!!"3!!J!!D`%!!!!!!!!!!!!!%3m!!!!!!!!!!!!!!!!
  1847. > !"!!!!"3!!J!!D`%!!!!%!!!!!!!!%3-!!!!!!!!!!!!!!!!!%!!!!!J!!J!!!J%
  1848. > !!!!-!!!!!!!!%3S!!!!!!!!!!!!!!!!!(!!!!!!!!3!!!J%!!!!)!!!!!!!!%3!
  1849. > !!!!!!!!!!!!T@Q9bEc-b3RPdCA-!@Q9bEc-b3RPdCA-!,PTPFQmc-N*jG'9c!$e
  1850. > c!!!:
  1851. > ---------------------------------
  1852. > Be careful!  This is somewhat of a shotgun!  It zeros not the 32
  1853. > bytes starting at the pointer, but the 32 bytes *around* the
  1854. > pointer -- from p&~31 to p|31.  Make sure you don't want anything
  1855. > that's already there next to your array!
  1856. > *IF* your array is aligned to a 32-byte boundary AND each row is
  1857. > a multiple of 32 bytes long, then all you need to use this is
  1858. > (in C -- in C++ you'll need 'extern "C"'):
  1859. > ---------------------------------
  1860. > extern void Zero32Bytes(void *p);
  1861. > Byte  plane[maxX][maxY];
  1862. > for (i=0;i<maxX;i++)
  1863. >   for (j=0;j<maxY;j+=32)
  1864. >     Zero32Bytes(&plane[i][j]);
  1865. > ---------------------------------
  1866. > Hope this helps.
  1867. > Oh, yeah, if you try to use this on non-cachable memory (such as the
  1868. > video memory) you'll get an alignment exception trap.
  1869. > -- Bruce
  1870.  
  1871. I notice that you don't bother with the prologue/epilogue stuff. That's because
  1872. it don't use no local memory, and doesn't call any subroutines, right?
  1873.  
  1874. I tried to get Tim Olson's more robust zerobyte procedure to work with PPCAsm,
  1875. but I didn't understand his syntax. It looked like it was designed for an
  1876. assembler similar to, but not identical with, PPCAsm (the first time I tried to
  1877. assemble it, it had hundreds of errors).
  1878.  
  1879. BTW, I think that we should start compiling a list of useful assembly-language
  1880. routines to suppliment the less-than-perfect compilers that the PowerMac has
  1881. available. This could be tacked onto the end of Jon's Mac Programming FAQ, or
  1882. could (eventually) be kept separate.
  1883.  
  1884. The source code, the tool used to assemble it, and binhexed object code could
  1885. all be supplied.
  1886.  
  1887. Comments?
  1888.  
  1889.  
  1890.  
  1891. Lawson
  1892.  
  1893. +++++++++++++++++++++++++++
  1894.  
  1895. >From 103t_english@west.cscwc.pima.edu
  1896. Date: 21 Sep 94 08:40:32 MST
  1897. Organization: (none)
  1898.  
  1899. In article <CwDsvF.BIJ@attatl.AtlantaGA.NCR.COM>, Darrin Cardani <Darrin.Cardani@AtlantaGA.NCR.COM> writes:
  1900. >>In article <35i2cb$2ug@Times.Stanford.EDU> The Weasel writes: 
  1901. >>>In article <craig-1809940056260001@ckloeden.dialup.adelaide.edu.au>,
  1902. >>>craig@raru.adelaide.edu.au (Craig Kloeden) wrote:
  1903. >>>
  1904. >>>> I have the following piece of code:
  1905. >>>> Byte  plane[maxX][maxY];
  1906. >>>> for (i=0;i<maxX;i++)
  1907. >>>>   for (j=0;j<maxY;j++)
  1908. >>>>     plane[i][j] = 0;
  1909. >>>> 
  1910. >>>> Believe it or not, this is a bottleneck in my program.
  1911. >>>> I need to make this as fast as possible on the PPC.
  1912. >>>> Any advice would be appreciated.
  1913. >>
  1914. >>[ Good suggestions deleted ]
  1915. >>
  1916. >>Another things you might try is to allocate your memory in a single
  1917. >>continous block and running through it linearly. The array references
  1918. >>that you have above is sort of equivilant to:
  1919. >>
  1920. >>    plane[i * kMaxY + j] = ...
  1921. > What about
  1922. > Ptr plane;
  1923. > plane = NewPtrClear (maxX*maxY);
  1924. > Or is NewPtrClear not very efficient?
  1925. > Darrin
  1926.  
  1927. Only works the first time...
  1928.  
  1929.  
  1930.  
  1931. Lawson
  1932.  
  1933. +++++++++++++++++++++++++++
  1934.  
  1935. >From ari@world.std.com (Ari I Halberstadt)
  1936. Date: Thu, 22 Sep 1994 02:43:54 GMT
  1937. Organization: The World Public Access UNIX, Brookline, MA
  1938.  
  1939. In article <1994Sep21.083909@west.cscwc.pima.edu>,
  1940.  <103t_english@west.cscwc.pima.edu> wrote:
  1941. >BTW, I think that we should start compiling a list of useful assembly-language
  1942. >routines to suppliment the less-than-perfect compilers that the PowerMac has
  1943. >available. This could be tacked onto the end of Jon's Mac Programming FAQ, or
  1944. >could (eventually) be kept separate.
  1945. >
  1946. >The source code, the tool used to assemble it, and binhexed object code could
  1947. >all be supplied.
  1948.  
  1949. This is what the newsgroup alt.sources.mac is for. It's still
  1950. premature to consider splitting it into alt.sources.mac.ppc, since
  1951. most of the traffic seems to be from people unclear on the purpose of
  1952. alt.sources.mac. The archive sites should probably add a "dev/src/ppc"
  1953. directory; you might suggest this to the info-mac folks and other
  1954. major sites. The FAQ could contain a specific pointer to the various
  1955. places to find these PPC goodies.
  1956. -- 
  1957. Ari Halberstadt                                 ari@world.std.com
  1958. One generation passes away, and another generation comes: but the
  1959. earth abides for ever. -- Ecclesiastes, 1:4.
  1960.  
  1961. +++++++++++++++++++++++++++
  1962.  
  1963. >From craig@raru.adelaide.edu.au (Craig Kloeden)
  1964. Date: Fri, 23 Sep 1994 09:21:46 +0930
  1965. Organization: University of Adelaide
  1966.  
  1967. In article <CwEpn5.A00@world.std.com>, ari@world.std.com (Ari I
  1968. Halberstadt) wrote:
  1969. > >> Byte  plane[maxX][maxY];
  1970. > >> 
  1971. > >> for (i=0;i<maxX;i++)
  1972. > >>   for (j=0;j<maxY;j++)
  1973. > >>     plane[i][j] = 0;
  1974. > >The quality of code generation doesn't matter much here -- it's all
  1975. > >in how efficiently you bash the memory subsystem.
  1976. > Actually, the quality of code generation is quite important. Compilers
  1977. > can do all sorts of tricks to speed up loops like the above. Things
  1978. > that are often done manually, such as loop unrolling, pointer
  1979. > arithmetic, common subexpression elimination, etc. can all be handled
  1980. > by the compiler. And the compiler may be better suited to make decisions
  1981. > on pipelining instructions for a RISC processor.
  1982. > What the original poster needs is to zero a block of memory of maxY by
  1983. > maxX bytes. The simple call memset(p,0,n) is almost always sufficient
  1984. > and it's portable. Assuming the compiler's optimizer or implementation
  1985. > of memset is pathetic, he can hand-code all sorts of optimizations,
  1986. > most of which have already been suggested.  One other way to unroll a
  1987. > loop is to use a fancy (or obscure, take your pick) switch statement;
  1988. > most C texts have it as an exercise in "what does this do", but I
  1989. > don't know if it really is any faster than a more obvious loop
  1990. > unrolling. The use of a dedicated processor instruction (as suggested
  1991. > by Bruce) along with the other optimizations should result in a
  1992. > memory-zeroing routine that is as fast as can be made.
  1993. > Further optimizations would have to examine the need for the zeroed
  1994. > memory.
  1995. > Does the memory have to be zeroed, or is it just being filled up with
  1996. > data later on that don't need to be zeroed initially?
  1997.  
  1998. It has to be filled to zero.
  1999.  
  2000. > Is the array being used to represent a data structure that would be
  2001. > better represented in some other form?
  2002.  
  2003. Represents the screen. Well actually it is for keeping a record of the
  2004. 'depth' of the last plotted pixel to that location. (for hidden point
  2005. removal in displaying 3d images.
  2006.  
  2007. > Is the algorithm written in such a way that the memory zeroing code is
  2008. > being called more than may be necessary?
  2009.  
  2010. Only once per frame :-)
  2011.  
  2012. > Could the memory be zeroed in small chunks over time, rather than all
  2013. > at once? You could spawn a thread to do the zeroing, and run it in the
  2014. > background while the user is figuring out which buttons to click.
  2015.  
  2016. nope. i need it straight away
  2017.  
  2018. Here are some rough benchmarks that I ran. (using CW4)
  2019.  
  2020. Time      Method
  2021. - --      ------
  2022. 1033      Clearing Individual Bytes
  2023.  270      Clearing 1 long at a time
  2024.  249      memset()
  2025.  226      Clearing 2 longs at a time (unrolled loop)
  2026.  213      Clearing 3 longs at a time (unrolled loop)
  2027.  204      Clearing 4 longs at a time (unrolled loop)
  2028.   55      bzero*
  2029.  
  2030. * bzero is an XCOFF written by tim@apple.com (Tim Olson)
  2031.   posted recently to comp.sys.powerpc
  2032.   assumes cacheable memory (i.e. uses DCBZ)
  2033.   assumes 32-byte cache block/sector (works on 601, 603, 604)
  2034.  
  2035. The rest of my code uses 386 units of time (best case) so all
  2036. but the last significantly cuts into my frame rate.
  2037. Guess which one i am using :-)
  2038.  
  2039. regards and thanks
  2040.  
  2041. Craig
  2042.  
  2043. ps. the program i am working on with source is at:
  2044. ftp://raru.adelaide.edu.au/rotater/
  2045.  
  2046. -- 
  2047. Craig Kloeden                 E-mail: craig@raru.adelaide.edu.au
  2048. Road Accident Research Unit   Phone : +61 8 303 5885
  2049. The University of Adelaide    Fax   : +61 8 232 4995
  2050. Australia                     Disclaimer: Not this little black duck!
  2051.  
  2052. +++++++++++++++++++++++++++
  2053.  
  2054. >From al@crucible.powertools.com (Al Evans)
  2055. Date: 23 Sep 94 14:41:45 GMT
  2056. Organization: PowerTools, Austin, Texas
  2057.  
  2058. In article <1994Sep20.023052.26490@adobe.com> zstern@adobe.com (Zalman Stern) writes:
  2059.  
  2060. >> use
  2061. >>     BlockMoveData(inittedMaster, plane, maxX * maxY);
  2062. >> To rapidly initialize the "real" plane. 
  2063.  
  2064. >This is a bad answer as it takes approximately twice the memory bandwidth.  
  2065. >(And introduces another read latency into a conceptually write only  
  2066. >operation.) To put it mildly, there is a reason you haven't this mentioned  
  2067. >yet.
  2068.  
  2069. Oops. Obviously, you're right. I can only plead brain-fade, and the
  2070. fact that I was thinking of a case where the memory in question had
  2071. to be initialized to something more complex than all zeros.
  2072.  
  2073.                     --Al Evans--
  2074. -- 
  2075. Al Evans        |   Graphic Elements: A new standard for 
  2076. ________________________|__ high-performance interactive Macintosh graphics.
  2077. al@crucible.powertools.com |  Available from mac.archive.umich.edu
  2078. - -------------------------| /mac/development/libraries/graphicelements2.sit.hqx
  2079.  
  2080. +++++++++++++++++++++++++++
  2081.  
  2082. >From usenet@lowry.eche.ualberta.ca (Brian Lowry)
  2083. Date: Fri, 23 Sep 1994 10:38:08 -0800
  2084. Organization: Dept. of Chemical Eng., University of Alberta
  2085.  
  2086. In article <craig-2309940921460001@ckloeden.dialup.adelaide.edu.au>,
  2087. craig@raru.adelaide.edu.au (Craig Kloeden) wrote:
  2088.  
  2089. > Here are some rough benchmarks that I ran. (using CW4)
  2090.  
  2091. > Time      Method
  2092. > ----      ------
  2093. > 1033      Clearing Individual Bytes
  2094. >  270      Clearing 1 long at a time
  2095. >  249      memset()
  2096. >  226      Clearing 2 longs at a time (unrolled loop)
  2097. >  213      Clearing 3 longs at a time (unrolled loop)
  2098. >  204      Clearing 4 longs at a time (unrolled loop)
  2099. >   55      bzero*
  2100.  
  2101. > * bzero is an XCOFF written by tim@apple.com (Tim Olson)
  2102. >   posted recently to comp.sys.powerpc
  2103. >   assumes cacheable memory (i.e. uses DCBZ)
  2104. >   assumes 32-byte cache block/sector (works on 601, 603, 604)
  2105.  
  2106. Did you try something like:
  2107. //plane is a 2D array of bytes
  2108. //N = (xMax * yMax) / 8;
  2109.  
  2110. register double dblZero = +0.0;
  2111. register double *doubleP;
  2112.  
  2113. for (i=N, doubleP = &plane[maxX][maxY]; i>0; i--)
  2114. {  *(--doubleP) = dblZero;}
  2115.  
  2116. I believe a double precision zero is a 64bit zero, and that this takes
  2117. fewer clock cycles than writing longs (but I could be wrong).  Just
  2118. curious how it might compare...
  2119.  
  2120. -- 
  2121.  
  2122. Brian Lowry
  2123.  
  2124. +++++++++++++++++++++++++++
  2125.  
  2126. >From 103t_english@west.cscwc.pima.edu
  2127. Date: 23 Sep 94 18:42:15 MST
  2128. Organization: (none)
  2129.  
  2130. In article <usenet-2309941038080001@lowry.eche.ualberta.ca>, usenet@lowry.eche.ualberta.ca (Brian Lowry) writes:
  2131. > In article <craig-2309940921460001@ckloeden.dialup.adelaide.edu.au>,
  2132. > craig@raru.adelaide.edu.au (Craig Kloeden) wrote:
  2133. >> Here are some rough benchmarks that I ran. (using CW4)
  2134. [deleted]
  2135. > Did you try something like:
  2136. > //plane is a 2D array of bytes
  2137. > //N = (xMax * yMax) / 8;
  2138. > register double dblZero = +0.0;
  2139. > register double *doubleP;
  2140. > for (i=N, doubleP = &plane[maxX][maxY]; i>0; i--)
  2141. > {  *(--doubleP) = dblZero;}
  2142. > I believe a double precision zero is a 64bit zero, and that this takes
  2143. > fewer clock cycles than writing longs (but I could be wrong).  Just
  2144. > curious how it might compare...
  2145. >        
  2146.  
  2147. Come on Brian, even *I* know that 8-byte floating-point writes take 3 cycles
  2148. while the 4-byte store takes 1 cycle (allowing for pipelining, etc -best case).
  2149.  
  2150. The only time that the double store is better is on non-cached memory like
  2151. VRAM, where the bus interface is your biggest problem.
  2152.  
  2153. Your scheme is good for zeroing video.
  2154.  
  2155.  
  2156. (Gorsh! I almost sound like a know what I'm talking about... I hope I didn't
  2157. mangle what everyone else has told me too badly)
  2158.  
  2159.  
  2160. Lawson
  2161.  
  2162. +++++++++++++++++++++++++++
  2163.  
  2164. >From Bruce@hoult.actrix.gen.nz (Bruce Hoult)
  2165. Date: Sun, 25 Sep 1994 12:57:26 +1200 (NZST)
  2166. Organization: (none)
  2167.  
  2168. ari@world.std.com (Ari I Halberstadt) writes:
  2169. > >> Byte  plane[maxX][maxY];
  2170. > >> 
  2171. > >> for (i=0;i<maxX;i++)
  2172. > >>   for (j=0;j<maxY;j++)
  2173. > >>     plane[i][j] = 0;
  2174. > >> 
  2175. > >> ---
  2176. > >> 
  2177. > >> Believe it or not, this is a bottleneck in my program.
  2178. > >> I need to make this as fast as possible on the PPC.
  2179. > >> 
  2180. > >> Any advice would be appreciated.
  2181. > >
  2182. > >The quality of code generation doesn't matter much here -- it's all
  2183. > >in how efficiently you bash the memory subsystem.
  2184. > Actually, the quality of code generation is quite important. Compilers
  2185. > can do all sorts of tricks to speed up loops like the above. Things
  2186. > that are often done manually, such as loop unrolling, pointer
  2187. > arithmetic, common subexpression elimination, etc. can all be handled
  2188. > by the compiler. And the compiler may be better suited to make decisions
  2189. > on pipelining instructions for a RISC processor.
  2190.  
  2191. I stand by my original statement -- the quality of code generation in this
  2192. loop matters not at all.
  2193.  
  2194. A 60 MHz PPC 601 is capable of writing into its cache RAM at 240 MB/sec.
  2195. A PowerMac 6100/60 has a memory subsystem capable of copying about
  2196. 20 MB/sec (using BlockMoveData, for instance).
  2197.  
  2198. This huge discrepency (a factor of more than 10:1) means that it virtually
  2199. doesn't matter if your program uses ten instructions where one would have
  2200. been enough -- assuming that you are wanting to zero a block of memory
  2201. that is larger than your cache.
  2202.  
  2203. Loop unrolling, pointer arithmetic, common subexpression elimination -- none
  2204. of these matter in this case.  I'm perfectly capable of using these when
  2205. they help -- and you'll often see me advocate such things here.
  2206.  
  2207. This is not one of those times.
  2208.  
  2209. What *does* help, and help more than anything you suggested, is to tell the
  2210. processor that it doesn't have to read the memory before it writes new
  2211. contents to it.  This results in an instant doubling of speed.
  2212.  
  2213. You've got to understand what's going on, not just blindly apply the same
  2214. trick in every case.
  2215.  
  2216. -- Bruce
  2217.  
  2218. ---------------------------
  2219.  
  2220. >From mhlee@hsc.usc.edu (Marianne Lee)
  2221. Subject: Inside Mac on CD-ROM
  2222. Date: 16 Sep 1994 04:58:51 -0700
  2223. Organization: University of Southern California, Los Angeles, CA
  2224.  
  2225. I want to start programming on the Mac soon and so I ordered the new
  2226. Inside Macintosh on CD-ROM.  It seems like a great deal because it has
  2227. all the info of the current Inside Macs at a fraction of the price.
  2228. One of my friends told me that with 7.5 out now, the old Inside Macs
  2229. might get out of date soon.  Is it worth it to get this CD-ROM then?
  2230.  
  2231. +++++++++++++++++++++++++++
  2232.  
  2233. >From plsuh@econ.sas.upenn.edu (Paul L. Suh)
  2234. Date: Fri, 16 Sep 1994 11:00:38 -0400
  2235. Organization: UPenn Grad Econ
  2236.  
  2237. In article <35c19r$7vt@hsc.usc.edu>, mhlee@hsc.usc.edu (Marianne Lee) wrote:
  2238.  
  2239. > I want to start programming on the Mac soon and so I ordered the new
  2240. > Inside Macintosh on CD-ROM.  It seems like a great deal because it has
  2241. > all the info of the current Inside Macs at a fraction of the price.
  2242. > One of my friends told me that with 7.5 out now, the old Inside Macs
  2243. > might get out of date soon.  Is it worth it to get this CD-ROM then?
  2244.  
  2245. Actually, the thing to do is subscribe to the APDA monthly developer
  2246. mailing.  It includes quarterly issues of Develop magazine, plus monthly
  2247. CD-ROMs.  The CD-ROMs are of 3 types: System Software, Toolkit, and
  2248. Reference Library.  They are sent out one per month on a rotating basis. 
  2249. In particular, the Ref Lib CD has the entire new IM plus all of the
  2250. current Tech Notes.  Since this is updated every three months, you'll
  2251. never have to worry about being out of date!  
  2252.  
  2253.  
  2254. --Paul
  2255.  
  2256. +++++++++++++++++++++++++++
  2257.  
  2258. >From aaron_bratcher@fpm.uchicago.edu (Aaron Bratcher)
  2259. Date: Fri, 16 Sep 1994 18:20:03 GMT
  2260. Organization: University of Chicago
  2261.  
  2262. In article <plsuh-1609941100380001@ts3-26.upenn.edu>,
  2263. plsuh@econ.sas.upenn.edu (Paul L. Suh) wrote:
  2264.  
  2265. > Actually, the thing to do is subscribe to the APDA monthly developer
  2266. > mailing.  It includes quarterly issues of Develop magazine, plus monthly
  2267. > CD-ROMs.  The CD-ROMs are of 3 types: System Software, Toolkit, and
  2268. > Reference Library.  They are sent out one per month on a rotating basis. 
  2269. > In particular, the Ref Lib CD has the entire new IM plus all of the
  2270. > current Tech Notes.  Since this is updated every three months, you'll
  2271. > never have to worry about being out of date!  
  2272. > --Paul
  2273.  
  2274. I thought it was stated on this channel that the monthly mailings were not
  2275. going to include the new IM any more.
  2276.  
  2277. -- 
  2278. Aaron L. Bratcher
  2279. University of Chicago
  2280.  
  2281. aaron_bratcher@fpm.uchicago.edu
  2282.  
  2283. +++++++++++++++++++++++++++
  2284.  
  2285. >From alyx@apple.com (alyx)
  2286. Date: Fri, 16 Sep 1994 21:03:06 GMT
  2287. Organization: Apple Computer, Inc.
  2288.  
  2289. In article <aaron_bratcher-1609941320030001@fpm-mac-17.uchicago.edu>,
  2290. aaron_bratcher@fpm.uchicago.edu (Aaron Bratcher) wrote:
  2291.  
  2292. > In article <plsuh-1609941100380001@ts3-26.upenn.edu>,
  2293. > plsuh@econ.sas.upenn.edu (Paul L. Suh) wrote:
  2294. > > Actually, the thing to do is subscribe to the APDA monthly developer
  2295. > > mailing.  [...]
  2296. > I thought it was stated on this channel that the monthly mailings were not
  2297. > going to include the new IM any more.
  2298.  
  2299. The _Developer CD Series_ will continue to include the complete IM.  The
  2300. _develop magazine Bookmark CD_ will contain a core set (Files, Memory, TB,
  2301. More TB, Imaging w/QD) and rotate through the rest a couple at a time.
  2302.  
  2303. +++++++++++++++++++++++++++
  2304.  
  2305. >From temple@itd.nrl.navy.mil (Dr. Jon Gerard Temple)
  2306. Date: 17 Sep 1994 03:49:01 GMT
  2307. Organization: Naval Research Laboratory
  2308.  
  2309. In article <alyx-1609941403050001@kip-61.apple.com>
  2310. alyx@apple.com (alyx) writes:
  2311.  
  2312. > In article <aaron_bratcher-1609941320030001@fpm-mac-17.uchicago.edu>,
  2313. > aaron_bratcher@fpm.uchicago.edu (Aaron Bratcher) wrote:
  2314. > > In article <plsuh-1609941100380001@ts3-26.upenn.edu>,
  2315. > > plsuh@econ.sas.upenn.edu (Paul L. Suh) wrote:
  2316. > > 
  2317. > > > Actually, the thing to do is subscribe to the APDA monthly developer
  2318. > > > mailing.  [...]
  2319. > > 
  2320. > > I thought it was stated on this channel that the monthly mailings were not
  2321. > > going to include the new IM any more.
  2322. > > 
  2323. > The _Developer CD Series_ will continue to include the complete IM.  The
  2324. > _develop magazine Bookmark CD_ will contain a core set (Files, Memory, TB,
  2325. > More TB, Imaging w/QD) and rotate through the rest a couple at a time.
  2326.  
  2327.  
  2328. Folks: You can always just backorder the Develop Bookmark CD issue #17
  2329. for $13, direct from d e v e l o p. (They even have a 1-800 toll free
  2330. number :) It has the complete New Inside Mac collection on it.  I did
  2331. this and thus was not affected by Develop's decision to leave them off
  2332. of newer BookMark CDs (my subscription began with issue #18, the first
  2333. one that was affected).  The last I checked, $13 was quite a bit less
  2334. than the $99 that will be charged for the new CD.  It's a great deal!
  2335.  
  2336. +++++++++++++++++++++++++++
  2337.  
  2338. >From mhlee@hsc.usc.edu (Marianne Lee)
  2339. Date: 16 Sep 1994 22:16:11 -0700
  2340. Organization: University of Southern California, Los Angeles, CA
  2341.  
  2342. temple@itd.nrl.navy.mil (Dr. Jon Gerard Temple) writes:
  2343.  
  2344. >Folks: You can always just backorder the Develop Bookmark CD issue #17
  2345. >for $13, direct from d e v e l o p. (They even have a 1-800 toll free
  2346. >number :) It has the complete New Inside Mac collection on it.  I did
  2347. >this and thus was not affected by Develop's decision to leave them off
  2348. >of newer BookMark CDs (my subscription began with issue #18, the first
  2349. >one that was affected).  The last I checked, $13 was quite a bit less
  2350. >than the $99 that will be charged for the new CD.  It's a great deal!
  2351.  
  2352. So is there any new stuff or anything useful in the new CD?  Why would
  2353. Apple release such a thing if it were already available at $13?  Is it
  2354. purely marketing?
  2355.  
  2356. BTW, when is the next develop issue coming out?  I ordered a subscription
  2357. last month and was wondering when the I'm going to get the first one.
  2358.  
  2359. +++++++++++++++++++++++++++
  2360.  
  2361. >From neil_ticktin@xplain.com (Neil Ticktin)
  2362. Date: Sun, 18 Sep 1994 18:54:02 GMT
  2363. Organization: MacTech Magazine/Xplain Corporation
  2364.  
  2365. In article <35c19r$7vt@hsc.usc.edu>, mhlee@hsc.usc.edu (Marianne Lee) wrote:
  2366.  
  2367. >> I want to start programming on the Mac soon and so I ordered the new
  2368. >> Inside Macintosh on CD-ROM.  It seems like a great deal because it has
  2369. >> all the info of the current Inside Macs at a fraction of the price.
  2370. >> One of my friends told me that with 7.5 out now, the old Inside Macs
  2371. >> might get out of date soon.  Is it worth it to get this CD-ROM then?
  2372.  
  2373. Marianne,
  2374.  
  2375. You've gotten many positive comments on the develop Bookmark CD.  Let me
  2376. give you some other bits of information.  You can order develop and
  2377. related things through APDA. Here are some addresses and phone numbers you
  2378. may find useful:
  2379.  
  2380. To recieve an APDA catalog (development tools and documentation):
  2381.   APDA
  2382.   P.O. Box 319
  2383.   Buffalo, NY  14207-0319
  2384.   Phone: 1 800 282-2732 (U.S.A.)
  2385.          1 800 637-0029 (Canada)
  2386.          716 871-6555 (international)
  2387.          716 871-6511 (FAX)
  2388.   AppleLink: APDA
  2389.   E-Mail: apda@applelink.apple.com
  2390.   CompuServe: 76666,2405
  2391.  
  2392. In addition, there's a CD from Addison-Wesley that is shortly going to
  2393. ship (if it isn't already).  This will contain all of the New IM volumes
  2394. (as I understand it).  I believe it is priced in the $80-130 price range. 
  2395. This is a DocViewer type CD and doesn't really have searching or hypertext
  2396. capabilities.
  2397.  
  2398. Finally, there's THINK Reference by Symantec.  TR is the _old_ Inside
  2399. Macintosh Volumes 1-6.  If you are going to do "standard" Macintosh
  2400. programming and not take advantage of anything beyond the basic System 7
  2401. technologies, this will cover what you need.  The best part about TR is it
  2402. extensive hyperlinks and searching -- far better than any other solution
  2403. today.
  2404.  
  2405. If you want more info on the Bookmark CD, call APDA.  If you want more
  2406. info on the AW CD, you can get that from APDA or our mail order dept.  If
  2407. you want TR, you can get it at your local dealer, or you can buy our
  2408. MacTech CD which has TR bundled with it.  Our customer service dept can
  2409. help you with anything from our Mail Order Dept.
  2410.  
  2411. Hope it helps,
  2412.  
  2413. Neil Ticktin
  2414. MacTech Magazine
  2415.  
  2416. - ---------------------------------------------------------------------
  2417.            Neil Ticktin, MacTech Magazine (formerly MacTutor)
  2418. PO Box 250055, Los Angeles, CA 90025 * 310-575-4343 * Fax: 310-575-0925
  2419.  For more info, anonymous ftp to ftp.netcom.com and cd to /pub/xplain
  2420.   custservice@xplain.com * editorial@xplain.com * adsales@xplain.com
  2421. marketing@xplain.com * accounting@xplain.com * pressreleases@xplain.com
  2422.    progchallenge@xplain.com * publisher@xplain.com * info@xplain.com
  2423.  
  2424. +++++++++++++++++++++++++++
  2425.  
  2426. >From mhlee@hsc.usc.edu (Marianne Lee)
  2427. Date: 18 Sep 1994 11:30:50 -0700
  2428. Organization: University of Southern California, Los Angeles, CA
  2429.  
  2430. neil_ticktin@xplain.com (Neil Ticktin) writes:
  2431. >In addition, there's a CD from Addison-Wesley that is shortly going to
  2432. >ship (if it isn't already).  This will contain all of the New IM volumes
  2433. >(as I understand it).  I believe it is priced in the $80-130 price range. 
  2434. >This is a DocViewer type CD and doesn't really have searching or hypertext
  2435. >capabilities.
  2436.  
  2437. No searching or hypertext on the NIM CD?  How about the IMs on the develop
  2438. CDs, do they have any type of indexing or easy way to look up things?
  2439.  
  2440. Just a question, how many of you would prefer the NIM CD over having the
  2441. develop version?  Buying develops 17 through 19 and getting a subscription
  2442. (which I will be doing anyway) is still cheaper than one NIM CD.
  2443.  
  2444. +++++++++++++++++++++++++++
  2445.  
  2446. >From nick+@pitt.edu ( nick.c )
  2447. Date: Mon, 19 Sep 94 11:53:45 GMT
  2448. Organization: The Pitt, Chemistry
  2449.  
  2450. In Article <35i10q$s6n@hsc.usc.edu>, mhlee@hsc.usc.edu (Marianne Lee) wrote:
  2451. >neil_ticktin@xplain.com (Neil Ticktin) writes:
  2452.  
  2453. >>In addition, there's a CD from Addison-Wesley that is shortly going to
  2454. >>ship (if it isn't already).  This will contain all of the New IM volumes
  2455. >>(as I understand it).  I believe it is priced in the $80-130 price range. 
  2456. >>This is a DocViewer type CD and doesn't really have searching or hypertext
  2457. >>capabilities.
  2458. >
  2459. >No searching or hypertext on the NIM CD?  How about the IMs on the develop
  2460. >CDs, do they have any type of indexing or easy way to look up things?
  2461. >
  2462. >Just a question, how many of you would prefer the NIM CD over having the
  2463. >develop version?  Buying develops 17 through 19 and getting a subscription
  2464. >(which I will be doing anyway) is still cheaper than one NIM CD.
  2465.  
  2466.     The CD Neil mentions is starting at $99, available from 
  2467.       SoftPro at 1-617-273-2919 (it was pre-orderable from
  2468.       macworld for $80, and will eventually sell for $150).
  2469.  
  2470.     It will have indexes and searching, but nothing as exntensive
  2471.       and the Think Reference hyperlinks.  It's identical to
  2472.       those on the develop CD's.
  2473.  
  2474.     I think we'd all prefer to have as many of the NIM on one
  2475.       CD as possible.  The question is: is it worth the extra $99.
  2476.       Personally, I'm going to pass on the Addison Wesley CD,
  2477.       I already have the _develop_ CD's, but I'm sure some folks
  2478.       will find $99 worth it to have all the info on one, rather
  2479.       than 5 CD's.  Note another option is a subscription to
  2480.       the Developer mailing.  For $250, you'll get 12 disks a
  2481.       year including ones with all the NIM on one disk, and 
  2482.       System 7.5.  That alone makes it tempting, the additional
  2483.       system enhancements, reference literature, and development
  2484.       tools make it a pretty good deal.
  2485.  
  2486.                                             -- nick
  2487.  
  2488.  
  2489.  
  2490.                                     _/   _/  _/  _/_/_/   _/   _/  
  2491.      Interet: nick@pitt.edu        _/_/ _/  _/  _/   _/  _/_/_/    
  2492.       eWorld: nick                _/ _/_/  _/  _/       _/ _/      
  2493.          CIS: 71232,766          _/   _/  _/   _/_/_/  _/   _/     
  2494.  
  2495.  
  2496. +++++++++++++++++++++++++++
  2497.  
  2498. >From neil_ticktin@xplain.com (Neil Ticktin)
  2499. Date: Tue, 20 Sep 1994 03:55:10 GMT
  2500. Organization: MacTech Magazine/Xplain Corporation
  2501.  
  2502. In article <35i10q$s6n@hsc.usc.edu>, mhlee@hsc.usc.edu (Marianne Lee) wrote:
  2503.  
  2504. >> No searching or hypertext on the NIM CD?  How about the IMs on the develop
  2505. >> CDs, do they have any type of indexing or easy way to look up things?
  2506.  
  2507. Marianne,
  2508.  
  2509. I'm not 100% sure on this.  If I understood some previous comments,
  2510. there's searching within an individual document, but that's it.  There's
  2511. no real indexing or searching mechanism across documents.  Hopefully,
  2512. someone will correct me if I'm wrong -- but that's how I understand it.
  2513.  
  2514. Good luck,
  2515.  
  2516. Neil
  2517.  
  2518. - ---------------------------------------------------------------------
  2519.            Neil Ticktin, MacTech Magazine (formerly MacTutor)
  2520. PO Box 250055, Los Angeles, CA 90025 * 310-575-4343 * Fax: 310-575-0925
  2521.  For more info, anonymous ftp to ftp.netcom.com and cd to /pub/xplain
  2522.   custservice@xplain.com * editorial@xplain.com * adsales@xplain.com
  2523. marketing@xplain.com * accounting@xplain.com * pressreleases@xplain.com
  2524.    progchallenge@xplain.com * publisher@xplain.com * info@xplain.com
  2525.  
  2526. +++++++++++++++++++++++++++
  2527.  
  2528. >From dkj@apple.com (Dave Johnson)
  2529. Date: Tue, 20 Sep 1994 22:07:33 GMT
  2530. Organization: Apple Computer
  2531.  
  2532. In article <neil_ticktin-1909941955100001@xplain.slip.netcom.com>,
  2533. neil_ticktin@xplain.com (Neil Ticktin) wrote:
  2534.  
  2535. > I'm not 100% sure on this.  If I understood some previous comments,
  2536. > there's searching within an individual document, but that's it.  There's
  2537. > no real indexing or searching mechanism across documents.  Hopefully,
  2538. > someone will correct me if I'm wrong -- but that's how I understand it.
  2539.  
  2540. Since the books are all in DoicViewer format, there is good searching
  2541. within and across all the books. Using the collections feature in
  2542. Docviewer in combination with the query command can be very powerful. Any
  2543. DocViewer users out there who don't know about collections and/or Query
  2544. should check it (them) out.
  2545.  
  2546. Of course, this is true for ANY set of DocViewer documents, not just the NIM CD.
  2547.  
  2548. Dave Johnson
  2549.  
  2550. +++++++++++++++++++++++++++
  2551.  
  2552. >From hrody@ingr.com (H. M. Rody)
  2553. Date: Wed, 21 Sep 1994 07:51:08 -0500
  2554. Organization: Intergraph Corporation
  2555.  
  2556. In article <neil_ticktin-1909941955100001@xplain.slip.netcom.com>,
  2557. neil_ticktin@xplain.com (Neil Ticktin) wrote:
  2558.  
  2559. > In article <35i10q$s6n@hsc.usc.edu>, mhlee@hsc.usc.edu (Marianne Lee) wrote:
  2560. > >> No searching or hypertext on the NIM CD?  How about the IMs on the develop
  2561. > >> CDs, do they have any type of indexing or easy way to look up things?
  2562. > Marianne,
  2563. > I'm not 100% sure on this.  If I understood some previous comments,
  2564. > there's searching within an individual document, but that's it.  There's
  2565. > no real indexing or searching mechanism across documents.  Hopefully,
  2566. > someone will correct me if I'm wrong -- but that's how I understand it.
  2567.  
  2568. I too believe that this is true.  I am currently programming on NT and Mac
  2569. and I have found that the the layout of the Microsoft CDs as far as search
  2570. is far better that on the Developer CDs.  The search engines on the 
  2571. Microsoft CDs can search the whole CD or parts.  This is an area that
  2572. Apple can definately improve on.
  2573.  
  2574. What about integrating Apple Search into their own CD?  Apple Search looks
  2575. like an excellent product.
  2576.  
  2577. -- 
  2578. - ----------------------------------------------------------------------
  2579. Marshall Rody                            | Intergraph Corporation
  2580. UUCP:     ...uunet!ingr!infonode!hrody   | One Madison Industrial Park
  2581. INTERNET: hrody@ingr.com                 | Mail Stop GD3002
  2582. AT&T:     (205) 730-3748                 | Huntsville, AL  35807-4201
  2583.  
  2584. +++++++++++++++++++++++++++
  2585.  
  2586. >From alyx@apple.com (alyx)
  2587. Date: Wed, 21 Sep 1994 17:15:51 GMT
  2588. Organization: Apple Computer, Inc.
  2589.  
  2590. In article <neil_ticktin-1809941054020001@xplain.slip.netcom.com>,
  2591. the usually better-informed neil_ticktin@xplain.com (Neil Ticktin) wrote:
  2592.  
  2593. > This is a DocViewer type CD and doesn't really have searching [...]
  2594. > capabilities.
  2595.  
  2596. oh, please.  it's called "Query".  RTFM!!
  2597.  
  2598. +++++++++++++++++++++++++++
  2599.  
  2600. >From doumakes@netcom.com (Don Doumakes)
  2601. Date: Mon, 26 Sep 1994 16:41:00 GMT
  2602. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  2603.  
  2604. Sorry for the repetition, folks.  Problem with my offline reader.
  2605.  
  2606. --
  2607. ______________________________________________________________________
  2608. Don Doumakes                                       doumakes@netcom.com
  2609.  
  2610. ---------------------------
  2611.  
  2612. >From bb@lightside.com (Bob Bradley)
  2613. Subject: Q: Using PPC apps without Shared Libraries?
  2614. Date: Mon, 26 Sep 1994 15:00:39 -0800
  2615. Organization: SS Software Inc.
  2616.  
  2617. I noticed that every application that uses a shared library (including my
  2618. own) will not launch if that shared library cannot be found. Is there any
  2619. way around this?
  2620.  
  2621. I'm using the Thread Manager on a PowerPC in my application and have the
  2622. appropriate checks in my application to tell whether or not the Thread
  2623. Manager is available and if not, it uses non-Thread Manager code to still
  2624. function (it is limited if not using the Thread Manager). The problem is
  2625. my code never gets a chance to run since the system says it couldn't find
  2626. the ThreadsLib (when the extension isn't loaded). 
  2627.  
  2628. The System doesn't appear to be very thorough in it's search for the
  2629. library either since another application that requires QuickTime wouldn't
  2630. run even when QuickTime was installed. I tried copying the QuickTimeLib 
  2631. and it still didn't work until I re-installed QuickTime.
  2632.  
  2633. +++++++++++++++++++++++++++
  2634.  
  2635. >From jwbaxter@olympus.net (John W. Baxter)
  2636. Date: Wed, 28 Sep 1994 07:49:01 -0700
  2637. Organization: Internet for the Olympic Peninsula
  2638.  
  2639. In article <bb-2609941500390001@user48.lightside.com>, bb@lightside.com
  2640. (Bob Bradley) wrote:
  2641.  
  2642. > I noticed that every application that uses a shared library (including my
  2643. > own) will not launch if that shared library cannot be found. Is there any
  2644. > way around this?
  2645. > I'm using the Thread Manager on a PowerPC in my application and have the
  2646. > appropriate checks in my application to tell whether or not the Thread
  2647. > Manager is available and if not, it uses non-Thread Manager code to still
  2648. > function (it is limited if not using the Thread Manager). The problem is
  2649. > my code never gets a chance to run since the system says it couldn't find
  2650. > the ThreadsLib (when the extension isn't loaded). 
  2651. > The System doesn't appear to be very thorough in it's search for the
  2652. > library either since another application that requires QuickTime wouldn't
  2653. > run even when QuickTime was installed. I tried copying the QuickTimeLib 
  2654. > and it still didn't work until I re-installed QuickTime.
  2655.  
  2656. There are two ways to link code which uses routines from a PPC shared
  2657. library.  One is as you describe (a "hard" link), and the Code Fragment
  2658. Manager refuses to proceed if a library so linked is not present at the
  2659. time the fragment is prepared.  The other is the "soft" link...in this
  2660. case the absence of a needed library causes references into that library
  2661. to be resolved by CFM into a magic value which will cause an error when
  2662. the reference is later used.  It is then up to the using code to protect
  2663. itself before using such a reference.
  2664.  
  2665. See Inside Mac: Power PC System Software.
  2666.  
  2667. There is a case you need to protect against, which means that with most
  2668. shared libraries, merely checking Gestalt is not safe enough.  Suppose the
  2669. needed library is present at startup time.  The Gestalt selector gets set
  2670. up on that basis.  The user drags the Shared Library out of the Extensions
  2671. folder and then starts your app.  CFM sees the absence of the library, and
  2672. does its magic value thing.  In many cases though, your app's check of
  2673. Gestalt suggests that the library is present because the feature it
  2674. implements is available.
  2675.  
  2676. HOW you do a soft link depends on which development environment you use. 
  2677. MPW and CodeWarrior can do it.  --John
  2678.  
  2679. -- 
  2680. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  2681.    "Occasionally...astronomers add a second to either June 31 or
  2682.     December 31..."   IM: OS Utilities, p 4-12
  2683.    jwbaxter@pt.olympus.net
  2684.  
  2685. +++++++++++++++++++++++++++
  2686.  
  2687. >From h+@nada.kth.se (Jon W{tte)
  2688. Date: Wed, 28 Sep 1994 15:40:30 +0100
  2689. Organization: Royal Institute of Something or other
  2690.  
  2691. In article <bb-2609941500390001@user48.lightside.com>,
  2692. bb@lightside.com (Bob Bradley) wrote:
  2693.  
  2694. >I noticed that every application that uses a shared library (including my
  2695. >own) will not launch if that shared library cannot be found. Is there any
  2696. >way around this?
  2697.  
  2698. Yes:
  2699.  
  2700. 1) Indlude the shared library with your application
  2701.  
  2702. or
  2703.  
  2704. 2) Import the library "weakly" - in CodeWarrior, it's a flag in 
  2705. the project window popup menu for the file.
  2706.  
  2707. The search path for a shared library is:
  2708.  
  2709. * In the Applications' folder
  2710. * In the Extensions folder
  2711.  
  2712. That's it.
  2713.  
  2714.  
  2715. --
  2716.   Jon W‰tte (h+@nada.kth.se), Hagagatan 1, 113 48 Stockholm, Sweden
  2717.  "Don't use the Layer Manager"
  2718.  
  2719.  
  2720. +++++++++++++++++++++++++++
  2721.  
  2722. >From willie-abrams@uokhsc.edu (Willie Abrams)
  2723. Date: Wed, 28 Sep 1994 14:58:27 -0500
  2724. Organization: OUHSC Center for Telemedicine
  2725.  
  2726. In article <bb-2609941500390001@user48.lightside.com>, bb@lightside.com
  2727. (Bob Bradley) wrote:
  2728.  
  2729. > I noticed that every application that uses a shared library (including my
  2730. > own) will not launch if that shared library cannot be found. Is there any
  2731. > way around this?
  2732. > I'm using the Thread Manager on a PowerPC in my application and have the
  2733. > appropriate checks in my application to tell whether or not the Thread
  2734. > Manager is available and if not, it uses non-Thread Manager code to still
  2735. > function (it is limited if not using the Thread Manager). The problem is
  2736. > my code never gets a chance to run since the system says it couldn't find
  2737. > the ThreadsLib (when the extension isn't loaded). 
  2738. > The System doesn't appear to be very thorough in it's search for the
  2739. > library either since another application that requires QuickTime wouldn't
  2740. > run even when QuickTime was installed. I tried copying the QuickTimeLib 
  2741. > and it still didn't work until I re-installed QuickTime.
  2742.  
  2743. Import "weak" (if you are using CodeWarrior, that option is in the little
  2744. triangle thingy next to the library) the shared libraries that you are
  2745. using, and then check for their presence before calling the routines.
  2746.  
  2747. -- 
  2748. Willie Abrams
  2749. willie-abrams@uokhsc.edu
  2750.  
  2751. Less is more. God is in the details. - Mies van der Rohe
  2752.  
  2753. +++++++++++++++++++++++++++
  2754.  
  2755. >From isis@netcom.com (Mike Cohen)
  2756. Date: Thu, 29 Sep 1994 18:01:12 GMT
  2757. Organization: ISIS International
  2758.  
  2759. bb@lightside.com (Bob Bradley) writes:
  2760.  
  2761. >I noticed that every application that uses a shared library (including my
  2762. >own) will not launch if that shared library cannot be found. Is there any
  2763. >way around this?
  2764.  
  2765. >I'm using the Thread Manager on a PowerPC in my application and have the
  2766. >appropriate checks in my application to tell whether or not the Thread
  2767. >Manager is available and if not, it uses non-Thread Manager code to still
  2768. >function (it is limited if not using the Thread Manager). The problem is
  2769. >my code never gets a chance to run since the system says it couldn't find
  2770. >the ThreadsLib (when the extension isn't loaded). 
  2771.  
  2772. If you're using MetroWerks, click on the popup next to the library and
  2773. select "soft import". If you do this, make sure you check that the functions
  2774. in it actually exist before calling them (you could probably test only one
  2775. function at startup). To do it, write something like:
  2776.  
  2777.     if (someFunction != NULL)
  2778.         someFunction();
  2779. -- 
  2780. Mike Cohen - isis@netcom.com
  2781. NewtonMail, eWorld: MikeC / ALink: D6734 / AOL: MikeC20
  2782. Home Page: file://ftp.netcom.com/pub/isis/home.html
  2783.  
  2784. +++++++++++++++++++++++++++
  2785.  
  2786. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  2787. Date: Fri, 30 Sep 1994 18:25:32 GMT
  2788. Organization: Apple Computer
  2789.  
  2790. Jon W{tte, h+@nada.kth.se writes:
  2791. > The search path for a shared library is:
  2792. > * In the Applications' folder
  2793. > * In the Extensions folder
  2794.  
  2795. You forgot:
  2796. * In any folder inside the Extensions folder (including aliases to folders.)
  2797.  
  2798. --Jens Alfke                           jens_alfke@powertalk.apple.com
  2799.                    "A man, a plan, a yam, a can of Spam ... Bananama!"
  2800.  
  2801. +++++++++++++++++++++++++++
  2802.  
  2803. >From 103t_english@west.cscwc.pima.edu
  2804. Date: 30 Sep 94 13:08:43 MST
  2805. Organization: (none)
  2806.  
  2807. In article <1994Sep30.182532.29882@gallant.apple.com>, Jens Alfke <jens_alfke@powertalk.apple.com> writes:
  2808. > Jon W{tte, h+@nada.kth.se writes:
  2809. >> The search path for a shared library is:
  2810. >> 
  2811. >> * In the Applications' folder
  2812. >> * In the Extensions folder
  2813. > You forgot:
  2814. > * In any folder inside the Extensions folder (including aliases to folders.)
  2815. > --Jens Alfke                           jens_alfke@powertalk.apple.com
  2816. >                    "A man, a plan, a yam, a can of Spam ... Bananama!"
  2817.  
  2818. OW! There goes the trick of putting inactive extesions in the "Inactive
  2819. Extensions Folder"...
  2820.  
  2821.  
  2822. Lawson
  2823.  
  2824. +++++++++++++++++++++++++++
  2825.  
  2826. >From greg@math.harvard.edu (Gregory D. Landweber)
  2827. Date: 30 Sep 94 20:21:23 EDT
  2828. Organization: Dept. of Math, Harvard Univ.
  2829.  
  2830. In article <bb-2609941500390001@user48.lightside.com> bb@lightside.com (Bob Bradley) writes:
  2831. >I noticed that every application that uses a shared library (including my
  2832. >own) will not launch if that shared library cannot be found. Is there any
  2833. >way around this?
  2834.  
  2835. You need to mark the library as "weak", in which case the system will not
  2836. require that it be linked in when the application is launched.  You can
  2837. designate the library as "weak" in the CodeWarrior project window (using
  2838. the tiny pop up to the right of the library name).  Of course, if you do
  2839. so, you'll have to check to make sure that the routines are present before
  2840. you call them.  Checking the appropriate Gestalt selectors should be good
  2841. enough, but you can double check that a pointer to the routine isn't null
  2842.  
  2843. -- Greg
  2844.    greg@math.harvard.edu
  2845.  
  2846. +++++++++++++++++++++++++++
  2847.  
  2848. >From jwbaxter@olympus.net (John W. Baxter)
  2849. Date: Fri, 30 Sep 1994 21:04:59 -0700
  2850. Organization: Internet for the Olympic Peninsula
  2851.  
  2852. In article <1994Sep30.130843@west.cscwc.pima.edu>,
  2853. 103t_english@west.cscwc.pima.edu wrote:
  2854.  
  2855. > In article <1994Sep30.182532.29882@gallant.apple.com>, Jens Alfke
  2856. <jens_alfke@powertalk.apple.com> writes:
  2857. > > Jon W{tte, h+@nada.kth.se writes:
  2858. > >> The search path for a shared library is:
  2859. > >> 
  2860. > >> * In the Applications' folder
  2861. > >> * In the Extensions folder
  2862. > > 
  2863. > > You forgot:
  2864. > > * In any folder inside the Extensions folder (including aliases to folders.)
  2865. > > 
  2866. > > --Jens Alfke                           jens_alfke@powertalk.apple.com
  2867. > >                    "A man, a plan, a yam, a can of Spam ... Bananama!"
  2868. > OW! There goes the trick of putting inactive extesions in the "Inactive
  2869. > Extensions Folder"...
  2870.  
  2871. No...just put that folder "beside" the Extensions folder, not inside it. 
  2872. [Or use Extension Manager, which does that using " disabled" as a
  2873. suffix.]  I usually drag things between the real and the corresponding
  2874. (disabled) folders, rather than bothering with Extension Manager.  For
  2875. things I toggle a lot, I write a (Frontier, but AppleScript will do)
  2876. script.
  2877.  
  2878.    --John
  2879.  
  2880. -- 
  2881. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  2882.    Sorry...clever signatures require cleverness, not found here.
  2883.    jwbaxter@pt.olympus.net
  2884.  
  2885. ---------------------------
  2886.  
  2887. >From peter.lewis@info.curtin.edu.au (Peter N Lewis)
  2888. Subject: Reading STR# resource - Pascal code
  2889. Date: Thu, 29 Sep 1994 12:25:30 +0800
  2890. Organization: NCRPDA, Curtin University
  2891.  
  2892. >epenneba@ux1.cso.uiuc.edu (Erik Pennebaker ) wrote:
  2893. >
  2894. > ) This is probably a relatively lightweight quesiton, but I couldn't get
  2895. > ) a straight answer (or couldn't find a straight answer) from Inside Mac.
  2896. > ) I'm writing a program that needs to read strings from STR# resource, 
  2897. > ) and needs to know how many strings are in this. I've seen this done, 
  2898. > ) but for some reason mine seemed to read a null string.  If anyoone
  2899. > ) could write an quick example of this it would be great....:)
  2900.  
  2901. Here is some Pascal code to create, modify, read, and write STR# resources
  2902. and handles.
  2903.    Peter.
  2904.  
  2905. unit MyStrH;
  2906.  
  2907. interface
  2908.  
  2909. {$IFC undefined THINK_Pascal}
  2910.    uses
  2911.       Types;
  2912. {$ENDC}
  2913.  
  2914.    type
  2915.       lineIndex = integer;
  2916.  
  2917.    function NewStrH: handle;
  2918.    procedure ReinitStrH (h: handle);
  2919.    function CountStrs (id: integer): lineIndex;
  2920.    function CountStrsH (h: handle): lineIndex;
  2921.    function GetIndStr (id: integer; index: lineIndex): str255;
  2922.    function GetIndStrH (h: handle; index: lineIndex): str255;
  2923.    procedure SetIndStr (id, index: lineIndex; s: str255);
  2924.    procedure SetIndStrH (h: handle; index: lineIndex; s: str255);
  2925.    procedure DelIndStr (id: integer; index: lineIndex);
  2926.    procedure DelIndStrH (h: handle; index: lineIndex);
  2927.    procedure InsIndString (id: integer; index: lineIndex; s: str255);
  2928.    procedure InsIndStrH (h: handle; index: integer; s: str255);
  2929.  
  2930. implementation
  2931.  
  2932. {$IFC undefined THINK_Pascal}
  2933.    uses
  2934.       Memory, Resources, ToolUtils;
  2935. {$ENDC}
  2936.  
  2937.    type
  2938.       indexPtr = ^lineIndex;
  2939.       indexHandle = ^indexPtr;
  2940.  
  2941.    function NewStrH: handle;
  2942.    begin
  2943.       NewStrH := NewHandleClear(SizeOf(lineIndex));
  2944.    end;
  2945.  
  2946.    procedure ReinitStrH (h: handle);
  2947.    begin
  2948.       SetHandleSize(h, SizeOf(lineIndex));
  2949.       indexHandle(h)^^ := 0;
  2950.    end;
  2951.  
  2952.    function CountStrsH (h: handle): integer;
  2953.    begin
  2954.       CountStrsH := indexHandle(h)^^;
  2955.    end;
  2956.  
  2957.    function CountStrs (id: integer): lineIndex;
  2958.       var
  2959.          h: handle;
  2960.    begin
  2961.       h := GetResource('STR#', id);
  2962.       CountStrs := indexHandle(h)^^;
  2963.    end;
  2964.  
  2965.    function GetIndStr (id: integer; index: lineIndex): str255;
  2966.       var
  2967.          s: str255;
  2968.    begin
  2969.       GetIndString(s, id, index);
  2970.       GetIndStr := s;
  2971.    end;
  2972.  
  2973.    function GetIndStrH (h: handle; index: lineIndex): str255;
  2974.       var
  2975.          count, i: lineIndex;
  2976.          s: str255;
  2977.          ps: longInt;
  2978.    begin
  2979.       count := indexHandle(h)^^;
  2980.       if (1 <= index) and (index <= count) then begin
  2981.          ps := SizeOf(lineIndex);
  2982.          for i := 1 to index - 1 do
  2983.             ps := ps + BAND(ptr(ord(h^) + ps)^, $FF) + 1;
  2984.          BlockMove(ptr(ord(h^) + ps), @s, BAND(ptr(ord(h^) + ps)^, $FF) + 1);
  2985.       end
  2986.       else
  2987.          s := '';
  2988.       GetIndStrH := s;
  2989.    end;
  2990.  
  2991.    procedure SetIndStrH (h: handle; index: lineIndex; s: str255);
  2992.       var
  2993.          count, i: lineIndex;
  2994.          sz: longInt;
  2995.          p: longInt;
  2996.          err: longInt;
  2997.          ps: longInt;
  2998.    begin
  2999.       count := indexHandle(h)^^;
  3000.       sz := GetHandleSize(h);
  3001.       if count < index then begin
  3002.          SetHandleSize(h, sz + index - count);
  3003.          for p := ord(h^) + sz to ord(h^) + sz + index - count - 1 do
  3004.             ptr(p)^ := 0;
  3005.          indexHandle(h)^^ := index;
  3006.          count := index;
  3007.       end;
  3008.       ps := SizeOf(lineIndex);
  3009.       for i := 1 to index - 1 do
  3010.          ps := ps + BAND(ptr(ord(h^) + ps)^, $FF) + 1;
  3011.       err := Munger(h, ps, nil, BAND(ptr(ord(h^) + ps)^, $FF) + 1, @s,
  3012. length(s) + 1);
  3013.    end;
  3014.  
  3015.    procedure SetIndStr (id, index: lineIndex; s: str255);
  3016.       var
  3017.          h: handle;
  3018.    begin
  3019.       h := GetResource('STR#', id);
  3020.       HNoPurge(h);
  3021.       SetIndStrH(h, index, s);
  3022.       HPurge(h);
  3023.       ChangedResource(h);
  3024.       WriteResource(h);
  3025.    end;
  3026.  
  3027.    procedure DelIndStrH (h: handle; index: integer);
  3028.       var
  3029.          count, i: lineIndex;
  3030.          sz: longInt;
  3031.          err: longInt;
  3032.          ps: longInt;
  3033.    begin
  3034.       count := indexHandle(h)^^;
  3035.       sz := GetHandleSize(h);
  3036.       if count >= index then begin
  3037.          ps := SizeOf(lineIndex);
  3038.          for i := 1 to index - 1 do
  3039.             ps := ps + BAND(ptr(ord(h^) + ps)^, $FF) + 1;
  3040.          err := Munger(h, ps, nil, BAND(ptr(ord(h^) + ps)^, $FF) + 1,
  3041. @err, 0); { @err is a safe, non nil addr }
  3042.          indexHandle(h)^^ := count - 1;
  3043.       end;
  3044.    end;
  3045.  
  3046.    procedure DelIndStr (id: integer; index: lineIndex);
  3047.       var
  3048.          h: handle;
  3049.    begin
  3050.       h := GetResource('STR#', id);
  3051.       HNoPurge(h);
  3052.       DelIndStrH(h, index);
  3053.       HPurge(h);
  3054.       ChangedResource(h);
  3055.       WriteResource(h);
  3056.    end;
  3057.  
  3058.    procedure InsIndStrH (h: handle; index: integer; s: str255);
  3059.       var
  3060.          count, i: lineIndex;
  3061.          err: longInt;
  3062.          ps: longInt;
  3063.          t: string[2];
  3064.    begin
  3065.       count := indexHandle(h)^^;
  3066.       if count >= index then begin
  3067.          ps := SizeOf(lineIndex);
  3068.          for i := 1 to index - 1 do
  3069.             ps := ps + BAND(ptr(ord(h^) + ps)^, $FF) + 1;
  3070.          t := '';
  3071.          err := Munger(h, ps, nil, 0, @t, length(t) + 1);
  3072.          indexHandle(h)^^ := count + 1;
  3073.       end;
  3074.       SetIndStrH(h, index, s)
  3075.    end;
  3076.  
  3077.    procedure InsIndString (id: integer; index: lineIndex; s: str255);
  3078.       var
  3079.          h: handle;
  3080.    begin
  3081.       h := GetResource('STR#', id);
  3082.       HNoPurge(h);
  3083.       InsIndStrH(h, index, s);
  3084.       HPurge(h);
  3085.       ChangedResource(h);
  3086.       WriteResource(h);
  3087.    end;
  3088.  
  3089. end.
  3090. -- 
  3091. Peter N Lewis <peter.lewis@info.curtin.edu.au> - Macintosh TCP fingerpainter
  3092. FTP my programs from redback.cs.uwa.edu.au:Others/PeterLewis/ or
  3093. amug.org:pub/peterlewis/ or nic.switch.ch:software/mac/peterlewis/
  3094.  
  3095. ---------------------------
  3096.  
  3097. End of C.S.M.P. Digest
  3098. **********************
  3099.  
  3100.