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

  1. Received-Date: Fri, 29 Apr 1994 18:37:36 +0200
  2. From: pottier@clipper.ens.fr (Francois Pottier)
  3. Subject: csmp-digest-v3-021
  4. To: csmp-digest@ens.fr
  5. Date: Fri, 29 Apr 94 18:37:31 MET DST
  6. X-Mailer: ELM [version 2.3 PL11]
  7. Errors-To: listman@ens.fr
  8. Reply-To: pottier@clipper.ens.fr
  9. X-Sequence: 23
  10.  
  11. --------------------
  12. WriteThrough    2K
  13. --------------------
  14.  
  15. C.S.M.P. Digest             Fri, 29 Apr 94       Volume 3 : Issue 21
  16.  
  17. Today's Topics:
  18.  
  19.         CW longjmp & destructor
  20.         Complete File Directory
  21.         Extensions-Patches w-PowerPC
  22.         Help: SetEventMask, MacApp, Sub-launching
  23.         Macintosh Disk Cache fix -- 25 times speedup
  24.         PowerMac Programming & the data bus
  25.         QuickDraw GX Questions
  26.         Quitting faceless background applications
  27.  
  28.  
  29.  
  30. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  31. (pottier@clipper.ens.fr).
  32.  
  33. The digest is a collection of article threads from the internet newsgroup
  34. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  35. regularly and want an archive of the discussions.  If you don't know what a
  36. newsgroup is, you probably don't have access to it.  Ask your systems
  37. administrator(s) for details.  If you don't have access to news, you may
  38. still be able to post messages to the group by using a mail server like
  39. anon.penet.fi (mail help@anon.penet.fi for more information).
  40.  
  41. Each issue of the digest contains one or more sets of articles (called
  42. threads), with each set corresponding to a 'discussion' of a particular
  43. subject.  The articles are not edited; all articles included in this digest
  44. are in their original posted form (as received by our news server at
  45. nef.ens.fr).  Article threads are not added to the digest until the last
  46. article added to the thread is at least two weeks old (this is to ensure that
  47. the thread is dead before adding it to the digest).  Article threads that
  48. consist of only one message are generally not included in the digest.
  49.  
  50. The digest is officially distributed by two means, by email and ftp.
  51.  
  52. If you want to receive the digest by mail, send email to listserv@ens.fr
  53. with no subject and one of the following commands as body:
  54.     help                        Sends you a summary of commands
  55.     subscribe csmp-digest Your Name    Adds you to the mailing list
  56.     signoff csmp-digest            Removes you from the list
  57. Once you have subscribed, you will automatically receive each new
  58. issue as it is created.
  59.  
  60. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  61. Questions related to the ftp site should be directed to
  62. scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
  63. digest are available there.
  64.  
  65. Also, the digests are available to WAIS users as comp.sys.mac.programmer.src.
  66.  
  67.  
  68. -------------------------------------------------------
  69.  
  70. >From ueda@bug.co.jp (SHOJI UEDA)
  71. Subject: CW longjmp & destructor
  72. Date: Fri, 8 Apr 1994 12:57:45 GMT
  73. Organization: B.U.G. Inc.
  74.  
  75. Hi, CodeWarrior users and Metrowerks guys
  76.  
  77. I found a "longjmp & destructor" problem with CW 1.0a4 PPC/68K.
  78. Here is my test code.
  79. --
  80. #include <Types.h>
  81. #include <setjmp.h>
  82.  
  83. class CTest {
  84. public:
  85.         long field;
  86.         CTest(void);
  87.         ~CTest(void);
  88. };
  89.  
  90. CTest::CTest(void)
  91. {
  92.         field = 'CNST';
  93. }
  94.  
  95. CTest::~CTest(void)
  96. {
  97.         field = 'DEST';
  98. }
  99.  
  100. class CTest2 {
  101. public:
  102.         long field;
  103.         CTest2(void);
  104.         ~CTest2(void);
  105. };
  106.  
  107. CTest2::CTest2(void)
  108. {
  109.         field = 'CNST';
  110. }
  111.  
  112. CTest2::~CTest2(void)
  113. {
  114.         field = 'DEST';
  115. }
  116.  
  117. jmp_buf env;
  118.  
  119. void Func(void)
  120. {
  121.         CTest ctest;
  122.  
  123.         ctest.field = 'FUNC';
  124.         longjmp(env, 1);
  125. }
  126.  
  127. void main(void)
  128. {
  129.         CTest2 ctest2;
  130.  
  131.         ctest2.field = 'MAIN';
  132.         DebugStr("\pSTARTED");
  133.         if (setjmp(env) == 0) {
  134.                 Func();
  135.                 DebugStr("\pSUCCEEDED");
  136.         }
  137.         else
  138.                 DebugStr("\pFAILED");
  139.         DebugStr("\pEND");
  140. }
  141. - -
  142. This code will cause crash. This is because ctest defined in Func() already
  143. was removed from stack frame but its destructor called.
  144.  
  145. I tested this code with MPW CFront. CFront never call removed obejct's
  146. destructor. I don't understand removed object's destructor should be called
  147. or not. But MacApp3.1 failure mechanism uses longjmp() and destructor.
  148.  
  149. Thanks,
  150.  
  151.  
  152. +++++++++++++++++++++++++++
  153.  
  154. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  155. Date: Tue, 12 Apr 1994 20:11:04 GMT
  156. Organization: Apple Computer
  157.  
  158. SHOJI UEDA, ueda@bug.co.jp writes:
  159. > This code will cause crash. This is because ctest defined in Func() already
  160. > was removed from stack frame but its destructor called.
  161.  
  162. Something's wrong here. longjmp() does NOT call destructors of local
  163. variables. I've been using setjmp/longjmp in an exception library of my own
  164. with no problems, and PowerPlant also uses them.
  165.  
  166. Take a look at the disassembly of your code and see what's happening around
  167. the call to longjmp...
  168.  
  169. --Jens Alfke
  170.   jens_alfke@powertalk              Rebel girl, rebel girl,
  171.             .apple.com              Rebel girl you are the queen of my world
  172.  
  173. +++++++++++++++++++++++++++
  174.  
  175. >From dpodwall@world.std.com (Dan Podwall)
  176. Date: Wed, 13 Apr 1994 16:36:43 GMT
  177. Organization: Metrowerks, Inc.
  178.  
  179. SHOJI UEDA (ueda@bug.co.jp) wrote:
  180. : Hi, CodeWarrior users and Metrowerks guys
  181.  
  182. : I found a "longjmp & destructor" problem with CW 1.0a4 PPC/68K.
  183. : Here is my test code.
  184.  
  185. As you know, longjmp doesn't call destructors for objects in
  186. the stack frames that it pops. But there is a bug in the C++ runtime
  187. that causes it to get confused and try to destroy objects that
  188. were in frames that were popped by a longjmp. This will be fixed in
  189. DR3. I'm not sure if this is something that we can make an interim fix
  190. for or not.
  191.  
  192. Dan Podwall
  193. Metrowerks, Inc.
  194.  
  195.  
  196. +++++++++++++++++++++++++++
  197.  
  198. >From johnmce@world.std.com (John McEnerney)
  199. Date: Thu, 14 Apr 1994 02:17:55 GMT
  200. Organization: The World Public Access UNIX, Brookline, MA
  201.  
  202. Jens Alfke <jens_alfke@powertalk.apple.com> writes:
  203.  
  204. >SHOJI UEDA, ueda@bug.co.jp writes:
  205. >> This code will cause crash. This is because ctest defined in Func() already
  206. >> was removed from stack frame but its destructor called.
  207.  
  208. >Something's wrong here. longjmp() does NOT call destructors of local
  209. >variables. I've been using setjmp/longjmp in an exception library of my own
  210. >with no problems, and PowerPlant also uses them.
  211.  
  212. This is actually a bug in CodeWarrior. The way the destruction of local 
  213. objects is implemented it is possible for the destructors to be called if 
  214. you exit the routine froma longjmp(). It will be fixed in DR3.
  215.  
  216. -- John McEnerney, Metrowerks PowerPC Product Architect
  217.  
  218.  
  219. ---------------------------
  220.  
  221. >From cowcorp@cairo.anu.edu.au (Matt Gallagher)
  222. Subject: Complete File Directory
  223. Date: 8 Apr 1994 03:52:46 GMT
  224. Organization: Australian National University
  225.  
  226. I need to get a complete directory listing of an HFS volume in Think C
  227. 5.0.4.
  228. I've tried recursively calling PBGetCatInfo, but this is ridiculously slow
  229. on my 500mb hard drive. Does anyone have any tips on how to do this more
  230. quickly?
  231.  
  232. Thanks in advance,
  233. Matt Gallagher
  234. cowcorp@cairo.anu.edu.au
  235.  
  236. +++++++++++++++++++++++++++
  237.  
  238. >From Scott_Gruby@hmc.edu (Scott Gruby)
  239. Date: 8 Apr 1994 04:19:53 GMT
  240. Organization: Harvey Mudd College, Claremont CA
  241.  
  242. In article <cowcorp-080494135647@150.203.60.160>, cowcorp@cairo.anu.edu.au
  243. (Matt Gallagher) wrote:
  244.  
  245. > I need to get a complete directory listing of an HFS volume in Think C
  246. > 5.0.4.
  247. > I've tried recursively calling PBGetCatInfo, but this is ridiculously slow
  248. > on my 500mb hard drive. Does anyone have any tips on how to do this more
  249. > quickly?
  250. > Thanks in advance,
  251. > Matt Gallagher
  252. > cowcorp@cairo.anu.edu.au
  253.  
  254. Sorry I can't answer this question, but on a similar note, what is the
  255. easiest way to list all files in a directory...as fast as possible would be
  256. great, but not necessary?
  257.  
  258. Thanks.
  259.  
  260. -- 
  261. Scott Allen Gruby                         (Scott_Gruby@hmc.edu)
  262. Macintosh Student System Manager
  263. Academic Computing, Harvey Mudd College
  264. Claremont, CA
  265.          Finger ripem_public@eagle.st.hmc.edu for public key
  266.  
  267. +++++++++++++++++++++++++++
  268.  
  269. >From jumplong@aol.com (Jump Long)
  270. Date: 9 Apr 1994 13:17:02 -0400
  271. Organization: America Online, Inc. (1-800-827-6364)
  272.  
  273. In article <cowcorp-080494135647@150.203.60.160>, cowcorp@cairo.anu.edu.au
  274. (Matt Gallagher) writes:
  275.  
  276. > I need to get a complete directory listing of an HFS volume in Think C
  277. > 5.0.4.
  278.  
  279. There are only a couple of methods you can use.
  280.  
  281. If you want the directory struture (you want to know what files and
  282. subdirectories are in a directory), you'll have to use PBGetCatInfo (as you
  283. said you've already tried).  I haven't tried this to find out if it makes any
  284. difference but... the Macintosh file system keeps a catalog hint when
  285. PBGetCatInfo is used with a positive index. That means that if you index
  286. through a directory using 1, 2, 3, 4..., the file system can find the next
  287. sequential directory entry a little faster.  So, you might get a little better
  288. performance if you index through a complete directory level before dropping
  289. down a level to index through its subdirectories.  I don't know because I
  290. haven't tried it. (This would be harder to code, though.)
  291.  
  292. If you don't need the directory structure and only need a list of all of the
  293. objects (files and directories) on the volume, you can use PBCatSearch to get
  294. fill an array of FSSpecs.  This will be a lot faster on local HFS hard disks
  295. but will probably be slower than the recursive search if the volume is an
  296. AppleShare volume.  (I tested this when writing the Technical Note "Searching
  297. Volumes-Solutions and Problems" and found that the search time for finding all
  298. files and directories on a Developer CD  was around 18 seconds with
  299. PBCatSearch. It took 6 minutes and 36 seconds with a recursive indexed search.)
  300.  
  301. - Jim Luther
  302.  
  303.  
  304. +++++++++++++++++++++++++++
  305.  
  306. >From blob@apple.com (Brian Bechtel)
  307. Date: 14 Apr 1994 21:36:28 -0700
  308. Organization: Apple Computer, Inc., Cupertino, California
  309.  
  310. Scott_Gruby@hmc.edu (Scott Gruby) writes:
  311.  
  312. >In article <cowcorp-080494135647@150.203.60.160>, cowcorp@cairo.anu.edu.au
  313. >(Matt Gallagher) wrote:
  314.  
  315. >> I need to get a complete directory listing of an HFS volume in Think C
  316. >> 5.0.4.
  317. >> I've tried recursively calling PBGetCatInfo, but this is ridiculously slow
  318. >> on my 500mb hard drive. Does anyone have any tips on how to do this more
  319. >> quickly?
  320.  
  321. >Sorry I can't answer this question, but on a similar note, what is the
  322. >easiest way to list all files in a directory...as fast as possible would be
  323. >great, but not necessary?
  324.  
  325. MoreFiles.  MoreFiles.  MoreFiles.
  326.  
  327. MoreFiles is an excellent collection of file manager sample code by Jim
  328. Luther of DTS.  It's available from
  329.  
  330.   ftp://ftp.apple.com/dts/mac/sc/morefiles.1.1.1.hqx
  331.  
  332. It has complete, working code which does both of the requested items
  333. above.
  334.  
  335. --Brian Bechtel     blob@apple.com     "My opinion, not Apple's"
  336.  
  337. ---------------------------
  338.  
  339. >From gdl@stlawrence.maths (Greg Landweber)
  340. Subject: Extensions-Patches w-PowerPC
  341. Date: 09 Apr 1994 16:26:51 GMT
  342. Organization: (none)
  343.  
  344. If I load and prepare a PowerPC code fragment from an INIT (using
  345. GetDiskFragment or loading it from a resource and calling
  346. GetMemFragment), will it be unloaded when my INIT exits?  I want the
  347. fragment to persist until the Mac is shut down, as if I had loaded and
  348. detached a 680x0 code resource in the system heap.
  349.  
  350. Basically, I have a code fragment containing a number of trap patches.
  351. The entry point is the routine that installs the trap patches and a
  352. Gestalt Selector routine also within the code fragment.
  353.  
  354. Thanks for your help.
  355.  
  356. -- Greg "Buttons" Landweber
  357.    gdl@maths.ox.ac.uk
  358.  
  359. +++++++++++++++++++++++++++
  360.  
  361. >From A.Lillich@AppleLink.Apple.com (Alan Lillich)
  362. Date: Mon, 11 Apr 1994 23:38:37 GMT
  363. Organization: Apple Computer, Inc.
  364.  
  365. In article <GDL.94Apr9172652@stlawrence.maths>, gdl@stlawrence.maths (Greg
  366. Landweber) wrote:
  367. > If I load and prepare a PowerPC code fragment from an INIT (using
  368. > GetDiskFragment or loading it from a resource and calling
  369. > GetMemFragment), will it be unloaded when my INIT exits?  I want the
  370. > fragment to persist until the Mac is shut down, as if I had loaded and
  371. > detached a 680x0 code resource in the system heap.
  372. > Basically, I have a code fragment containing a number of trap patches.
  373. > The entry point is the routine that installs the trap patches and a
  374. > Gestalt Selector routine also within the code fragment.
  375. > Thanks for your help.
  376. > -- Greg "Buttons" Landweber
  377. >    gdl@maths.ox.ac.uk
  378.  
  379. What you suggest works just fine.  I would suggest using the fragment's
  380. init routine to install the patches, then your init just has to call
  381. GetDiskFragment and make sure there is no error.  Note:  If VM is on
  382. GetDiskFragment will use file mapping on the data fork.  This may or may
  383. not be desirable, i.e. is your code only used at times when page faults are
  384. safe?
  385.  
  386. Alan Lillich.
  387.  
  388. +++++++++++++++++++++++++++
  389.  
  390. >From wdh@netcom.com (Bill Hofmann)
  391. Date: Tue, 12 Apr 1994 01:55:49 GMT
  392. Organization: NETCOM On-line Communication Services (408 241-9760 guest)
  393.  
  394. gdl@stlawrence.maths (Greg Landweber) writes:
  395. >If I load and prepare a PowerPC code fragment from an INIT (using
  396. >GetDiskFragment or loading it from a resource and calling
  397. >GetMemFragment), will it be unloaded when my INIT exits?  I want the
  398. >fragment to persist until the Mac is shut down, as if I had loaded and
  399. >detached a 680x0 code resource in the system heap.
  400. Once a fragment is loaded (at INIT time), it's open forever.  Of course,
  401. if you load a fragment from a resource, you had best DetachResource...
  402.  
  403. >Basically, I have a code fragment containing a number of trap patches.
  404. >The entry point is the routine that installs the trap patches and a
  405. >Gestalt Selector routine also within the code fragment.
  406. Yup, that'll work.  If you want to install fat patches, **as you should**
  407. most of the time, your entry point should instead be a routine which
  408. returns addresses of patches and takes old trap addresses, since you'll
  409. need to build a fat routine descriptor for each patch, and to do that,
  410. you need to also have a 680x0 version.  It's kind of an ugly mess, which
  411. can be archtected nicely with some effort.
  412.  
  413. If your patch is big enough that a mixed mode switch is worthwhile (> a
  414. few hundred anyway, probably a few thousand) lines of compiled code, then
  415. you can just patch native, and try this: make your initialization routine
  416. do the initing and patching, and you don't have to do anything but load
  417. the fragment: the init routine gets called automatically!  It's quite
  418. easy to do.  
  419.  
  420. >Thanks for your help.
  421. >-- Greg "Buttons" Landweber
  422. >   gdl@maths.ox.ac.uk
  423. No problem.
  424. -- 
  425. -Bill Hofmann                    wdh@netcom.COM
  426.  Fresh Software and Instructional Design    +1 510 524 0852
  427.  
  428. +++++++++++++++++++++++++++
  429.  
  430. >From leonardr@netcom.com (Leonard Rosenthol)
  431. Date: Tue, 12 Apr 1994 18:36:58 GMT
  432. Organization: Aladdin Systems, Inc.
  433.  
  434. In article <wdhCo4Ip3.CEz@netcom.com>, wdh@netcom.com (Bill Hofmann) wrote:
  435.  
  436. > gdl@stlawrence.maths (Greg Landweber) writes:
  437. > >If I load and prepare a PowerPC code fragment from an INIT (using
  438. > >GetDiskFragment or loading it from a resource and calling
  439. > >GetMemFragment), will it be unloaded when my INIT exits?  I want the
  440. > >fragment to persist until the Mac is shut down, as if I had loaded and
  441. > >detached a 680x0 code resource in the system heap.
  442. >
  443. > Once a fragment is loaded (at INIT time), it's open forever.  Of course,
  444. > if you load a fragment from a resource, you had best DetachResource...
  445.    True, it is open forever (well, assuming the file doesn't get closed ;)
  446. - HOWEVER the connection ID that you get back from
  447. GetMemFragment/GetDiskFragment is _PROCESS_ relative so that in order to
  448. use the fragment in multiple processes/application you have to either
  449. reload the fragment each time OR precompute and store the entry points at
  450. startup.
  451.  
  452.  
  453. Leonard
  454. - ------------------------------------------------------------------------
  455. Leonard Rosenthol                      Internet:       leonardr@netcom.com
  456. Director of Advanced Technology        AppleLink:      MACgician
  457. Aladdin Systems, Inc.                  GEnie:          MACgician
  458.  
  459. +++++++++++++++++++++++++++
  460.  
  461. >From zobkiw@datawatch.com (joe zobkiw)
  462. Date: Wed, 13 Apr 1994 12:26:38 GMT
  463. Organization: Datawatch Corporation
  464.  
  465. In article <leonardr-120494103658@leonardr.slip.netcom.com>,
  466. leonardr@netcom.com (Leonard Rosenthol) wrote:
  467.  
  468. > In article <wdhCo4Ip3.CEz@netcom.com>, wdh@netcom.com (Bill Hofmann) wrote:
  469. > > gdl@stlawrence.maths (Greg Landweber) writes:
  470. > > >If I load and prepare a PowerPC code fragment from an INIT (using
  471. > > >GetDiskFragment or loading it from a resource and calling
  472. > > >GetMemFragment), will it be unloaded when my INIT exits?  I want the
  473. > > >fragment to persist until the Mac is shut down, as if I had loaded and
  474. > > >detached a 680x0 code resource in the system heap.
  475. > >
  476. > > Once a fragment is loaded (at INIT time), it's open forever.  Of course,
  477. > > if you load a fragment from a resource, you had best DetachResource...
  478. > > 
  479. >    True, it is open forever (well, assuming the file doesn't get closed ;)
  480. > - HOWEVER the connection ID that you get back from
  481. > GetMemFragment/GetDiskFragment is _PROCESS_ relative so that in order to
  482. > use the fragment in multiple processes/application you have to either
  483. > reload the fragment each time OR precompute and store the entry points at
  484. > startup.
  485.  
  486. >> reload the fragment each time OR precompute and store the entry points
  487.  
  488. This sounds a bit confusing but...I load numerous fragments at startup (via
  489. an INIT), and call them all throughout the time the machine is on. Simply
  490. GetResource, DetachResource, GetMemFragment, and go...it works fine.
  491.  
  492. ___________________________________________________________
  493. _/_/_/_/   Joe Zobkiw                                   ,,,
  494.     _/     Senior Software Engineer                     - -
  495.   _/       Datawatch Corporation                         L
  496. _/_/_/_/   zobkiw@datawatch.com                          -
  497.  
  498. +++++++++++++++++++++++++++
  499.  
  500. >From wdh@netcom.com (Bill Hofmann)
  501. Date: Thu, 14 Apr 1994 00:35:40 GMT
  502. Organization: NETCOM On-line Communication Services (408 241-9760 guest)
  503.  
  504. zobkiw@datawatch.com (joe zobkiw) writes:
  505. ...
  506. >>> reload the fragment each time OR precompute and store the entry points
  507.  
  508. >This sounds a bit confusing but...I load numerous fragments at startup (via
  509. >an INIT), and call them all throughout the time the machine is on. Simply
  510. >GetResource, DetachResource, GetMemFragment, and go...it works fine.
  511.  
  512. Yes, Leonard, Joe's right.  I've done it too.  You don't have to worry
  513. about the process-relative nature because, of course, you're in the system
  514. context at INIT time.  But your general comment is well-taken.
  515.  
  516. -- 
  517. -Bill Hofmann                    wdh@netcom.COM
  518.  Fresh Software and Instructional Design    +1 510 524 0852
  519.  
  520. +++++++++++++++++++++++++++
  521.  
  522. >From zobkiw@datawatch.com (joe zobkiw)
  523. Date: Thu, 14 Apr 1994 12:21:47 GMT
  524. Organization: Datawatch Corporation
  525.  
  526. In article <wdhCo84BG.4HH@netcom.com>, wdh@netcom.com (Bill Hofmann) wrote:
  527.  
  528. > zobkiw@datawatch.com (joe zobkiw) writes:
  529. > ...
  530. > >>> reload the fragment each time OR precompute and store the entry points
  531. > >This sounds a bit confusing but...I load numerous fragments at startup (via
  532. > >an INIT), and call them all throughout the time the machine is on. Simply
  533. > >GetResource, DetachResource, GetMemFragment, and go...it works fine.
  534. > Yes, Leonard, Joe's right.  I've done it too.  You don't have to worry
  535. > about the process-relative nature because, of course, you're in the system
  536. > context at INIT time.  But your general comment is well-taken.
  537.  
  538. Leonard responded to me: 
  539.  
  540. "That's because your code has a SINGLE entry point and you built it with
  541. a MixedMode Header on the resource.  If you DON'T do that, and you resolve
  542. (FindSymbol) at runtime, the connection ID's are not valid across
  543. processes."
  544.  
  545. Now, he is right, I have a single entry point. Maybe there is more to it
  546. with multiple entry points. I don't know since I've not had to deal with
  547. that yet.
  548.  
  549. ___________________________________________________________
  550. _/_/_/_/   Joe Zobkiw                                   ,,,
  551.     _/     Senior Software Engineer                     - -
  552.   _/       Datawatch Corporation                         L
  553. _/_/_/_/   zobkiw@datawatch.com                          -
  554.  
  555. +++++++++++++++++++++++++++
  556.  
  557. >From leonardr@netcom.com (Leonard Rosenthol)
  558. Date: Thu, 14 Apr 1994 19:01:42 GMT
  559. Organization: Aladdin Systems, Inc.
  560.  
  561. In article <wdhCo84BG.4HH@netcom.com>, wdh@netcom.com (Bill Hofmann) wrote:
  562.  
  563. > zobkiw@datawatch.com (joe zobkiw) writes:
  564. > ...
  565. > >>> reload the fragment each time OR precompute and store the entry points
  566. > >This sounds a bit confusing but...I load numerous fragments at startup (via
  567. > >an INIT), and call them all throughout the time the machine is on. Simply
  568. > >GetResource, DetachResource, GetMemFragment, and go...it works fine.
  569. > Yes, Leonard, Joe's right.  I've done it too.  You don't have to worry
  570. > about the process-relative nature because, of course, you're in the system
  571. > context at INIT time.  But your general comment is well-taken.
  572.    Depends on whether you build a mixed mode header on the resource itself
  573. and whether you have one or multiple entry points.  
  574.  
  575.    If the former situation (single entry point, with no callbacks, and
  576. built with an MM header), then you are correct - you can load and call and
  577. be just fine.   BUT if you have a code frag with multiple entry points and
  578. you need to call FindSymbol, then the results are only relative to the
  579. process  - you need the correct connectionID for the process or FindSymbol
  580. will fail :(
  581.  
  582. Leonard
  583. - ------------------------------------------------------------------------
  584. Leonard Rosenthol                      Internet:       leonardr@netcom.com
  585. Director of Advanced Technology        AppleLink:      MACgician
  586. Aladdin Systems, Inc.                  GEnie:          MACgician
  587.  
  588. ---------------------------
  589.  
  590. >From steve.herman%express@freedom.msfc.nasa.gov (Steve Herman)
  591. Subject: Help: SetEventMask, MacApp, Sub-launching
  592. Date: Wed, 13 Apr 1994 12:48:37 -0500
  593. Organization: BCSS
  594.  
  595. MacApp 3.0.1(bullet) calls SetEventMask in it's DoRealInitToolBox()
  596. function to set SysEvtMask to everyEvent (0xFFFF).  According to Inside Mac
  597. the normal value of SysEvtMask is 0xFFEF which masks out keyUp events.
  598.  
  599. Where I have seen a problem is when I sub-launch applications from a MacApp
  600. application.  It appears that sub-launched applications "inherit" the value
  601. of SysEvtMask from the application which launched them.  Can anyone confirm
  602. that this is true???
  603.  
  604. Does anyone know just how/when a *sub-launched* application's low memory
  605. globals get initialized?  In my MacApp program I tried setting SysEvtMask
  606. to 0xFFEF, calling LaunchApplication() and then putting it back to 0xFFFF
  607. (to keep MacApp happy). But the sub-launched application still showed
  608. 0xFFFF after it launched.  Do I perhaps need to leave my SysEvtMask set at
  609. 0xFFEF until WaitNextEvent has been called a few times and the sub-launch
  610. has *really* taken place????
  611.  
  612. If I set SysEvtMask back to 0xFFEF in my MacApp application (and leave it
  613. that way) am I asking for trouble (I briefly searched through the source
  614. and didn't see anything obvious which MacApp was doing with keyUps)?
  615.  
  616. Despite all the documentation I've been able to find which states that apps
  617. which modify SysEvtMask should save it's previous value and then restore it
  618. before quitting, I can't find any indication that MacApp does this. As far
  619. as I can tell, however, this doesn't seem to cause a problem.
  620.  
  621. The reason I brought all this up is that we use an apparently "brain-dead"
  622. off the shelf product which I need to sub-launch AND which seems to get
  623. confused when it has to deal with keyUp events.
  624.  
  625. Thanks for any insight...
  626.  
  627. Steve
  628.  
  629. - --------------------------------------------------
  630. - Steve Herman - BCSS
  631. - Boeing Computer Support Services
  632. - Huntsville, AL
  633. - --------------------------------------------------
  634.  
  635. +++++++++++++++++++++++++++
  636.  
  637. >From jonpugh@netcom.com (Jon Pugh)
  638. Date: Thu, 14 Apr 1994 07:10:56 GMT
  639. Organization: NETCOM On-line Communication Services (408 241-9760 guest)
  640.  
  641. Steve Herman (steve.herman%express@freedom.msfc.nasa.gov) wrote:
  642. > MacApp 3.0.1(bullet) calls SetEventMask in it's DoRealInitToolBox()
  643. > function to set SysEvtMask to everyEvent (0xFFFF).  According to Inside Mac
  644. > the normal value of SysEvtMask is 0xFFEF which masks out keyUp events.
  645.  
  646. > Where I have seen a problem is when I sub-launch applications from a MacApp
  647. > application.  It appears that sub-launched applications "inherit" the value
  648. > of SysEvtMask from the application which launched them.  Can anyone confirm
  649. > that this is true???
  650.  
  651. Yes, I've dealt with this before and it is true.  You've nailed it.  I
  652. suspect your fix will work too, but I'll bet you've tried and know if it
  653. will work by now.  I solved it by making the sublaunched application fix
  654. its event mask, which isn't an option for you apparently.
  655.  
  656. > If I set SysEvtMask back to 0xFFEF in my MacApp application (and leave it
  657. > that way) am I asking for trouble (I briefly searched through the source
  658. > and didn't see anything obvious which MacApp was doing with keyUps)?
  659.  
  660. You simply won't get keyUp method calls, but since you probably don't use
  661. them, it won't matter if you turn them off.
  662.  
  663. Jon
  664.  
  665.  
  666. ---------------------------
  667.  
  668. >From Stuart Cheshire <cheshire@cs.stanford.edu>
  669. Subject: Macintosh Disk Cache fix -- 25 times speedup
  670. Date: 9 Apr 1994 17:25:44 GMT
  671. Organization: Stanford University
  672.  
  673. Here's a message I posted on Thursday to the Nuntius mailing list:
  674.  
  675. - ----------------------------------------------------------------
  676.  
  677. Has anyone else noticed that at the end of extracting a binary in
  678. Nuntius the disk light comes on, stays on for a few seconds, and
  679. freezes the Mac for that duration? It gets unbearable if you have
  680. a large disk cache, but even with only a 256K cache it can freeze
  681. the Mac for up to 5 seconds.
  682.  
  683. This is not the fault of Nuntius -- many other programs like BinHex
  684. decoders, uudecoders, archive expanders etc. seem to suffer the same
  685. problem.
  686.  
  687. This really annoys me. One of the good features of Nuntius is the way
  688. it lets you continue working while it is doing other things in the
  689. background, so having it freeze like this is particularly galling.
  690.  
  691. The problem is that Nuntius (and other programs) write their data to
  692. disk in chunks (say 4K each) and the Mac caches the blocks in its
  693. disk cache. When the file is closed the data is finally written to disk,
  694. and this is what causes the big freeze up. It would be much better if
  695. the data were written continually to disk, instead of in one big burst
  696. at the end.
  697.  
  698. Yesterday morning I wrote a little INIT which sets the File Manager
  699. "don't cache" bit for disk writes of 1K or more. It does this by
  700. installing the following patch on the _Write system call:
  701.  
  702.                  tst.w   IOParam.ioRefNum(a0)         ; Is this a file write?
  703.                  bmi.s   @sys_write
  704.                  cmp.l   #1024, IOParam.ioReqCount(a0); Is it at leask 1K?
  705.                  blo.s   @sys_write
  706.                  ori.w   #0x20, IOParam.ioPosMode(a0) ; Set "Don't cache" bit
  707. extern sys_write:jmp     0x12345678                   ; Resume the system call
  708.  
  709. One surprising artifact of this is that it not only amortises the disk
  710. time over all the writes, but it also makes it 25 times faster.
  711.  
  712. What?
  713.  
  714. Yes, it's true.
  715.  
  716. I set my disk cache to 768K, and wrote a test program which wrote to a
  717. file in 32 blocks of 16K each, making a total of 512K.
  718.  
  719. Without the INIT, the writes took almost no time, but the Close call
  720. took 11 seconds, averaging about 45K/second write rate.
  721.  
  722. With the INIT, the whole thing took under half a second, averaging
  723. over a megabyte per second.
  724.  
  725. Go figure.
  726.  
  727. This may not make much difference to people connecting over modem, but
  728. for people on Ethernet it makes a huge difference.
  729.  
  730. The INIT is below, in BinHex form. Decode it, install it, and let me
  731. know what you think.
  732.  
  733. It has no ICON, because the total size of the INIT (including balloon
  734. help) is just under 1K, and it seemed a pity to spoil that with a big
  735. fat colour icon. (Besides, I couldn't be bothered to draw one.)
  736.  
  737. - ----------------------------------------------------------------
  738.  
  739. Here is one reply I got, which proves I wasn't hallucinating:
  740.  
  741. >> From: joanna@mail.utexas.edu (Joanna L. Castillo)
  742. >> Subject: Re: Long Mac freezes with Nuntius (and other program)
  743. >> 
  744. >> Hi, Stuart -
  745. >> 
  746. >> >Yesterday morning I wrote a little INIT  [ ... ]
  747. >> 
  748. >> Wow!  I installed the INIT... I tried copying a folder that had several
  749. >> files and sub-folders (a little over 900K total) to a floppy.  With the
  750. >> INIT installed, it took about 30 seconds.  Without, it took 2 minutes.
  751. >> Thank you so much.
  752. >> 
  753. >> Joanna.
  754. >> 
  755. >> FYI:  I'm running a Mac IIci, 24MB RAM, cache card, ethernet, tuned
  756. >>       7.0.1 system, several inits, and disk cache set at 512K.
  757.  
  758. I'll post the source code for the INIT, and the test program, to a
  759. separate thread. This INIT itself is below.
  760.  
  761. Stuart Cheshire <cheshire@cs.stanford.edu>
  762.  * <A HREF="file://brubeck.stanford.edu/www/cheshire-bio.html">WWW</A>
  763.  * Stanford Distributed Systems Group Research Assistant
  764.  * Escondido Village Resident Computer Coordinator
  765.  * Macintosh Programmer
  766.  
  767. :
  768.  
  769. +++++++++++++++++++++++++++
  770.  
  771. >From rbauchsp@herbie.unl.edu (ROGER BAUCHSPIES)
  772. Date: 9 Apr 1994 21:26:54 GMT
  773. Organization: University of Nebraska--Lincoln    
  774.  
  775. Stuart Cheshire (cheshire@cs.stanford.edu) wrote:
  776. : Here's a message I posted on Thursday to the Nuntius mailing list:
  777.  
  778. : ------------------------------------------------------------------
  779.  
  780. : Has anyone else noticed that at the end of extracting a binary in
  781. : Nuntius the disk light comes on, stays on for a few seconds, and
  782. : freezes the Mac for that duration? It gets unbearable if you have
  783. : a large disk cache, but even with only a 256K cache it can freeze
  784. : the Mac for up to 5 seconds.
  785.  
  786. This is due to the design of the cache, which always writes cached 
  787. blocks in 512 byte pieces, regardless of how large they were when they
  788. cache grabbed them. I am writing a highly intelligent disk cache and 
  789. will be releasing it later this year. Depending on the marketplace at 
  790. that time, I may release both the source code and object code as 
  791. public domain.
  792.  
  793. Steve Kiene
  794. MindVision Software
  795.  
  796.  
  797. +++++++++++++++++++++++++++
  798.  
  799. >From Cameron Esfahani <dirty@guest.apple.com>
  800. Date: Sun, 10 Apr 1994 05:27:14 GMT
  801. Organization: Apple Computer, Inc.
  802.  
  803. In article <2o6oeo$8te@nntp2.Stanford.EDU> Stuart Cheshire,
  804. cheshire@cs.stanford.edu writes:
  805. > Has anyone else noticed that at the end of extracting a binary in
  806. > Nuntius the disk light comes on, stays on for a few seconds, and
  807. > freezes the Mac for that duration? It gets unbearable if you have
  808. > a large disk cache, but even with only a 256K cache it can freeze
  809. > the Mac for up to 5 seconds.
  810.  
  811. There is a perfectly logical explanation of why the disk cache
  812. sucks so bad in cases like this.  If the disk cache gets flushed,
  813. and there are a large number of dirty blocks in there, each block
  814. gets written out 1 at a time.  This means if you have a 1Meg cache
  815. and it has 256K dirty, then you will write out 512 blocks to
  816. disk.  Even if you have a fast drive this takes a little time.
  817.  
  818. This gives me a chance to evangelize the use of the 'noCacheBit'
  819. which is defined in SysEqu.a.  This tells the file system to not
  820. cache this transaction.  Please use this bit if you know you are
  821. not going to use the information that you are reading or writing
  822. again.  If you don't, the file system has to try to read your
  823. mind, and we all know how successfully that works.
  824.  
  825. Another way to speed up your usage of the file system is to never,
  826. ever use the newline mode in reading from a file.  The file system
  827. has to read data from the file 1 byte at a time.  This is slow. 
  828. If you want to simulate this, read from the file in large (>4K)
  829. chunks and search through it yourself.
  830.  
  831. This leads me into my next tip: read and write in large chunks. 
  832. It really is much more efficient to read and write in >4K chunks
  833. and pull your data out of there yourself.
  834.  
  835. With these few tips, you can increase your enjoyment of the Mac
  836. file system.
  837.  
  838. Cameron Esfahani
  839. dirty@apple.com
  840. General File-System Dude
  841.  
  842. +++++++++++++++++++++++++++
  843.  
  844. >From d88-jwa@mumrik.nada.kth.se (Jon Wdtte)
  845. Date: 10 Apr 1994 11:11:08 GMT
  846. Organization: The Royal Institute of Technology
  847.  
  848. In <2o6oeo$8te@nntp2.Stanford.EDU> Stuart Cheshire <cheshire@cs.stanford.edu> writes:
  849.  
  850. >Yesterday morning I wrote a little INIT which sets the File Manager
  851. >"don't cache" bit for disk writes of 1K or more. It does this by
  852. >installing the following patch on the _Write system call:
  853.  
  854. This has long been needed.
  855.  
  856. >Without the INIT, the writes took almost no time, but the Close call
  857. >took 11 seconds, averaging about 45K/second write rate.
  858. >With the INIT, the whole thing took under half a second, averaging
  859. >over a megabyte per second.
  860. >Go figure.
  861.  
  862. That's because the disk cache flushes itself in 512 byte blocks.
  863. Yes, that's right, at this day and age, the disk cache still
  864. iterates over its 512 byte blocks, writing ONE AT A TIME.
  865.  
  866. However, the next major system software release will have
  867. FINALLY fixed this problem. Yay! So your INIT should maybe
  868. check to see that the system version is < 7.2 or something?
  869.  
  870. Cheers,
  871.  
  872.                     / h+
  873.  
  874. -- 
  875.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
  876.     Not speaking for IBM.
  877.  
  878. +++++++++++++++++++++++++++
  879.  
  880. >From Stuart Cheshire <cheshire@cs.stanford.edu>
  881. Date: 10 Apr 1994 19:14:06 GMT
  882. Organization: Stanford University
  883.  
  884. In article <2o8msc$ro6@news.kth.se> Jon W!tte, d88-jwa@mumrik.nada.kth.se
  885. writes:
  886. >However, the next major system software release will have
  887. >FINALLY fixed this problem. Yay! So your INIT should maybe
  888. >check to see that the system version is < 7.2 or something?
  889.  
  890. Hey, the INIT is <1K. This is not a major software development. This is
  891. simply the result of waking up at 6:00am due to getting drunk the night
  892. before. Don't install it if it's not appropriate for your system.
  893.  
  894. Stuart Cheshire <cheshire@cs.stanford.edu>
  895.  * <A HREF="file://brubeck.stanford.edu/www/cheshire-bio.html">WWW</A>
  896.  * Stanford Distributed Systems Group Research Assistant
  897.  * Escondido Village Resident Computer Coordinator
  898.  * Macintosh Programmer
  899.  
  900. +++++++++++++++++++++++++++
  901.  
  902. >From philip@cs.wits.ac.za (Philip Machanick)
  903. Date: Mon, 11 Apr 1994 14:13:39 +0200
  904. Organization: Computer Science Dept, U of Witwatersrand
  905.  
  906. In article <2o9j5u$nt@nntp2.Stanford.EDU>, Stuart Cheshire
  907. <cheshire@cs.stanford.edu> wrote:
  908.  
  909. > Hey, the INIT is <1K. This is not a major software development. This is
  910. > simply the result of waking up at 6:00am due to getting drunk the night
  911. > before. Don't install it if it's not appropriate for your system.
  912.  
  913. Clearly still having fun. I may be at Stanford somewhere around 18 April.
  914. Maybe I'll see you then.
  915. -- 
  916. Philip Machanick                   philip@cs.wits.ac.za
  917. Department of Computer Science, University of the Witwatersrand
  918. 2050 Wits, South Africa
  919. phone 27(11)716-3309  fax 27(11)339-7965
  920. >From eric.larson@f620.n2605.z1.fidonet.org (eric larson)
  921. Subject: Macintosh Disk Cache fix -- 25 times speedup
  922. Date: 11 Apr 94 18:12:03 -0500
  923. Organization: FidoNet:* File Edit View Label Special                 ? D (1:2605/620)
  924.  
  925.  > This leads me into my next tip: read and write in large chunks.
  926.  > It really is much more efficient to read and write in >4K chunks
  927.  > and pull your data out of there yourself.
  928.  
  929.  > With these few tips, you can increase your enjoyment of the Mac
  930.  > file system.
  931.  
  932. How about a quick & -dare I say- dirty code snip?
  933.  
  934. +++++++++++++++++++++++++++
  935.  
  936. >From Ron_Hunsinger@bmug.org (Ron Hunsinger)
  937. Date: Wed, 13 Apr 94 00:09:16 PST
  938. Organization: Berkeley Macintosh Users Group
  939.  
  940. Stuart Cheshire <cheshire@cs.stanford.edu> writes:
  941.  
  942. >Yesterday morning I wrote a little INIT which sets the File Manager
  943. >"don't cache" bit for disk writes of 1K or more. It does this by
  944. >installing the following patch on the _Write system call:
  945.  
  946. Question: what happens in the following circumstance?
  947.  
  948.    1)  A program reads some data in several chunks of 512 bytes each 
  949.        (or even reads it all in one big chunk), having as a side effect 
  950.        that a copy of the data is now present in the cache.
  951.  
  952.    2)  The program modifies the data, and writes it out in one large
  953.        chunk.  Because of your patch, the cache is bypassed.
  954.  
  955.    3)  The program re-reads the data.
  956.  
  957. Does the program get the stale data that was placed in the cache in
  958. step 1, or the updated data that was written in step 2?
  959.  
  960. -Ron Hunsinger
  961.  
  962. +++++++++++++++++++++++++++
  963.  
  964. >From jumplong@aol.com (Jump Long)
  965. Date: 14 Apr 1994 16:40:02 -0400
  966. Organization: America Online, Inc. (1-800-827-6364)
  967.  
  968. In article <0013ABED.fc@bmug.org>, Ron_Hunsinger@bmug.org (Ron Hunsinger)
  969. writes:
  970.  
  971. > Question: what happens in the following circumstance?
  972. >    1)  A program reads some data in several chunks of 512 bytes each 
  973. >        (or even reads it all in one big chunk), having as a side effect 
  974. >        that a copy of the data is now present in the cache.
  975. >    2)  The program modifies the data, and writes it out in one large
  976. >        chunk.  Because of your patch, the cache is bypassed.
  977. >    3)  The program re-reads the data.
  978. > Does the program get the stale data that was placed in the cache in
  979. > step 1, or the updated data that was written in step 2?
  980.  
  981. You don't need to worry about this because the Macintosh file system cache code
  982. takes care of making sure you get the correct data. Any writes that bypass the
  983. cache will remove those blocks from the cache so the read in your step 3 would
  984. come from the disk driver, not the cache.
  985.  
  986. So, the only way you can get data that's inconsistant with the file system
  987. cache is to bypass the file system and read directly from the disk driver.
  988. That's the reason we (Apple) tell developers of disk repair utilities to
  989. unmount a volume before they read the disk directly. Unmounting a volume
  990. flushes all dirty blocks (blocks that have been changes in the cache, but not
  991. on disk) to disk and then trashes all cache blocks associated with that volume.
  992.  
  993. - Jim Luther
  994.  
  995.  
  996. +++++++++++++++++++++++++++
  997.  
  998. >From rbauchsp@herbie.unl.edu (ROGER BAUCHSPIES)
  999. Date: 15 Apr 1994 06:34:42 GMT
  1000. Organization: University of Nebraska--Lincoln    
  1001.  
  1002. Jump Long (jumplong@aol.com) wrote:
  1003. : So, the only way you can get data that's inconsistant with the file system
  1004. : cache is to bypass the file system and read directly from the disk driver.
  1005. : That's the reason we (Apple) tell developers of disk repair utilities to
  1006. : unmount a volume before they read the disk directly. Unmounting a volume
  1007. : flushes all dirty blocks (blocks that have been changes in the cache, but not
  1008. : on disk) to disk and then trashes all cache blocks associated with that volume.
  1009.  
  1010. Apple should tell developers to do the same for SCSI drivers with 
  1011. caches. RapidTrak and Iomega SCSI drivers contain their own cache, 
  1012. which they do NOT flush when a volume is unmounted. This causes 
  1013. problems with programs that bypass the SCSI driver and talk directly 
  1014. to the disk. As a rule, any cache should stop caching a volume if it 
  1015. is not online.
  1016.  
  1017. Steve Kiene
  1018. MindVision Software
  1019.  
  1020. ---------------------------
  1021.  
  1022. >From pburgess@netcom.com (Phillip Burgess)
  1023. Subject: PowerMac Programming & the data bus
  1024. Date: Thu, 14 Apr 1994 06:37:27 GMT
  1025. Organization: NETCOM On-line Communication Services (408 241-9760 guest)
  1026.  
  1027. A couple of questions about programming on the Power Macintosh...
  1028.  
  1029. How can I best take advantage of the PowerMac's 64-bit path to memory when
  1030. working with 32-bit integer values?  If I'm writing a number of 32-bit
  1031. values to a contiguous chunk of memory, do they (or can they) get stored
  1032. in pairs about as quickly as storing half as many noncontiguous values?
  1033. If so, what sort of flaming hoops, if any, do I need to jump through?
  1034. If memory can be accessed in this fashion, what about writing 4 contiguous
  1035. 16-bit values, or 8 contiguous bytes?  Same effect?
  1036.  
  1037. Also, how many integer and FP registers am I likely to actually have at my
  1038. disposal when using a C compiler such as MetroWorks'?
  1039. -- 
  1040.   Phillip Burgess   (pburgess@netcom.com)
  1041.  
  1042. +++++++++++++++++++++++++++
  1043.  
  1044. >From zstern@adobe.com (Zalman Stern)
  1045. Date: Thu, 14 Apr 1994 08:53:31 GMT
  1046. Organization: Adobe Systems Incorporated
  1047.  
  1048. Phillip Burgess writes
  1049. > A couple of questions about programming on the Power Macintosh...
  1050. > How can I best take advantage of the PowerMac's 64-bit path to memory when
  1051. > working with 32-bit integer values?  If I'm writing a number of 32-bit
  1052. > values to a contiguous chunk of memory, do they (or can they) get stored
  1053. > in pairs about as quickly as storing half as many noncontiguous values?
  1054. > If so, what sort of flaming hoops, if any, do I need to jump through?
  1055. > If memory can be accessed in this fashion, what about writing 4 contiguous
  1056. > 16-bit values, or 8 contiguous bytes?  Same effect?
  1057.  
  1058. On the 601 (which I assume is what we're talking about here), the the cache  
  1059. sits between the processor and the 64 bit databus. The path between the  
  1060. fixed-point unit and the cache is only 32 bits wide. There is a 64 bit  
  1061. datapath between the floating-point unit and the cache. The cache  
  1062. stores/fetches entire 32 byte blocks to/from memory (or secondary cache) at  
  1063. a time. Hence each 32 bit write from the fixed-point unit does not result in  
  1064. a memory transaction if you are writing to contiguous addresses. Unless you  
  1065. are writing to uncached memory. In that case the only way to get 64 bit bus  
  1066. transactions on at least some (if not all) current hardware is to use  
  1067. floating-point loads and stores. That may be a win even if you have to add a  
  1068. couple of cached loads and stores to make it work (e.g. to handle misaligned  
  1069. cases).
  1070.  
  1071. For writing contiguous regions of cached memory, you'll want to look into  
  1072. the dcbz instruction. Normally when you write to an address that is not in  
  1073. the cache, the hardware fetches that block before handling the store. This  
  1074. is obviously necessary as the cache will want to store the entire 32 byte  
  1075. block later and if you only wrote 32 bits of that, the rest of the block has  
  1076. to be valid. The dcbz (data cache block zero) instruction says "I'm going to  
  1077. write the entire cache block around this address so just make me a cache  
  1078. block of zeros for that address." This has the effect of storing zero to all  
  1079. addresses covered by the cache block.
  1080.  
  1081. There are a couple difficulties with dcbz. The first is discovering the  
  1082. cache block size. This is important as the correctness of your code will  
  1083. depend upon this size. A second difficulty is writing code that can do the  
  1084. dcbz instruction for each cache block for different block sizes. You can  
  1085. either put conditional code in your loop, or punt and write two versions of  
  1086. the code: a fast one that works for 32 byte blocks, and one that doesn't use  
  1087. dcbz for other block sizes. A third difficulty is accessing this instruction  
  1088. from C code. You'll either need a compiler that supports inline assembly, or  
  1089. you'll have to hand code the inner loop. The potential win of all this is  
  1090. reducing your applications memory bandwidth by up to a third.
  1091. --
  1092. Zalman Stern           zalman@adobe.com            (415) 962 3824
  1093. Adobe Systems, 1585 Charleston Rd., POB 7900, Mountain View, CA 94039-7900
  1094. "Do right, and risk consequences." Motto of Sam Houston (via Molly Ivins)
  1095.  
  1096. +++++++++++++++++++++++++++
  1097.  
  1098. >From d88-jwa@mumrik.nada.kth.se (Jon Wdtte)
  1099. Date: 14 Apr 1994 08:58:58 GMT
  1100. Organization: The Royal Institute of Technology
  1101.  
  1102. In <pburgessCo8L2F.DzG@netcom.com> pburgess@netcom.com (Phillip Burgess) writes:
  1103.  
  1104. >A couple of questions about programming on the Power Macintosh...
  1105.  
  1106. I would suggest a good book on processor architecture.
  1107.  
  1108. >working with 32-bit integer values?  If I'm writing a number of 32-bit
  1109. >values to a contiguous chunk of memory, do they (or can they) get stored
  1110. >in pairs about as quickly as storing half as many noncontiguous values?
  1111.  
  1112. Pretty much. It's more notable when you read sequentially through memory.
  1113.  
  1114. >If so, what sort of flaming hoops, if any, do I need to jump through?
  1115.  
  1116. None.
  1117.  
  1118. >If memory can be accessed in this fashion, what about writing 4 contiguous
  1119. >16-bit values, or 8 contiguous bytes?  Same effect?
  1120.  
  1121. Yeah, but misaligned reads take some time fixing up, and you also need
  1122. eight separate read/write instructions instead of two if you do bytes
  1123. instead of long words.
  1124.  
  1125. >Also, how many integer and FP registers am I likely to actually have at my
  1126. >disposal when using a C compiler such as MetroWorks'?
  1127.  
  1128. About 25 of each.
  1129.  
  1130. Cheers,
  1131.  
  1132.                     / h+
  1133. -- 
  1134.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
  1135.  
  1136.    There's no problem that can't be solved using brute-force algorithms
  1137.    and a sufficiently fast computer. Ergo, buy more hardware.    (NOT!)
  1138.  
  1139. ---------------------------
  1140.  
  1141. >From hslari@gibbs.oit.unc.edu (Humayun Lari)
  1142. Subject: QuickDraw GX Questions
  1143. Date: 28 Mar 1994 19:03:43 GMT
  1144. Organization: University of North Carolina, Chapel Hill
  1145.  
  1146. I have a couple of user-oriented questions about writing a graphics program
  1147. that uses GX. I don't have any obvious answers to these questions, so I'm
  1148. hoping someone else does:
  1149.  
  1150. 1. Since QuickDraw GX uses quadratic curves, it seems like it's going to be
  1151. harder for users to edit GX paths than it is for users to edit Postscript
  1152. paths that use cubic curves -- a la FreeHand or Illustrator. I asked this
  1153. question a year ago, and Tom Dowdy replied to the effect that it didn't
  1154. matter, since the application could present a different model (e.g. cubic
  1155. curves) to the user. That's true, but how can cubic curves be converted
  1156. into quadratic curves without loss of accuracy? The GX libraries have a
  1157. routine that does the conversion, but its documentation indicates that the
  1158. result can be slightly off. Is this error acceptable?
  1159.  
  1160. 2. The GX libraries use a 1-pixel wide bitmap ramp to produce linear
  1161. blends. Is there an effective way to produce radial blends that doesn't 
  1162. require a huge bitmap and thus large storage requirements?
  1163.  
  1164. Appreciatively,
  1165.  
  1166. Humayun Lari
  1167. (lari@email.unc.edu)
  1168.  
  1169. +++++++++++++++++++++++++++
  1170.  
  1171. >From dowdy@apple.com (Tom Dowdy)
  1172. Date: Fri, 1 Apr 1994 17:51:35 GMT
  1173. Organization: Apple Computer, Inc.
  1174.  
  1175. In article <2n79mf$gcf@bigblue.oit.unc.edu>, hslari@gibbs.oit.unc.edu
  1176. (Humayun Lari) wrote:
  1177. > 1. Since QuickDraw GX uses quadratic curves, it seems like it's going to be
  1178. > harder for users to edit GX paths than it is for users to edit Postscript
  1179. > paths that use cubic curves -- a la FreeHand or Illustrator. I asked this
  1180. > question a year ago, and Tom Dowdy replied to the effect that it didn't
  1181. > matter, since the application could present a different model (e.g. cubic
  1182. > curves) to the user. That's true, but how can cubic curves be converted
  1183. > into quadratic curves without loss of accuracy? The GX libraries have a
  1184. > routine that does the conversion, but its documentation indicates that the
  1185. > result can be slightly off. Is this error acceptable?
  1186.  
  1187. Well, since the result can be within 1 pixel (and you can't draw smaller
  1188. than that, and GX is device independant), the error is generally
  1189. acceptable.
  1190. The libraries show the basics of what need to be done -- and are
  1191. fairly accurate.  But they are provided as SOURCE CODE, so it's easy
  1192. to improve them from there.
  1193.  
  1194. However, if you need to make sure that when converting to something
  1195. that "supports" cubics native (like PostScript -- although actually
  1196. PostScript always blits everything as lines, and has it's own 
  1197. error (curveerror) built in anyway) you attach to the shape a 
  1198. cubic tag, which GX will use in preference to the quadratic data
  1199. when printing to a device that supports it (except if you apply
  1200. a non-linear transform to it (see below)).
  1201.  
  1202. As far as editing goes, you can present any model you wish to the
  1203. user -- and I honestly think that users don't want to EDIT using
  1204. control points (be they for quads or cubics) anyway.  There are
  1205. other editing models that are easier to use and that normal
  1206. people will probably prefer.
  1207.  
  1208. The question of quads vs. cubics has lots of history, but basically
  1209. (as far as GX is concerned) ends up stopping when you consider
  1210. the following:
  1211.  - cubics can't be intersected with other shape (the math is too difficult)
  1212.  - cubics can't be inset or outside mathematically, nor simplified
  1213.  - PostScript's implementation doesn't allow for perspective
  1214. transformation,
  1215.    so the cubic data can't be used in this case.
  1216.  
  1217. Developers of a GX savvy application will probably want to use many
  1218. of these features to let the user create shapes by combining/removing
  1219. and distorting exiting shapes to create new ones.  And because it
  1220. isn't mathematically possible to do this with cubics, these applications
  1221. will need to convert shapes into quadratics for these operations.
  1222.  
  1223. > 2. The GX libraries use a 1-pixel wide bitmap ramp to produce linear
  1224. > blends. Is there an effective way to produce radial blends that doesn't 
  1225. > require a huge bitmap and thus large storage requirements?
  1226.  
  1227. Well, traditionally, blends aren't done with a bitmap, but with a
  1228. series of inset/outset shapes.  For Version 1.0 this the only way
  1229. to do radial blends.  This is how most applications do blends today.
  1230. Some do their blends in PostScript, when available, and you can still
  1231. do this with GX.  Simply attach a PostScript tag to the picture
  1232. shape containing your blend -- this tag will be used when possible,
  1233. and when it isn't possible, the picture shape data will be used.
  1234.  
  1235. Note that either of these methods is by it's nature device DEPENDANT.
  1236. This is no worse than today's world (with respect to these objects),
  1237. and maybe a bit better (due to more properly allowing alternate
  1238. representations).
  1239.  
  1240. A future version of GX will very likely provide a "multi-color" model
  1241. for shapes, which would also allow for this type of ramp.  But for
  1242. 1.0 we had to stop someplace :-)
  1243.  
  1244. -- 
  1245.  Tom Dowdy                  Internet: dowdy@apple.COM
  1246.  Apple Computer MS:302-3KS  UUCP: {sun,voder,amdahl,decwrl}!apple!dowdy
  1247.  1 Infinite Loop            AppleLink: DOWDY1
  1248.  Cupertino, CA 95014       
  1249.  "The 'Ooh-Ah' Bird is so called because it lays square eggs."
  1250.  
  1251. +++++++++++++++++++++++++++
  1252.  
  1253. >From hslari@gibbs.oit.unc.edu (Humayun Lari)
  1254. Date: 3 Apr 1994 00:17:21 GMT
  1255. Organization: University of North Carolina, Chapel Hill
  1256.  
  1257. In article <dowdy-010494090912@17.202.72.12>, Tom Dowdy <dowdy@apple.com>
  1258. wrote:
  1259. >As far as editing goes, you can present any model you wish to the
  1260. >user -- and I honestly think that users don't want to EDIT using
  1261. >control points (be they for quads or cubics) anyway.  There are
  1262. >other editing models that are easier to use and that normal
  1263. >people will probably prefer.
  1264.  
  1265. Tom, thank you for your detailed and thorough response. I'm very
  1266. appreciative, but a couple of your answers invite a couple more
  1267. questions...
  1268.  
  1269. I've worked with most of the major Macintosh drawing programs, and as far
  1270. as I know, none of them allow you to edit complex paths without using
  1271. cubic (or spline) control points. Sure, some of them allow you to draw
  1272. freehand and produce the path for you, but none provide a different
  1273. editing model that "normal people" would like. What kind of model are you
  1274. referring to?
  1275.  
  1276. >> 2. The GX libraries use a 1-pixel wide bitmap ramp to produce linear
  1277. >> blends. Is there an effective way to produce radial blends that doesn't 
  1278. >> require a huge bitmap and thus large storage requirements?
  1279. >
  1280. >Well, traditionally, blends aren't done with a bitmap, but with a
  1281. >series of inset/outset shapes.  For Version 1.0 this the only way
  1282. >to do radial blends.  This is how most applications do blends today.
  1283. >Some do their blends in PostScript, when available, and you can still
  1284. >do this with GX.  Simply attach a PostScript tag to the picture
  1285. >shape containing your blend -- this tag will be used when possible,
  1286. >and when it isn't possible, the picture shape data will be used.
  1287. >
  1288. >Note that either of these methods is by it's nature device DEPENDANT.
  1289. >This is no worse than today's world (with respect to these objects),
  1290. >and maybe a bit better (due to more properly allowing alternate
  1291. >representations).
  1292. >
  1293. >A future version of GX will very likely provide a "multi-color" model
  1294. >for shapes, which would also allow for this type of ramp.  But for
  1295. >1.0 we had to stop someplace :-)
  1296.  
  1297. But by using a bitmap, the ramp library converts colors into RGB; doesn't
  1298. this make it device dependent? Or am I missing something? Similarly, if
  1299. radial blends are produced using, say, a sequence of 32 circles, would it
  1300. be appropriate to convert the blend colors into RGB before computing the
  1301. circle colors? Or would a color system such as CIE be more desirable?
  1302.  
  1303. Humayun Lari
  1304. (lari@email.unc.edu)
  1305.  
  1306. +++++++++++++++++++++++++++
  1307.  
  1308. >From 103t_english@west.cscwc.pima.edu
  1309. Date: 4 Apr 94 20:38:42 MST
  1310. Organization: (none)
  1311.  
  1312. In article <dowdy-010494090912@17.202.72.12>, dowdy@apple.com (Tom Dowdy) writes:
  1313. > A future version of GX will very likely provide a "multi-color" model
  1314. > for shapes, which would also allow for this type of ramp.  But for
  1315. > 1.0 we had to stop someplace :-)
  1316. Speaking of stopping someplace, is there an AE Suite associated with the GX
  1317. API in the works?
  1318.  
  1319.  
  1320. Lawson
  1321.  
  1322. +++++++++++++++++++++++++++
  1323.  
  1324. >From dowdy@apple.com (Tom Dowdy)
  1325. Date: Fri, 8 Apr 1994 18:03:15 GMT
  1326. Organization: Apple Computer, Inc.
  1327.  
  1328. In article <2nl1uh$nj0@bigblue.oit.unc.edu>, hslari@gibbs.oit.unc.edu
  1329. (Humayun Lari) wrote:
  1330.  
  1331. > I've worked with most of the major Macintosh drawing programs, and as far
  1332. > as I know, none of them allow you to edit complex paths without using
  1333. > cubic (or spline) control points. Sure, some of them allow you to draw
  1334. > freehand and produce the path for you, but none provide a different
  1335. > editing model that "normal people" would like. What kind of model are you
  1336. > referring to?
  1337.  
  1338. Well, one such model is constructing curves and shapes via the mathematical
  1339. joining and differencing of other shapes.  Another is by "nudging" or
  1340. "pulling" on areas of the curve using a shaped tool.
  1341.  
  1342. These can easily be done using QuickDraw GX geometry operations, and for
  1343. many types of editing may be more obvious for users.  Without GX geometry
  1344. doing the "hard work" for you, most applications writers have resorted
  1345. to using cubic or quadratic editing.  However, when cubic editing
  1346. first came out -- artists couldn't figure out how to use it.  This
  1347. shows that the *users* changed towards the model that the applications
  1348. provided rather than the other way around.
  1349.  
  1350. I *still* can't edit shapes via splines of any kind.
  1351.  
  1352. > >Note that either of these methods is by it's nature device DEPENDANT.
  1353. > >This is no worse than today's world (with respect to these objects),
  1354. > >and maybe a bit better (due to more properly allowing alternate
  1355. > >representations).
  1356. > >
  1357. > >A future version of GX will very likely provide a "multi-color" model
  1358. > >for shapes, which would also allow for this type of ramp.  But for
  1359. > >1.0 we had to stop someplace :-)
  1360. > But by using a bitmap, the ramp library converts colors into RGB; doesn't
  1361. > this make it device dependent? Or am I missing something? Similarly, if
  1362. > radial blends are produced using, say, a sequence of 32 circles, would it
  1363. > be appropriate to convert the blend colors into RGB before computing the
  1364. > circle colors? Or would a color system such as CIE be more desirable?
  1365.  
  1366. Yes, this is device DEPENDANT in terms of resolution-- this is no 
  1367. worse than things are today.  This is what I said about.
  1368.  
  1369. However, it is still device indepedant with respect to color,
  1370. even when expressing colors via RGB space.
  1371.  
  1372. As far as what color space the colors should be expressed in -- this
  1373. is up to the application.  One of the wonderful things about GX
  1374. is that applications can express color in spaces that work best for
  1375. them and their users -- and GX takes care of converting to the
  1376. correct display or output space for you. Included in this is GX's 
  1377. ability to correctly color match the results.
  1378.  
  1379. For ramps, most folks work in HSV/HSL or other "intensity" or "value"
  1380. type spaces.  CIE space is a bit difficult to produce ramps in --
  1381. probably even more so than RGB space.  But the important point
  1382. here is that it doesn't really matter.  Express the color as
  1383. YOU want (note that this includes bitmaps, which can be in
  1384. any GX's color spaces).  
  1385.  
  1386. Even though everything except the CIE
  1387. family of spaces is technically a dependant color space, QuickDraw
  1388. GX allows all spaces to be calibrated through use of a gxColorProfile.
  1389. When you don't specifically provide a source color profile, QuickDraw
  1390. GX makes use of the default monitor profile provide via ColorSync.
  1391.  
  1392. -- 
  1393.  Tom Dowdy                  Internet: dowdy@apple.COM
  1394.  Apple Computer MS:302-3KS  UUCP: {sun,voder,amdahl,decwrl}!apple!dowdy
  1395.  1 Infinite Loop            AppleLink: DOWDY1
  1396.  Cupertino, CA 95014       
  1397.  "The 'Ooh-Ah' Bird is so called because it lays square eggs."
  1398.  
  1399. +++++++++++++++++++++++++++
  1400.  
  1401. >From lari@cs.unc.edu (Humayun Lari)
  1402. Date: 15 Apr 1994 13:41:01 -0400
  1403. Organization: The University of North Carolina at Chapel Hill
  1404.  
  1405. In article <dowdy-080494105252@17.202.72.12>,
  1406. Tom Dowdy <dowdy@apple.com> wrote:
  1407. >Well, one such model is constructing curves and shapes via the mathematical
  1408. >joining and differencing of other shapes.  Another is by "nudging" or
  1409. >"pulling" on areas of the curve using a shaped tool.
  1410. >
  1411. >These can easily be done using QuickDraw GX geometry operations, and for
  1412. >many types of editing may be more obvious for users.  Without GX geometry
  1413. >doing the "hard work" for you, most applications writers have resorted
  1414. >to using cubic or quadratic editing.  However, when cubic editing
  1415. >first came out -- artists couldn't figure out how to use it.  This
  1416. >shows that the *users* changed towards the model that the applications
  1417. >provided rather than the other way around.
  1418. >
  1419. >I *still* can't edit shapes via splines of any kind.
  1420.  
  1421. Unfortunately, since existing applications *do* use splines, it seems
  1422. likely that programmers are going to continue using cubics or quadratics.
  1423. Users, as you say, have become accustomed to this model, so they may
  1424. actually *dislike* replacements. Beta 3 of GX doesn't appear to have any
  1425. examples of user interfaces that allow "nudging" or "pulling", which seem
  1426. to have the potential to replace the spline model. Does anyone (Tom? :-))
  1427. know of papers on such interfaces or have examples of existing applications
  1428. on other platforms that use better models? It would be ironic to have the
  1429. power of GX limited by old paradigms.
  1430.  
  1431. Humayun Lari
  1432. (lari@cs.unc.edu)
  1433.  
  1434. ---------------------------
  1435.  
  1436. >From blume@twg.com (David Blume)
  1437. Subject: Quitting faceless background applications
  1438. Date: Wed, 13 Apr 1994 18:58:38 GMT
  1439. Organization: Gokuraku Videos - Wollongong Dept.
  1440.  
  1441. What is the prefered way for the user to quit a faceless background
  1442. application?  (Besides finding a way to generate a "Quit" Apple Event.)
  1443.  
  1444. Also, and more importantly, once the faceless background application
  1445. quits, how do we tell the finder to update the icon for the application?
  1446. (Even when faceless background applications quit, their icons in the finder
  1447. stay in the grayed out "in use" state.)
  1448.  
  1449. For an example, try quitting the "ledApp" application from the Dec Dev. CD.
  1450.  
  1451. Thanks!
  1452. --David
  1453. +---------------------------------------------------------------+
  1454. |  David Blume    |  "I get tired thinking of all the things I  |
  1455. |  blume@twg.com  |   don't want to do."  --Bukowski, _Barfly_  |
  1456. +---------------------------------------------------------------+
  1457.  
  1458. +++++++++++++++++++++++++++
  1459.  
  1460. >From Philippe.Casgrain@univ-rennes1.fr (Philippe Casgrain)
  1461. Date: Wed, 13 Apr 1994 21:58:48 +0100
  1462. Organization: Universite de Rennes-1, Fac. de medecine dentaire
  1463.  
  1464. In article <1994Apr13.185838.21434@twg.com>, blume@twg.com (David Blume)
  1465. wrote:
  1466.  
  1467. > What is the prefered way for the user to quit a faceless background
  1468. > application?  (Besides finding a way to generate a "Quit" Apple Event.)
  1469.     I like the way Greg Robbins did it in his "SmallDaemon" sample: if a
  1470. modifier key is detected at the same time an AppleEvent is received (he
  1471. used Caps Lock, but it could be anything), then quit the app.
  1472.     Thus, you could quit the FBA by double-clicking on it with the Caps Lock
  1473. key down.
  1474.  
  1475. > Also, and more importantly, once the faceless background application
  1476. > quits, how do we tell the finder to update the icon for the application?
  1477. > (Even when faceless background applications quit, their icons in the finder
  1478. > stay in the grayed out "in use" state.)
  1479.     I don't think you can, it's a bug in the Finder (or so I remember
  1480. reading... here ;-)
  1481.  
  1482. Philippe
  1483. -- 
  1484. Philippe.Casgrain@univ-rennes1.fr
  1485.     Mac Hacker Lite
  1486.  
  1487. +++++++++++++++++++++++++++
  1488.  
  1489. >From markhanrek@aol.com (MarkHanrek)
  1490. Date: 14 Apr 1994 03:11:07 -0400
  1491. Organization: America Online, Inc. (1-800-827-6364)
  1492.  
  1493. >> What is the prefered way for the user to quit a faceless background
  1494. >> application?  Also, how do we tell the finder to update the icon for the
  1495. >> application?
  1496.  
  1497. The Finder icon for a faceless bkgnd task does not go back to normal after the
  1498. bkgnd task terminates. This is a bug and there is no workaround that I have
  1499. heard of.
  1500.  
  1501. Also, I would say that there is no preferred way for a user to terminate a
  1502. faceless bkgnd task, since these applications have no user interface, and if
  1503. there was a way, that would imply a user interface.
  1504.  
  1505. I would say that background-only applications should quit themselves and be
  1506. more like "agents". That would be more fun, eh? :)
  1507.  
  1508. In any case, I guess "it depends on the situation". (Dontcha hate answers like
  1509. that? :)
  1510.  
  1511. Mark Hanrek
  1512.  
  1513.  
  1514. +++++++++++++++++++++++++++
  1515.  
  1516. >From rmcassid@uci.edu (Robert Cassidy)
  1517. Date: Thu, 14 Apr 1994 10:16:10 -0700
  1518. Organization: TLG Project
  1519.  
  1520. In article <2oiqab$e5o@search01.news.aol.com>, markhanrek@aol.com
  1521. (MarkHanrek) wrote:
  1522.  
  1523. > >> What is the prefered way for the user to quit a faceless background
  1524. > >> application?  Also, how do we tell the finder to update the icon for the
  1525. > >> application?
  1526. > The Finder icon for a faceless bkgnd task does not go back to normal after the
  1527. > bkgnd task terminates. This is a bug and there is no workaround that I have
  1528. > heard of.
  1529. > Also, I would say that there is no preferred way for a user to terminate a
  1530. > faceless bkgnd task, since these applications have no user interface, and if
  1531. > there was a way, that would imply a user interface.
  1532. > I would say that background-only applications should quit themselves and be
  1533. > more like "agents". That would be more fun, eh? :)
  1534. > In any case, I guess "it depends on the situation". (Dontcha hate answers like
  1535. > that? :)
  1536. > Mark Hanrek
  1537.  
  1538. Powertalk Manager runs as an appe all the time. I haven't found of any good
  1539. way of killing it (other than running one of my buggier programs which
  1540. kills EVERYTHING :-)  FYI, Malph is a program which displays a list of all
  1541. running processes. It also includes appe's in the list and using balloon
  1542. help you can get such goodies as SIZE, Signature, location in memory, etc.
  1543. - very cool.
  1544.  
  1545. -- 
  1546. Robert Cassidy
  1547. TLG Project
  1548. UC Irvine
  1549.  
  1550. Let's hope 'Information SuperTollroad' isn't the catchphrase of the next
  1551. decade...
  1552.  
  1553. +++++++++++++++++++++++++++
  1554.  
  1555. >From David Casseres <casseres@apple.com>
  1556. Date: Thu, 14 Apr 1994 22:40:29 GMT
  1557. Organization: Apple Computer, Inc.
  1558.  
  1559. In article <2oiqab$e5o@search01.news.aol.com> MarkHanrek, markhanrek@aol.com
  1560. writes:
  1561. > >> What is the prefered way for the user to quit a faceless background
  1562. > >> application?  Also, how do we tell the finder to update the icon for the
  1563. > >> application?
  1564. > The Finder icon for a faceless bkgnd task does not go back to normal after
  1565. the
  1566. > bkgnd task terminates. This is a bug and there is no workaround that I have
  1567. > heard of.
  1568. > Also, I would say that there is no preferred way for a user to terminate a
  1569. > faceless bkgnd task, since these applications have no user interface, and if
  1570. > there was a way, that would imply a user interface.
  1571. > I would say that background-only applications should quit themselves and be
  1572. > more like "agents". That would be more fun, eh? :)
  1573.  
  1574. Yeah, I think the whole original question is a bit confused.  If it's faceless
  1575. then *by definition* the user has no way to interact with it.  I'd say there
  1576. are really two categories of faceless background apps:
  1577.  
  1578. 1.  System extensions, which are started by the system at startup and killed
  1579. at shutdown (though they may also be designed to quit themselves).  Their
  1580. icons never change in appearance, and the user doesn't normally look at them
  1581. since they're hidden away in the Extensions folder.
  1582.  
  1583. 2.  Programs that are launched by other programs and then controlled by them. 
  1584. The controlling program, assuming it has a user interface, might give the user
  1585. a way to kill the faceless background process.  When a program is launched by
  1586. some other program (not the Finder), its icon does not change in appearance.
  1587.  
  1588. I think maybe the original poster was thinking about a program with a
  1589. *minimal* user interface.  You can get away with no user interface except a
  1590. menu, which could contain a "Quit" item.  To do this the program should be a
  1591. normal Mac application, type 'APPL', launched normally by the Finder.  It
  1592. should be able to run both in foreground and background, since of course its
  1593. menu will only appear in the foreground.  The user can bring it to the
  1594. foreground by using the Finder's Application menu.
  1595.  
  1596. - -----------
  1597.  
  1598. David Casseres
  1599. Exclaimer: Hey!
  1600.  
  1601. +++++++++++++++++++++++++++
  1602.  
  1603. >From jumplong@aol.com (Jump Long)
  1604. Date: 15 Apr 1994 00:48:08 -0400
  1605. Organization: America Online, Inc. (1-800-827-6364)
  1606.  
  1607. In article <1994Apr13.185838.21434@twg.com>, blume@twg.com (David Blume)
  1608. writes:
  1609.  
  1610. > What is the prefered way for the user to quit a faceless background
  1611. > application?  (Besides finding a way to generate a "Quit" Apple Event.)
  1612.  
  1613. Since faceless background applications don't have a user interface, you'll have
  1614. to send it a quit Apple event to tell it to shut down (or send it a signal some
  1615. other way).
  1616.  
  1617. > Also, and more importantly, once the faceless background application
  1618. > quits, how do we tell the finder to update the icon for the application?
  1619. > (Even when faceless background applications quit, their icons in the finder
  1620. > stay in the grayed out "in use" state.)
  1621.  
  1622. If the faceless background application is of file type 'APPL', then there's
  1623. nothing you can do about the grayed out icon.  The Finder doesn't track the
  1624. state of faceless background applications correctly (as pointed out by others).
  1625.  However, there's nothing forcing you to use type 'APPL'.
  1626.  
  1627. If you want the application automatically launched at system startup time, you
  1628. can use a file type of 'appe'.  If you use 'appe', then the Finder will
  1629. automatically put the application in the Extensions folder when the application
  1630. is dropped on the System Folder and the application will be launched a startup
  1631. time.
  1632.  
  1633. If you *don't* want the application launched at system startup time, you can
  1634. use just about any other file type that makes sense to you (don't use anything
  1635. goffy like 'TEXT'), but you'll have to launch the application yourself.
  1636.  
  1637. Here's an real-life example... The File Sharing Extension is an 'INIT' file in
  1638. the Extensions folder that implements Macintosh File Sharing.  The File Sharing
  1639. Extension contains an 'INIT' resource which installs the parts of the file
  1640. server software that always need to be available including the _ServerDispatch
  1641. (A094) trap.  One of the routines implemented through _ServerDispatch is
  1642. SCStartServer.  When SCStartServer is called, the trap code launches the file
  1643. server application.  Guess where the file server application code is?  It's in
  1644. the File Sharing Extension file (if you don't believe me, just look).
  1645.  
  1646. So, you could do something similar.  You'd just need to use a small application
  1647. to control your faceless background application.  The controlling application
  1648. would launch the faceless background application to start it and send the
  1649. faceless background application a quit Apple event when it needed to shut it
  1650. down.
  1651.  
  1652. - Jim Luther
  1653.  
  1654.  
  1655. ---------------------------
  1656.  
  1657. End of C.S.M.P. Digest
  1658. **********************
  1659.  
  1660.