home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Information / CSMP Digest / volume 1 / csmp-v1-177.txt < prev    next >
Encoding:
Text File  |  1994-12-08  |  46.5 KB  |  1,213 lines  |  [TEXT/R*ch]

  1. C.S.M.P. Digest             Mon, 05 Oct 92       Volume 1 : Issue 177
  2.  
  3. Today's Topics:
  4.  
  5.     How do you acess chooser username??
  6.     MacINTERCOMM Invisible Xfers! (PR)
  7.     Things That May Become Dim
  8.     GDevices:  screenActive flag?
  9.     reducing TCL project size
  10.     faceless background app's.
  11.     2 simple questions about locked blocks
  12.  
  13.  
  14.  
  15. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  16.  
  17. The digest is a collection of article threads from the internet newsgroup
  18. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  19. regularly and want an archive of the discussions.  If you don't know what a
  20. newsgroup is, you probably don't have access to it.  Ask your systems
  21. administrator(s) for details.  (This means you can't post questions to the
  22. digest.)
  23.  
  24. Each issue of the digest contains one or more sets of articles (called
  25. threads), with each set corresponding to a 'discussion' of a particular
  26. subject.  The articles are not edited; all articles included in this digest
  27. are in their original posted form (as received by our news server at
  28. cs.uoregon.edu).  Article threads are not added to the digest until the last
  29. article added to the thread is at least one month old (this is to ensure that
  30. the thread is dead before adding it to the digest).  Article threads that
  31. consist of only one message are generally not included in the digest.
  32.  
  33. The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
  34. [128.223.8.8] in the directory /pub/mac/csmp-digest.  Be sure to read the
  35. file /pub/mac/csmp-digest/README before downloading any files.  The most
  36. recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the
  37. directory /info-mac/digest/csmp.  If you don't have ftp capability, the sumex
  38. archive has a mail server; send a message with the text '$MACarch help' (no
  39. quotes) to LISTSERV@ricevm1.rice.edu for more information.
  40.  
  41. The digest is also available via email.  Just send a note saying that you
  42. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  43. automatically receive each new issue as it is created.  Sorry, back issues
  44. are not available through the mailing list.
  45.  
  46. Send administrative mail to mkelly@cs.uoregon.edu.
  47.  
  48.  
  49. -------------------------------------------------------
  50.  
  51. From: mshields%peruvian.utah.edu@cs.utah.edu (Michael S Shields)
  52. Subject: How do you acess chooser username??
  53. Date: 18 Jul 92 04:29:27 MDT
  54. Organization: University of Utah CS Dept
  55.  
  56. How do you do this?? I can't seem to find even a mention of the chooser user-
  57. name anywhere.(IM, Think Reference, Prog. Primer).  I know it can be done.
  58.  
  59. Thanks,
  60. Mike
  61.  
  62.  
  63.  
  64. +++++++++++++++++++++++++++
  65.  
  66. From: tinsel@nyx.cs.du.edu (Thomas Insel)
  67. Organization: University of Denver, Dept. of Math & Comp. Sci.
  68. Date: Sat, 18 Jul 92 19:09:14 GMT
  69.  
  70. mshields%peruvian.utah.edu@cs.utah.edu (Michael S Shields) writes:
  71.  
  72. >How do you do this?? I can't seem to find even a mention of the chooser user-
  73. >name anywhere.(IM, Think Reference, Prog. Primer).  I know it can be done.
  74.  
  75. It's a STR resource somewhere in the System file.  I don't remember the
  76. number, but you can set the username to something unique, then search
  77. through the System w/ Resedit until you find it. 
  78. - --
  79. Thomas Insel (tinsel@nyx.cs.du.edu, tinsel@uiuc.edu)
  80.  
  81. +++++++++++++++++++++++++++
  82.  
  83. From: pbrande1@cc.swarthmore.edu (Philip Brandenberger)
  84. Organization: Swarthmore College
  85. Date: Sun, 19 Jul 1992 03:15:40 GMT
  86.  
  87. tinsel@uiuc.edu writes:
  88. > mshields%peruvian.utah.edu@cs.utah.edu (Michael S Shields) writes:
  89. > >How do you do this?? I can't seem to find even a mention of the chooser user-
  90. > >name anywhere.(IM, Think Reference, Prog. Primer).  I know it can be done.
  91. > It's a STR resource somewhere in the System file.  I don't remember the
  92. > number, but you can set the username to something unique, then search
  93. > through the System w/ Resedit until you find it. 
  94. > --
  95. > Thomas Insel (tinsel@nyx.cs.du.edu, tinsel@uiuc.edu)
  96.  
  97. 'STR ' # -16096, but watch modifying it!  If you do, make sure
  98. the name does not exceed 32 chars, that's 31 plus the length byte.
  99.  
  100. This is documented in IM Vol. VI, BTW.
  101.  
  102. - -Phil
  103.  
  104.  
  105. - -- 
  106. Philip J. Brandenberger
  107. Swarthmore College, but I don't speak for it, in fact usually against it.
  108. pbrande1@cc.swarthmore.edu
  109.  
  110. +++++++++++++++++++++++++++
  111.  
  112. From: vkwx@vax5.cit.cornell.edu (Ed Swierk)
  113. Date: 19 Jul 92 00:56:25 EDT
  114. Organization: Cornell University
  115.  
  116. In article <1992Jul18.042927.5829@hellgate.utah.edu>,
  117. mshields%peruvian.utah.edu@cs.utah.edu (Michael S Shields) writes: 
  118. > How do you do this?? I can't seem to find even a mention of the chooser user-
  119. > name anywhere.(IM, Think Reference, Prog. Primer).  I know it can be done.
  120.  
  121. Check 'STR ' resource #-16096, found in the System file.
  122.  
  123. - -- 
  124.                 Ed Swierk
  125.        Cornell University
  126. vkwx@vax5.cit.cornell.edu
  127.  
  128. +++++++++++++++++++++++++++
  129.  
  130. From: peirce@outpost.SF-Bay.org (Michael Peirce)
  131. Date: 19 Jul 92 19:41:17 GMT
  132. Organization: Peirce Software
  133.  
  134.  
  135. In article <1992Jul19.005625.13813@vax5.cit.cornell.edu> (comp.sys.mac.programmer), vkwx@vax5.cit.cornell.edu (Ed Swierk) writes:
  136. > In article <1992Jul18.042927.5829@hellgate.utah.edu>,
  137. > mshields%peruvian.utah.edu@cs.utah.edu (Michael S Shields) writes: 
  138. > > How do you do this?? I can't seem to find even a mention of the chooser user-
  139. > > name anywhere.(IM, Think Reference, Prog. Primer).  I know it can be done.
  140. > Check 'STR ' resource #-16096, found in the System file.
  141.  
  142. Right, but...
  143.  
  144. Remember that under System 7, there really isn't a Chooser Name any
  145. more.  Rather there is an owner name and a machine name.
  146.  
  147. The owner name is stored in STR ID = -16096, the same as the old Chooser
  148. Name.
  149.  
  150. The machine name is stored in STR ID = 16413.
  151.  
  152. The nature of your use of the Chooser name dictates if the new owner
  153. name or the new machine name is most appropriate for you use.
  154.  
  155. Also remember that the owner name and machine name are not set in the
  156. Chooser any more, but rather in the Sharing Setup Control Panel.  Using
  157. the term "Chooser Name" will confuse users on System 7, they won't
  158. have any idea of what you are talking about.
  159.  
  160. - --  Michael Peirce      --   peirce@outpost.SF-Bay.org
  161. - --  Peirce Software     --   Suite 301, 719 Hibiscus Place
  162. - --                      --   San Jose, California USA 95117
  163. - --  Makers of...        --   voice: (408) 244-6554 fax: (408) 244-6882
  164. - --            SMOOTHIE  --   AppleLink: peirce & America Online: AFC Peirce
  165.  
  166. +++++++++++++++++++++++++++
  167.  
  168. From: wardw@CS.ColoState.EDU (william bradley ward)
  169. Date: 19 Jul 92 19:14:53 GMT
  170. Organization: Colorado State University
  171.  
  172. Does anybody have, or know where I can get, a list of system resources -
  173. ids and what they are?
  174.  
  175. Also, does anybody know how I can a change the string in the "About this Macintosh..." window that tells you what kind of machine you have?
  176.  
  177. Thanks,
  178.  
  179. Brad
  180. wardw@mozart.cs.colostate.edu
  181.  
  182. +++++++++++++++++++++++++++
  183.  
  184. From: blackbox@pfunk.hanse.de (Michael Kistenmacher)
  185. Date: 20 Jul 92 10:11:31 GMT
  186. Organization: Blackbox Inc.
  187.  
  188.  
  189. In article <1992Jul18.190914.26404@mnemosyne.cs.du.edu> (comp.sys.mac.programmer), tinsel@nyx.cs.du.edu (Thomas Insel) writes:
  190. >mshields%peruvian.utah.edu@cs.utah.edu (Michael S Shields) writes:
  191. >
  192. >>How do you do this?? I can't seem to find even a mention of the chooser user-
  193. >>name anywhere.(IM, Think Reference, Prog. Primer).  I know it can be done.
  194. >
  195. >It's a STR resource somewhere in the System file.  I don't remember the
  196. >number, but you can set the username to something unique, then search
  197. >through the System w/ Resedit until you find it. 
  198.  
  199. Here you have some sample code from the Think C libraries. I hope
  200. Symantec allows to post it.
  201.  
  202. - ----------cut------------
  203.  
  204. char *
  205. getlogin(void)
  206. {
  207.     static char got_it, buf[33];
  208.     short refnum;
  209.     Handle h;
  210.     
  211.     if (!got_it) {
  212.         refnum = CurResFile();
  213.         UseResFile(0);
  214.         h = GetResource('STR ', -16096);
  215.         UseResFile(refnum);
  216.         if (h) {
  217.             HLock(h);
  218.             sprintf(buf, "%#.*s", (int) sizeof buf - 1, *h);
  219.             HUnlock(h);
  220.         }
  221.         got_it = 1;
  222.     }
  223.     return(buf[0] ? buf : NULL);
  224. }
  225.  
  226. - ------------end---------------
  227.  
  228. - ---
  229. - -----------------------------------
  230. ( Michael Kistenmacher / blackbox )
  231. (  Germany  /  ++ 49 40 552 37 66 )
  232. - -----------------------------------
  233.  
  234. +++++++++++++++++++++++++++
  235.  
  236. From: larrym@mtxinu.COM (Larry Meyer - mac weenie)
  237. Date: 22 Jul 92 17:59:43 GMT
  238. Organization: Xinet, Berkeley
  239.  
  240. In article <1992Jul18.190914.26404@mnemosyne.cs.du.edu> tinsel@uiuc.edu writes:
  241. >mshields%peruvian.utah.edu@cs.utah.edu (Michael S Shields) writes:
  242. >
  243. >>How do you do this?? I can't seem to find even a mention of the chooser user-
  244. >>name anywhere.(IM, Think Reference, Prog. Primer).  I know it can be done.
  245. >
  246. >It's a STR resource somewhere in the System file.  I don't remember the
  247. >number, but you can set the username to something unique, then search
  248. >through the System w/ Resedit until you find it. 
  249. >--
  250. >Thomas Insel (tinsel@nyx.cs.du.edu, tinsel@uiuc.edu)
  251.  
  252. It's 'STR ' resource number -16096 in the System file; (I can't find the
  253. documentation for this magic cookie).
  254. - -- 
  255. /*************************************************************
  256. Larry Meyer Mac/Unix Programmer @ Xinet, Berkeley CA
  257. larrym@xinet.com (ask me about max<->unix stuff)
  258. *************************************************************/
  259.  
  260. +++++++++++++++++++++++++++
  261.  
  262. From: erh0362@tesla.njit.edu (Elliotte Rusty Harold)
  263. Date: 25 Jul 92 14:40:08 GMT
  264. Organization: New Jersey Institute of Technology
  265.  
  266. In article <1992Jul22.175943.14696@mtxinu.COM>, larrym@mtxinu.COM (Larry Meyer - mac weenie) writes:
  267. > In article <1992Jul18.190914.26404@mnemosyne.cs.du.edu> tinsel@uiuc.edu writes:
  268. >>mshields%peruvian.utah.edu@cs.utah.edu (Michael S Shields) writes:
  269. >>
  270. >>>How do you do this?? I can't seem to find even a mention of the chooser user-
  271. >>>name anywhere.(IM, Think Reference, Prog. Primer).  I know it can be done.
  272. >>
  273.     Think C includes a function char* getlogin(void) intended to mimic the 
  274. Unix function getlogin.  It returns exactly what you're looking for, i.e. the 
  275. username set in the chooser desk accessory.  It's documented on p. 191 pf the 
  276. Standard Libraries reference in the Think C 4 manuals.  You'll need to 
  277. #include<unix.h> and either add the Unix library to your project or the 
  278. appropriate function from unixmisc.c to your source code.  This is all under 
  279. Think C 4.05.  Details may have changed under 5.0 but I imagine at least the 
  280. functionality is still there.
  281.  
  282. Elliotte Rusty Harold        Department of Applied Mathematics
  283. elharo@m.njit.edu        New Jersey Institute of Technology
  284. erh0362@tesla.njit.edu        Newark, NJ 07103
  285.  
  286. ---------------------------
  287.  
  288. From: peterc@cubetech.com (Peter Creath)
  289. Subject: MacINTERCOMM Invisible Xfers! (PR)
  290. Date: 20 Jul 92 11:43:13 GMT
  291. Organization: Cube Technologies
  292.  
  293.  
  294. In article <1992Jul19.113921.1@pomona.claremont.edu> (comp.sys.mac.comm), wprice@pomona.claremont.edu writes:
  295. > MacIntercomm Delivers Invisible File Transfers
  296. >  
  297. > Contact:
  298. > Mercury Systems, Inc.
  299. > Chad Laurendeau
  300. > VP Operations
  301. > 10000 Santa Monica Blvd. Suite 123
  302. > Los Angeles, CA  90067
  303. > (310)553-0881
  304. > LOS ANGELES, CA - July 6, 1992 P Mercury Systems today announced MacIntercomm,
  305. > a full-featured multitasking telecommunications program that lets Macintosh
  306. > computer users transfer files completely in the background even during the most
  307. > intensive tasks.  The product will ship in August, 1992.
  308. > MacIntercomm combines ease of use with power and flexibility never before
  309. > thought possible on the Macintosh.  Its most exciting feature: true
  310. > multitasking.  File transfers will no longer fail simply because the user is
  311. > involved in a complex task in the foreground application.  MacIntercomm has the
  312. > power to intelligently distribute processing power between applications.  This
  313. > insures that it always gets just enough time to keep file transfers running at
  314. > their fastest possible speed yet enables it to remain virtually invisible to
  315. > other programs.   The result: no noticeable slowdown by either program.
  316. > Existing programs in the communications market claim to run in the background,
  317. > but if the foreground application is processor-intensive (such as a
  318. > spreadsheet, compression program, database, or even a game), the file transfer
  319. > will grind to a halt and usually fail.  Not so with MacIntercomm.
  320. [rest deleted, see comp.sys.mac.comm]
  321.  
  322. Now how do they do that?  Take a look at SystemTicks() since last
  323. resumeEvent and use a proportional amount of time before releasing
  324. control?  And they claim this works on processor-intensive tasks.
  325. Does that include a lengthy for...next loop where WaitNextEvent is
  326. not called?  Does that include pulled down menus?
  327.  
  328. Inquiring minds want to know.  (Well, at least one inquiring mind
  329. does.)
  330.  
  331. - ----------------------------------------------------------------------------
  332. Peter Creath                 "When I was a boy I was told that anybody could
  333. peterc@cubetech.com           become president; I'm beginning to believe it."
  334.                                                            -- Clarence Darrow
  335.  
  336. +++++++++++++++++++++++++++
  337.  
  338. From: leonardr@ccs.itd.umich.edu
  339. Organization: Campus Computing Sites, University of Michigan-Ann Arbor
  340. Date: Mon, 20 Jul 92 19:21:51 GMT
  341.  
  342. In article <dx3uv972.90480s@moebius.cubetech.com> peterc@cubetech.com writes:
  343. >
  344. >In article <1992Jul19.113921.1@pomona.claremont.edu> (comp.sys.mac.comm), wprice@pomona.claremont.edu writes:
  345. >> 
  346. >> MacIntercomm Delivers Invisible File Transfers
  347. >>  
  348. >> Its most exciting feature: true
  349. >> multitasking.  File transfers will no longer fail simply because the user is
  350. >> involved in a complex task in the foreground application.  MacIntercomm has the
  351. >> power to intelligently distribute processing power between applications.  This
  352. >> insures that it always gets just enough time to keep file transfers running at
  353. >> their fastest possible speed yet enables it to remain virtually invisible to
  354. >> other programs.   The result: no noticeable slowdown by either program.
  355. >> 
  356. >> Existing programs in the communications market claim to run in the background,
  357. >> but if the foreground application is processor-intensive (such as a
  358. >> spreadsheet, compression program, database, or even a game), the file transfer
  359. >> will grind to a halt and usually fail.  Not so with MacIntercomm.
  360. >[rest deleted, see comp.sys.mac.comm]
  361. >
  362. >Now how do they do that?  Take a look at SystemTicks() since last
  363. >resumeEvent and use a proportional amount of time before releasing
  364. >control?  And they claim this works on processor-intensive tasks.
  365. >Does that include a lengthy for...next loop where WaitNextEvent is
  366. >not called?  Does that include pulled down menus?
  367. >
  368.     They use two standard tricks and one new one.
  369.  
  370.     The most common ways of doing "real" background transfers is to use
  371. a series chained completion routines as part of your async I/O - that way you
  372. get called during interrupt time and can keep on processing.  Another common
  373. trick, the MacIntercomm also does is to use VBL's to perform common interval
  374. tasking.
  375.  
  376.     The "new trick" that they use is to write their own memory manager
  377. so that they can do things like moving memory at interrupt time!!!  Yes, you
  378. heard me correctly, they DO NOT use the Memory manager - they have written 
  379. their own as "Apple's is too inflexible for our needs".
  380.  
  381. NOTE: This information is based on a conversation with the lead engineer of
  382. MacIntercomm, Frank Price.  Some of you may know Frank from his Hermes BBS.
  383.  
  384. - -- 
  385. - -----------------------------------------------------------------------
  386. Leonard Rosenthol          Internet: leonardr@ccs.itd.umich.edu
  387. Director of Advanced Technology   AppleLink: MACgician
  388. Aladdin Systems, inc.          GEnie:     MACgician
  389.  
  390. +++++++++++++++++++++++++++
  391.  
  392. From: sold@kit.uni-kl.de (Christoph Sold)
  393. Organization: Universitaet Kaiserslautern
  394. Date: Mon, 20 Jul 1992 20:13:01 GMT
  395.  
  396. In article <dx3uv972.90480s@moebius.cubetech.com> peterc@cubetech.com (Peter Creath) writes:
  397. >From: peterc@cubetech.com (Peter Creath)
  398. >Subject: Re: MacINTERCOMM Invisible Xfers! (PR)
  399. >Date: 20 Jul 92 11:43:13 GMT
  400.  
  401.  
  402. >In article <1992Jul19.113921.1@pomona.claremont.edu> (comp.sys.mac.comm), wprice@pomona.claremont.edu writes:
  403. >> 
  404. >> MacIntercomm Delivers Invisible File Transfers
  405. >>  
  406. >> Contact:
  407. >> Mercury Systems, Inc.
  408. >> Chad Laurendeau
  409. >> VP Operations
  410. >> 10000 Santa Monica Blvd. Suite 123
  411. >> Los Angeles, CA  90067
  412. >> (310)553-0881
  413. >> 
  414. >> 
  415. >> LOS ANGELES, CA - July 6, 1992 P Mercury Systems today announced MacIntercomm,
  416. >> a full-featured multitasking telecommunications program that lets Macintosh
  417. >> computer users transfer files completely in the background even during the most
  418. >> intensive tasks.  The product will ship in August, 1992.
  419. >> 
  420. >> MacIntercomm combines ease of use with power and flexibility never before
  421. >> thought possible on the Macintosh.  Its most exciting feature: true
  422. >> multitasking.  File transfers will no longer fail simply because the user is
  423. >> involved in a complex task in the foreground application.  MacIntercomm has the
  424. >> power to intelligently distribute processing power between applications.  This
  425. >> insures that it always gets just enough time to keep file transfers running at
  426. >> their fastest possible speed yet enables it to remain virtually invisible to
  427. >> other programs.   The result: no noticeable slowdown by either program.
  428. >> 
  429. >> Existing programs in the communications market claim to run in the background,
  430. >> but if the foreground application is processor-intensive (such as a
  431. >> spreadsheet, compression program, database, or even a game), the file transfer
  432. >> will grind to a halt and usually fail.  Not so with MacIntercomm.
  433. >[rest deleted, see comp.sys.mac.comm]
  434.  
  435. >Now how do they do that?  Take a look at SystemTicks() since last
  436. >resumeEvent and use a proportional amount of time before releasing
  437. >control?  And they claim this works on processor-intensive tasks.
  438. >Does that include a lengthy for...next loop where WaitNextEvent is
  439. >not called?  Does that include pulled down menus?
  440.  
  441. >Inquiring minds want to know.  (Well, at least one inquiring mind
  442. >does.)
  443.  
  444. >----------------------------------------------------------------------------
  445. >Peter Creath                 "When I was a boy I was told that anybody could
  446. >peterc@cubetech.com           become president; I'm beginning to believe it."
  447. >                                                           -- Clarence Darrow
  448.  
  449.  
  450. Given a lot of buffer memory, you can do amazing things at interrupt time...
  451. But things get worse if the bufer overflows. :-(
  452.  
  453. - -Christoph
  454.  
  455.  
  456. Christoph P. Sold                   CATS Software GmbH
  457.                                     Mussbacher Landstr.2
  458.                                     W-6730 Neustadt (Weinstrasse)
  459. ger.xse0035@applelink.apple.com     Germany
  460.  
  461. "If an apple is fun, what the heck is an appletree?"
  462.  
  463. +++++++++++++++++++++++++++
  464.  
  465. From: davidp@calvin.usc.edu (David Peterson)
  466. Date: 21 Jul 92 04:51:38 GMT
  467. Organization: University of Southern California, Los Angeles, CA
  468.  
  469.  
  470. In article <sold.30.711663181@kit.uni-kl.de>, sold@kit.uni-kl.de (Christoph Sold) writes:
  471. |> 
  472. |> Given a lot of buffer memory, you can do amazing things at interrupt time...
  473. |> But things get worse if the bufer overflows. :-(
  474. |> 
  475. |> -Christoph
  476. |> 
  477.  
  478. You don`t need to buffer the file transfer, just the options negotiation.
  479. After you've decided what the file is named and where it is going, make all
  480. subsequent read call asyncronous and have thier completion procs turn around
  481. and do an asyncronous PBWrite and have its completion proc turn around and
  482. to another asycronous read.
  483.  
  484. I've gotten this to work with MacTCP, I don't see why it won't work with
  485. serial lines, ADSP, PPCToolbox, or anything else.
  486.  
  487. - -dave.
  488.  
  489. +++++++++++++++++++++++++++
  490.  
  491. From: d88-jwa@dront.nada.kth.se (Jon W{tte)
  492. Date: 21 Jul 92 22:15:23 GMT
  493. Organization: Royal Institute of Technology, Stockholm, Sweden
  494.  
  495. > davidp@calvin.usc.edu (David Peterson) writes:
  496.  
  497.    You don`t need to buffer the file transfer, just the options negotiation.
  498.    After you've decided what the file is named and where it is going, make all
  499.    subsequent read call asyncronous and have thier completion procs turn around
  500.    and do an asyncronous PBWrite and have its completion proc turn around and
  501.    to another asycronous read.
  502.  
  503. Wouldn't it be even faster if you did something like
  504. queueing BOTH the next read and the next write from
  505. the completion proc, and the the one that finishes
  506. the latest of them queue the next read/write etc ?
  507. This of course requires two buffers, but should be
  508. quite doable and (theoretically, i.e. from one
  509. floppy to another) be twice as fast !
  510.  
  511. - -- 
  512.          Jon W{tte, Svartmangatan 18, S-111 29 Stockholm, Sweden
  513.  
  514. ### You have the Easy Access virus. This virus may cause strange sounds
  515. ### and weird keyboard behaviour when you press the shift key repeatedly.
  516.  
  517. +++++++++++++++++++++++++++
  518.  
  519. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  520. Date: 21 Jul 92 22:12:47 GMT
  521. Organization: Kalamazoo College
  522.  
  523. d88-jwa@dront.nada.kth.se (Jon W{tte) writes:
  524. >
  525. >Wouldn't it be even faster if you did something like
  526. >queueing BOTH the next read and the next write from
  527. >the completion proc, and the the one that finishes
  528. >the latest of them queue the next read/write etc ?
  529.  
  530. Ah yes (deep breath of fresh air)--this is exactly what we learned in
  531. our File Structures class.  This is exactly what you should do!
  532.  
  533. >This of course requires two buffers, but should be
  534. >quite doable and (theoretically, i.e. from one
  535. >floppy to another) be twice as fast !
  536.  
  537. Aaaaaaaaahhhh (reality slams in)--everything I learned was _useless_!
  538. When will we be able to heapsort without pausing during reads from
  539. disk?  When will huge Mac database programs get to be anything but a
  540. joke?  When will I be able to smoothly scroll my word processor while
  541. the Finder makes a copy of my hard disk?  When will the IIfx (RIP)
  542. get to _use_ its DMA circuitry?  When can I stop saying "but at least it
  543. accesses the _floppies_ asynchronously"?
  544.  
  545. Alas (sobbing)--when O when will my IBM-programming friends stop
  546. sniggering at my _totally_synchronous_ operating system?
  547. - -- 
  548.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  549.  He let the contents of the bottle do the thinking
  550.  Can't shake the devil's hand and say you're only kidding            - TMBG
  551.  
  552. +++++++++++++++++++++++++++
  553.  
  554. From: Harry_Noel@wtgdir.UUCP (Harry Noel)
  555. Date: Tue, 21 Jul 92 17:06:54 GMT
  556. Organization: MCCS
  557.  
  558.  
  559. In article <1992Jul20.192151.5278@terminator.cc.umich.edu> (comp.sys.mac.programmer), leonardr@ccs.itd.umich.edu writes:
  560. > NOTE: This information is based on a conversation with the lead engineer of
  561. > MacIntercomm, Frank Price.  Some of you may know Frank from his Hermes BBS.
  562. > -- 
  563. > -----------------------------------------------------------------------
  564. > Leonard Rosenthol          Internet: leonardr@ccs.itd.umich.edu
  565. > Director of Advanced Technology   AppleLink: MACgician
  566. > Aladdin Systems, inc.          GEnie:     MACgician
  567.  
  568.  
  569. Well... As one who has seen first hand how he releases versions of
  570. his software still containing the same bugs as the beta versions.
  571. I would not bet the farm on this one.  He knew about 5 'major' bugs
  572. in his package and released it anyway.  Two of which were security
  573. related.
  574.  
  575. I won't waste time going into why he did it, but I you know a hermes
  576. system who has been running hermes for a while, ask them about free
  577. hermes upgrades....
  578.  
  579. - --------------------------------------------------
  580. Harry Noel  -   grace!wtgdir!Harry_Noel@moscom.com
  581.              or grace\!wtdir\!Harry_Noel@moscom.com
  582. - --------------------------------------------------
  583. "Murpy's Law is Recursive.
  584.  Washing your car to make it rain doesn't work."
  585.  
  586. ---------------------------
  587.  
  588. From: orpheus@reed.edu (P. Hawthorne)
  589. Subject: Things That May Become Dim
  590. Date: 22 Jul 92 11:16:16 GMT
  591. Organization: Reed College, Portland OR
  592.  
  593. Pardon me if I seem naive about these issues, especially they have been
  594. clarfied by System 7. I'm still trying to get a grip on the state of
  595. Macintosh application programming as of System 6 <:-)
  596.  
  597. Is depending on the enableFlags of a MenuHandle asking for trouble? Say,
  598. to disable all items in a single blow, or to find out swiftly whether any
  599. commands are enabled?
  600.  
  601. If all of the commands in a menu are dimmed, should the menu's title on
  602. the menu bar also be dimmed?
  603.  
  604. If a non-movable modal dialog is up, should all of the menu titles on the
  605. menu bar be dimmed, since you can't use them? What if one of the menus is
  606. hilited to begin with, such as the Apple menu after bringing up an about
  607. window that goes away as soon as you click?
  608.  
  609. Should the menu bar be visible when the application has just been
  610. launched and the splash screen is hanging out?
  611.  
  612. If a dialog window is deactivated, perhaps by the application being
  613. suspended or another dialog coming up, should the dialog items be
  614. dimmed? 
  615.  
  616.  "DTS honestly reminds me of my first girlfriend's father..."
  617.   Theus (Prometheus Hawthorne - Jones, orpheus@reed.edu)
  618.  
  619. +++++++++++++++++++++++++++
  620.  
  621. From: jcav@quads.uchicago.edu (JohnC)
  622. Organization: The Royal Society for Putting Things on Top of Other Things
  623. Date: Wed, 22 Jul 1992 17:16:44 GMT
  624.  
  625. In article <1992Jul22.111616.3574@reed.edu> orpheus@reed.edu (P. Hawthorne) writes:
  626. >Is depending on the enableFlags of a MenuHandle asking for trouble? Say,
  627. >to disable all items in a single blow, or to find out swiftly whether any
  628. >commands are enabled?
  629.  
  630. Since the menu definition procedure uses the enable flags to determine the
  631. enabled-ness of an item, it's probably safe to use them.  Calling
  632. _DisableItem with an item number of zero is defined to disable the entire
  633. menu at once, overriding the individual item enable flags.  _EnableItem with
  634. item zero removes this "override".  One note: there are only 31 possible
  635. enable flags (plus one for the menu as a whole).  Any additional items are
  636. defined to always be enabled.  Of course, if your menu has more than 31
  637. items and is not a Font menu, something is wrong. :-)
  638.  
  639. >If all of the commands in a menu are dimmed, should the menu's title on
  640. >the menu bar also be dimmed?
  641.  
  642. That's what the interface guidelines say, and it makes sense.
  643.  
  644. >If a non-movable modal dialog is up, should all of the menu titles on the
  645. >menu bar be dimmed, since you can't use them? What if one of the menus is
  646. >hilited to begin with, such as the Apple menu after bringing up an about
  647. >window that goes away as soon as you click?
  648.  
  649. The guidelines say that menus and menu items that aren't available should be
  650. dimmed.  Before System 7, you couldn't click anywhere outside a modal dialog
  651. box, so it made sense to disable the entire menu bar.  Since System 7, Apple
  652. recommends that the Apple, Edit and other system menus remain available during
  653. modal dialogs.  I think the system handles this auto-magically for most cases.
  654.  
  655. >Should the menu bar be visible when the application has just been
  656. >launched and the splash screen is hanging out?
  657.  
  658. I think that's up to the programmer.  I wouldn't show the menu bar until the
  659. application was ready to interact with the user.
  660.  
  661. >If a dialog window is deactivated, perhaps by the application being
  662. >suspended or another dialog coming up, should the dialog items be
  663. >dimmed? 
  664.  
  665. I think so.  You should certainly dim things that look different when
  666. they're "inactive", such as scrollbars, text selections/insertion points,
  667. and default button outlines.
  668.  
  669. - -- 
  670. John Cavallino                  |  EMail: jcav@midway.uchicago.edu
  671. University of Chicago Hospitals |         John_Cavallino@uchfm.bsd.uchicago.edu
  672. Office of Facilities Management | USMail: 5841 S. Maryland Ave, MC 0953
  673. B0 f++ c+ g++ k s++ e+ h- pv    |         Chicago, IL  60637
  674.  
  675. +++++++++++++++++++++++++++
  676.  
  677. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  678. Date: 25 Jul 92 06:32:50 GMT
  679. Organization: University of Waikato, Hamilton, New Zealand
  680.  
  681. In article <1992Jul22.171644.7212@midway.uchicago.edu>, jcav@quads.uchicago.edu (JohnC) writes:
  682. > In article <1992Jul22.111616.3574@reed.edu> orpheus@reed.edu (P. Hawthorne) writes:
  683. >>If a non-movable modal dialog is up, should all of the menu titles on the
  684. >>menu bar be dimmed, since you can't use them? What if one of the menus is
  685. >>hilited to begin with, such as the Apple menu after bringing up an about
  686. >>window that goes away as soon as you click?
  687. >
  688. > The guidelines say that menus and menu items that aren't available should be
  689. > dimmed.  Before System 7, you couldn't click anywhere outside a modal dialog
  690. > box, so it made sense to disable the entire menu bar.  Since System 7, Apple
  691. > recommends that the Apple, Edit and other system menus remain available during
  692. > modal dialogs.  I think the system handles this auto-magically for most cases.
  693.  
  694. I think the automagic only works if you use ModalDialog. I know I wrote some
  695. code using IsDialogEvent/DialogSelect (because it was more convenient), and
  696. I wasn't getting the special handling of the Edit menu; I changed the code
  697. to call ModalDialog, and recoded my special item handling as a filter routine,
  698. and cut/copy/paste then worked in my dialog.
  699.  
  700. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  701. Computer Services Dept                     fax: +64-7-838-4066
  702. University of Waikato            electric mail: ldo@waikato.ac.nz
  703. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+12:00
  704.  
  705. ---------------------------
  706.  
  707. From: Joe.Francis@dartmouth.edu (Joe Francis)
  708. Subject: GDevices:  screenActive flag?
  709. Date: 23 Jul 92 16:27:03 GMT
  710. Organization: Dartmouth College, Hanover, NH
  711.  
  712.  
  713. What meaning does the screenActive flag have in GDevice record?  If I
  714. wish to build a table of information about the available screens, and
  715. use this info to decide where to display a graphic, should I be testing
  716. this flag?
  717.  
  718. +++++++++++++++++++++++++++
  719.  
  720. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  721. Date: 23 Jul 92 19:02:00 GMT
  722. Organization: Kalamazoo College
  723.  
  724. Joe.Francis@dartmouth.edu (Joe Francis) writes:
  725. >
  726. >What meaning does the screenActive flag have in GDevice record?  If I
  727. >wish to build a table of information about the available screens, and
  728. >use this info to decide where to display a graphic, should I be testing
  729. >this flag?
  730.  
  731. Yes, you should be.  I don't know what it _means_ exactly, but you
  732. shouldn't mess with inactive screens.
  733. - -- 
  734.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  735.  I'm having a lot of trouble seeing how a request that you "shut up" can be
  736.  interpreted as "looking to other people for validation."      - Tim Pierce
  737.  
  738. ---------------------------
  739.  
  740. From: admiraal@bio.vu.nl
  741. Subject: reducing TCL project size
  742. Date: 23 Jul 92 17:45:27 GMT
  743. Organization: VU Biology, Amsterdam, The Netherlands
  744.  
  745. I am starting on a project using Think C's TCL. After compiling the first
  746. attempts I discovered that the project takes around 2 Megabytes of disk
  747. space. I remember a discussion (I don't know if it was this news group)
  748. where a method was given to reduce the size to around 1 Megabyte. Of course
  749. I forgot to remember and/or save it. So can someone explain (again?) how it
  750. works ?
  751.  
  752. Frank 
  753.  
  754. +++++++++++++++++++++++++++
  755.  
  756. From: mspace@netcom.com (Brian Hall)
  757. Date: 24 Jul 92 06:46:50 GMT
  758. Organization: Netcom - Online Communication Services  (408 241-9760 guest)
  759.  
  760. admiraal@bio.vu.nl writes:
  761.  
  762. >I am starting on a project using Think C's TCL. After compiling the first
  763. >attempts I discovered that the project takes around 2 Megabytes of disk
  764. >space. I remember a discussion (I don't know if it was this news group)
  765. >where a method was given to reduce the size to around 1 Megabyte. Of course
  766. >I forgot to remember and/or save it. So can someone explain (again?) how it
  767. ??~works ?
  768.  
  769. The cheezy answer is to always "compact and save" or turn on the
  770. ?t?"compact on save " option, and make sure you have debuggin
  771. turned off (remove the marks next to each file).  A file with debuggin
  772. on - even if the project itself is not being debugged at the moment-
  773. takes up extra space for the debugging information.
  774.  
  775. - -- 
  776.  
  777.  \ | /   | Brian Hall                 mspace@netcom.com
  778.  - : -   | Mark/Space Softworks       Applelink: markspace
  779.   /|\    |                            America Online: MarkSpace
  780.  |-+-|   |
  781. /-\|/-\  | People don't kill people, toasters kill people.
  782.  
  783. +++++++++++++++++++++++++++
  784.  
  785. From: Andrew_Gilmartin@Brown.Edu (Andrew Gilmartin)
  786. Date: 24 Jul 92 16:24:45 GMT
  787. Organization: Brown University
  788.  
  789. In article <admiraal-230792193731@mac165.bio.vu.nl>, admiraal@bio.vu.nl
  790. wrote:
  791.  
  792. > I am starting on a project using Think C's TCL. After compiling the first
  793. > attempts I discovered that the project takes around 2 Megabytes of disk
  794. > space. I remember a discussion (I don't know if it was this news group)
  795. > where a method was given to reduce the size to around 1 Megabyte. Of course
  796. > I forgot to remember and/or save it. So can someone explain (again?) how it
  797. > works ?
  798.  
  799. If you use a TCL precompiled header, your project files will be smaller.
  800. For example, one of mine went from over 4M to under 2M. The TCL archive at
  801. ftp.brown.edu has a .c file for creating a TCL precompiled header.
  802. [ftp.brown.edu:/pub/tcl/misc/TCLDebugHeaders.misc.0]
  803.  
  804. - -- 
  805. Andrew Gilmartin                        
  806. Computing & Information Services
  807. Brown University
  808.  
  809. Andrew_Gilmartin@Brown.Edu
  810. (401) 863-7305
  811.  
  812. ---------------------------
  813.  
  814. From: davidt@aoa.aoa.utc.com (David Trefrey)
  815. Subject: faceless background app's.
  816. Organization: Adaptive Optics Associates
  817. Date: Tue, 21 Jul 1992 16:45:46 GMT
  818.  
  819.  
  820.  
  821.  
  822.  
  823.     One of those little things that annoys me:
  824.  
  825.     People have been refering to certian types of background applications
  826.     as 'faceless'.  What does 'faceless' mean??  I've done some 
  827.     background only stuff and it still appears in the finder's list.
  828.     Does this mean it isn't faceless?  Or does faceless mean the program
  829.     cannot produce a window? 
  830.  
  831.                         thanks.
  832.                             davidt@aoa.utc.com
  833.  
  834. - -- 
  835.  
  836.     David Trefry
  837.     davidt@aoa.utc.com
  838.  
  839. +++++++++++++++++++++++++++
  840.  
  841. From: francois@welchgate.welch.jhu.edu (Francois Schiettecatte)
  842. Date: 21 Jul 92 20:38:10 GMT
  843. Organization: Johns Hopkins Univ. Welch Medical Library
  844.  
  845. Your last statement is correct, a faceless app has no user interface
  846. whatsoever, there are no windows, menus, dialogs, etc, nor are you allowed
  847. to even initialise those managers in a faceless app. A faceless app will
  848. not appear on the finder list, but the memory it occupies will be added to
  849. the system memory figure.
  850.  
  851. In article <1992Jul21.164546.7151@aoa.aoa.utc.com> davidt@aoa.aoa.utc.com (David Trefrey) writes:
  852. >
  853. >
  854. >
  855. >
  856. >    One of those little things that annoys me:
  857. >
  858. >    People have been refering to certian types of background applications
  859. >    as 'faceless'.  What does 'faceless' mean??  I've done some 
  860. >    background only stuff and it still appears in the finder's list.
  861. >    Does this mean it isn't faceless?  Or does faceless mean the program
  862. >    cannot produce a window? 
  863. >
  864. >                        thanks.
  865. >                            davidt@aoa.utc.com
  866. >
  867. >-- 
  868. >
  869. >    David Trefry
  870. >    davidt@aoa.utc.com
  871.  
  872. +++++++++++++++++++++++++++
  873.  
  874. From: umdenbo0@ccu.umanitoba.ca (David A. Denboer)
  875. Organization: University of Manitoba, Winnipeg, Canada
  876. Date: Fri, 24 Jul 1992 02:39:33 GMT
  877.  
  878. Check Out  d e v e l o p  Issue #9
  879. There is a good article in there about writing FBA's by C.K. Haun the author
  880. of my favorite Tech Note #31 --> GestaltWaitNextEvent!
  881.  
  882. David A. denBoer
  883. umdenbo0@CCU.UManitoba.CA
  884. Musi Computer Products
  885. Macintosh Users Show Intelligence
  886.  
  887.  
  888. ---------------------------
  889.  
  890. From: jverdega@cae.wisc.edu (Jeffrey Verdegan)
  891. Subject: 2 simple questions about locked blocks
  892. Date: 10 Jul 92 18:30:16 GMT
  893. Organization: U of Wisconsin-Madison College of Engineering
  894.  
  895. I have two questions about blocks of memory that have been locked with HLock.
  896.  
  897. 1) I know a locked block is non relocatable and non-purgeable.  Does the non-
  898. purgeable part only mean the the memory manager can't purge it to make room for
  899. something else, or does it also mean I can't call DisposHandle for that block?
  900. I would think that I can still call DisposHandle, but I'd like to know for sure.
  901.  
  902. 2) Does every call to HLock have to be balanced by a call to HUnlock, or will a
  903. single HUnlock unlock the block, regardless of how many times HLock was called
  904. for that block?  If I remember correctly, it's the latter -- i.e. there's a 
  905. single bit that indicates the locked-ness (locked-ness monster? :-) ) of a 
  906. block, and therefore there is no counting of the number of times HLock was 
  907. called.  Can somebody confirm this please?
  908.  
  909. Thanks,
  910. Jeff
  911.  
  912.  
  913. - ----------
  914.  
  915. Jeff Verdegan
  916. University of Wisconsin-Madison
  917. Computer-Aided Engineering Center
  918. jjv@caestaff.engr.wisc.edu
  919. (608) 263-1875
  920.  
  921. +++++++++++++++++++++++++++
  922.  
  923. From: vvann@umbio.med.miami.edu (Vince Vann)
  924. Organization: University of Miami Medical School
  925. Date: Fri, 10 Jul 1992 20:54:09 GMT
  926.  
  927. jverdega@cae.wisc.edu (Jeffrey Verdegan) writes:
  928. >
  929. >I have two questions about blocks of memory that have been locked with HLock.
  930. >1) I know a locked block is non relocatable and non-purgeable.  Does the non-
  931. >purgeable part only mean the the memory manager can't purge it to make room for
  932. >something else, or does it also mean I can't call DisposHandle for that block?
  933. >I would think that I can still call DisposHandle,but I'd like to know for sure.
  934.  
  935. You can dispose a handle with DisposHandle whether it is purgeable or not.
  936.  
  937. >2) Does every call to HLock have to be balanced by a call to HUnlock, or will a
  938. > single HUnlock unlock the block, regardless of how many times HLock was called
  939. > for that block?  If I remember correctly, it's the latter -- i.e. there's a 
  940. > single bit that indicates the locked-ness (locked-ness monster? :-) ) of a 
  941. > block, and therefore there is no counting of the number of times HLock was 
  942. > called.  Can somebody confirm this please?
  943.  
  944. The memory manager does NOT keep track of how many times you lock or
  945. unlock a handle.  When you call HLock, the handle is locked immediately!
  946. When you call HUnlock, the handle is unlocked immediately!!!  
  947.  
  948. However, this does not mean than in your source code you should HLock 
  949. a block 10 times, and then HUnlock it once (or vice versa).  
  950.  
  951. I suggest you always balance your calls to HLock/HUnlock.  It is good 
  952. practice, it makes sense, and it will save you a lot of debugging headaches!
  953.  
  954. > Thanks,
  955. > Jeff
  956.  
  957. - --
  958. Vincent R. Vann   <<<vvann@umbio.med.miami.edu>>>
  959. University of Miami School of Medicine, Miami, FL
  960. - -- 
  961.  
  962. //////                  //////  __  //////                  //////
  963.   //////              //////   /__)   //////              //////
  964.     //////          //////    /  \      //////          //////
  965.  
  966. +++++++++++++++++++++++++++
  967.  
  968. From: keith@taligent.com (Keith Rollin)
  969. Date: 11 Jul 92 22:39:23 GMT
  970. Organization: Taligent
  971.  
  972. In article <1992Jul10.205409.11486@newssun.med.miami.edu>,
  973. vvann@umbio.med.miami.edu (Vince Vann) writes:
  974. > jverdega@cae.wisc.edu (Jeffrey Verdegan) writes:
  975. > >
  976. > >I have two questions about blocks of memory that have been locked with HLock.
  977. > > 
  978. > >1) I know a locked block is non relocatable and non-purgeable.  Does the non-
  979. > >purgeable part only mean the the memory manager can't purge it to make room
  980. for
  981. > >something else, or does it also mean I can't call DisposHandle for that
  982. block?
  983. > >I would think that I can still call DisposHandle,but I'd like to know for
  984. sure.
  985. > > 
  986. > You can dispose a handle with DisposHandle whether it is purgeable or not.
  987.  
  988. Or whether it's locked or not. Or whether it's actually purged or not. However,
  989. keep in mind that generally the only blocks that are marked purgeable are
  990. resources (hmmm...what happens when you call DetachResource on a purgeable
  991. resource? Is it still purgeable? I guess so). If you are dealing with purgeable
  992. resources, you must call ReleaseResource, not DisposeHandle (<--- note the new
  993. MPW 3.2 spelling). Only call DisposeHandle if you've called DetachResource.
  994.  
  995. > >2) Does every call to HLock have to be balanced by a call to HUnlock, or will
  996. a
  997. > > single HUnlock unlock the block, regardless of how many times HLock was
  998. called
  999. > > for that block?  If I remember correctly, it's the latter -- i.e. there's a 
  1000. > > single bit that indicates the locked-ness (locked-ness monster? :-) ) of a 
  1001. > > block, and therefore there is no counting of the number of times HLock was 
  1002. > > called.  Can somebody confirm this please?
  1003. > > 
  1004. > The memory manager does NOT keep track of how many times you lock or
  1005. > unlock a handle.  When you call HLock, the handle is locked immediately!
  1006. > When you call HUnlock, the handle is unlocked immediately!!!  
  1007. > However, this does not mean than in your source code you should HLock 
  1008. > a block 10 times, and then HUnlock it once (or vice versa).  
  1009. > I suggest you always balance your calls to HLock/HUnlock.  It is good 
  1010. > practice, it makes sense, and it will save you a lot of debugging headaches!
  1011.  
  1012. The standard practice in a black box environment is:
  1013.  
  1014. char oldState;
  1015.  
  1016. oldState = HGetState(myHandle);
  1017. HLock(myHandle);
  1018. MyRoutineThatNeedsALockedHandle(myHandle);
  1019. HSetState(myHandle, oldState);
  1020.  
  1021.  
  1022. - --
  1023. Keith Rollin
  1024. Phantom Programmer
  1025. Taligent, Inc.
  1026.  
  1027. +++++++++++++++++++++++++++
  1028.  
  1029. From: 9999cs02@uhdvx3 (Tina Marie!)
  1030. Organization: University of Houston-Downtown
  1031. Date: Sun, 12 Jul 1992 19:20:00 GMT
  1032.  
  1033. (Vince Vann) writes...
  1034. >jverdega@cae.wisc.edu (Jeffrey Verdegan) writes:
  1035. >>
  1036. >>2) Does every call to HLock have to be balanced by a call to HUnlock, or will a
  1037. >> single HUnlock unlock the block, regardless of how many times HLock was called
  1038. >> for that block?  If I remember correctly, it's the latter -- i.e. there's a 
  1039. >> single bit that indicates the locked-ness (locked-ness monster? :-) ) of a 
  1040. >> block, and therefore there is no counting of the number of times HLock was 
  1041. >> called.  Can somebody confirm this please?
  1042. >> 
  1043. >The memory manager does NOT keep track of how many times you lock or
  1044. >unlock a handle.  When you call HLock, the handle is locked immediately!
  1045. >When you call HUnlock, the handle is unlocked immediately!!!  
  1046. >However, this does not mean than in your source code you should HLock 
  1047. >a block 10 times, and then HUnlock it once (or vice versa).  
  1048. >I suggest you always balance your calls to HLock/HUnlock.  It is good 
  1049. >practice, it makes sense, and it will save you a lot of debugging headaches!
  1050.  
  1051. Or, there is always this method (the way I was taught to lock/unlock handles):
  1052.  
  1053. int DoNothing( Handle theHandle )
  1054. {
  1055.     SignedByte savedState;
  1056.  
  1057.     savedState = HGetState( theHandle );
  1058.     HLock( theHandle );
  1059.  
  1060. /*    Use theHandle */
  1061.  
  1062.     HSetState( theHandle, savedState );
  1063. }
  1064.  
  1065. This way, you always restore it to the state it was when you started.  If it
  1066. was unlocked, then it will be unlocked again.  If somebody else had locked it,
  1067. it is still locked.  This is a good idea if you have functions that nest,
  1068. both of which have a HLock/HUnlock in them.  When you return from the inner
  1069. function, the handle is unlocked, so if you use it again, there could be
  1070. problems.
  1071.  
  1072.  
  1073. ObQuestion:  Aren't there any other female Mac programmers on the net??
  1074.  
  1075. Tina Marie
  1076. Aspiring Mac Wizard
  1077. 9999cs02@dt3.dt.uh.edu
  1078.  
  1079.  
  1080. +++++++++++++++++++++++++++
  1081.  
  1082. From: daven@notable.com (Dave Newman)
  1083. Date: Sun, 12 Jul 92 11:43:32 PST
  1084. Organization: Notable Technologies, Inc.
  1085.  
  1086.  
  1087. In article <1992Jul10.133017.3112@doug.cae.wisc.edu> (comp.sys.mac.programmer), jverdega@cae.wisc.edu (Jeffrey Verdegan) writes:
  1088. | I have two questions about blocks of memory that have been locked with HLock.
  1089. | 1) I know a locked block is non relocatable and non-purgeable.  Does the non-
  1090. | purgeable part only mean the the memory manager can't purge it to make room for
  1091. | something else, or does it also mean I can't call DisposHandle for that block?
  1092. | I would think that I can still call DisposHandle, but I'd like to know for sure.
  1093.  
  1094. The answer is yes, it's safe to call DisposHandle on a locked, locked
  1095. and non-purgeable, or a non-purgeable handle.
  1096.  
  1097.  
  1098. | 2) Does every call to HLock have to be balanced by a call to HUnlock, or will a
  1099. | single HUnlock unlock the block, regardless of how many times HLock was called
  1100. | for that block?  If I remember correctly, it's the latter -- i.e. there's a 
  1101. | single bit that indicates the locked-ness (locked-ness monster? :-) ) of a 
  1102. | block, and therefore there is no counting of the number of times HLock was 
  1103. | called.  Can somebody confirm this please?
  1104.  
  1105. There is indeed no counting of the number of HLocks or HUnlocks on a
  1106. given handle. 3 HLocks can be undone with a single HUnlock. It is
  1107. recommended that you keep your locked blocks protected with HGetState
  1108. and HSetState calls. Failure to do so may cause a block to become
  1109. unlocked before it's safe to do so.
  1110.  
  1111. You typically use HGetState/HSetState when you have a function which
  1112. receives a handle as a parameter, and you're not certain whether the
  1113. caller has locked that handle or not. To be safe, you can record the
  1114. state of the handle with HGetState, then lock the handle yourself.
  1115. When done with the handle, you restore its previous state with
  1116. HSetState. Upon returning to the caller, it can then HUnlock the
  1117. handle if it was the function that locked it.
  1118.  
  1119. Final note: NEVER, N E V E R assume that just because it's safe to
  1120. HLock or HUnlock a handle multiple times that is therefore safe call
  1121. DisposHandle on the same handle multiple times.
  1122.  
  1123. Calling DisposHandle on the same handle multiple times will corrupt
  1124. the heap's private data structures. Your application will eventually
  1125. crash, and 999 times out of a 1000 it will be a seemingly mysterious
  1126. crash which happens at odd moments, rarely reproducible, and occuring
  1127. long after the actual double dispose on the handle.
  1128.  
  1129. - --Dave
  1130.  
  1131. - -----------------------------------------------------------
  1132. Dave Newman                 |  AOL:      AFC Tinman
  1133. Artillery Spotter           |  ALink:    TINMAN
  1134. Notable Technologies, Inc.  |  CIS:      70743,3323
  1135. Voice:    510.208.4449      |  internet: daven@notable.com
  1136. FAX:      510.444.4493      |  
  1137. - -----------------------------------------------------------
  1138.  
  1139. +++++++++++++++++++++++++++
  1140.  
  1141. From: dowdy@apple.com (Tom Dowdy)
  1142. Date: 17 Jul 92 14:47:51 GMT
  1143. Organization: Apple Computer, Inc.
  1144.  
  1145. In article <1992Jul10.205409.11486@newssun.med.miami.edu>,
  1146. vvann@umbio.med.miami.edu (Vince Vann) wrote:
  1147. > The memory manager does NOT keep track of how many times you lock or
  1148. > unlock a handle.  When you call HLock, the handle is locked immediately!
  1149. > When you call HUnlock, the handle is unlocked immediately!!!  
  1150. > However, this does not mean than in your source code you should HLock 
  1151. > a block 10 times, and then HUnlock it once (or vice versa).  
  1152. > I suggest you always balance your calls to HLock/HUnlock.  It is good 
  1153. > practice, it makes sense, and it will save you a lot of debugging headaches!
  1154.  
  1155. Well, if you go into a routine with the handle locked and you unlock it,
  1156. the routine that called you might be *very* surprised to see the handle
  1157. that it locked suddenly become unlocked.
  1158.  
  1159. When I'm writing large applications and I want to maintain "data hiding"
  1160. within various parts of the application, I never call HUnlock, instead 
  1161. I do the following:
  1162.  HGetState(h, &flags);
  1163.  HLock(h);
  1164.  < fun stuff here >
  1165.  HSetState(h, flags);
  1166.  
  1167. This works great, although it is a bit more expensive than your simple
  1168. lock/unlock pairs.  However, because there are *so* few times when
  1169. locking a handle is really needed (DarkSide calls HLock 4 times, and
  1170. they are all on resources) - the overhead of this code is fairly minor.
  1171.  
  1172. When writing smaller and more localized applications (DarkSide comes to
  1173. mind
  1174. again), I usually just Lock/Unlock because I "know" what I'm doing.
  1175.  
  1176.  Tom Dowdy                 Internet:  dowdy@apple.COM
  1177.  Apple Computer MS:81KS    UUCP:      {sun,voder,amdahl,decwrl}!apple!dowdy
  1178.  20525 Mariani Ave         AppleLink: DOWDY1
  1179.  Cupertino, CA 95014       
  1180.  "The 'Ooh-Ah' Bird is so called because it lays square eggs."
  1181.  
  1182. ---------------------------
  1183.  
  1184. End of C.S.M.P. Digest
  1185. **********************
  1186.