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

  1. Received-Date: Thu, 15 Sep 1994 13:51:18 +0200
  2. From: pottier@clipper.ens.fr (Francois Pottier)
  3. Subject: csmp-digest-v3-058
  4. To: csmp-digest@ens.fr
  5. Date: Thu, 15 Sep 1994 13:51:12 +0200 (MET DST)
  6. X-Mailer: ELM [version 2.4 PL23]
  7. Mime-Version: 1.0
  8. Content-Type: text/plain; charset=ISO-8859-1
  9. Content-Transfer-Encoding: 8bit
  10. Errors-To: listman@ens.fr
  11. Reply-To: pottier@clipper.ens.fr
  12. X-Sequence: 63
  13.  
  14. C.S.M.P. Digest             Thu, 15 Sep 94       Volume 3 : Issue 58
  15.  
  16. Today's Topics:
  17.  
  18.         AppleEvents for command line args (argc, argv)?
  19.         Exception Handling
  20.         NIM on develop, as of 19
  21.         Need to Stop flashing Desktop when changing palletes
  22.         PPostEvent mouse events
  23.         Sample MacTcp Programs
  24.         Selecting Window via menus
  25.         SetDialogDefaultItem real?
  26.         Stack sniffer - how can I turn it off?
  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.  To search back issues
  66. with WAIS, use comp.sys.mac.programmer.src. With Mosaic, use
  67. http://www.wais.com/wais-dbs/comp.sys.mac.programmer.html.
  68.  
  69.  
  70. -------------------------------------------------------
  71.  
  72. >From rhn@waltz.engr.sgi.com (Ron Nicholson)
  73. Subject: AppleEvents for command line args (argc, argv)?
  74. Date: Wed, 24 Aug 1994 18:05:15 GMT
  75. Organization: Silicon Graphics, Inc., Mountain View, CA
  76.  
  77. Are there AppleEvents suitable for passing a unix style command line
  78. to a ported Unix C application?  I handle the 4 required AppleEvents
  79. in a wrapper, but that's not enough to pass all the args needed to
  80. a ported app.
  81.  
  82. Thanks,
  83.  
  84. Ronald H. Nicholson, Jr.    rhn@engr.sgi.com, rhn@netcom.com, N6YWU
  85. #include <canonical.disclaimer>     // I speak only for myself, etc.
  86.  
  87. +++++++++++++++++++++++++++
  88.  
  89. >From rhn@netcom.com (Ron Nicholson)
  90. Date: Thu, 1 Sep 1994 05:51:04 GMT
  91. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  92.  
  93. In article <Cv1wwr.4H2@odin.corp.sgi.com> I wrote:
  94. >Are there AppleEvents suitable for passing a unix style command line
  95. >to a ported Unix C application?  I handle the 4 required AppleEvents
  96. >in a wrapper, but that's not enough to pass all the args needed to
  97. >a ported app.
  98.  
  99. Thanks for all the replies.  Several people recommended using the
  100. DoScript ('dosc') command, part of the misc suite.  I tried using the
  101. DoScript command and it works just fine.
  102.  
  103. Inside my initialization code for the required handlers I added:
  104.  
  105.     err = AEInstallEventHandler('misc', kAEDoScript,
  106.                 NewAEEventHandlerProc(myHandleDoScript), 0, false);
  107.  
  108. // 'misc' == kAEMiscSuite ; couldn't find it in my headers files.
  109.  
  110. Inside the myHandleDoScript AE handler routine I used:
  111.  
  112.     err = AEGetParamPtr(aevt, keyDirectObject, typeChar,
  113.                 &typeCode, myParamTextBuffer, 256L, &actualSize);
  114.  
  115. This puts a string of text into myParamTextBuffer that can be parsed
  116. into parameters or commands (in the main loop, NOT in the handler).
  117.  
  118. Do I need to do anything else to make this bulletproof?
  119.  
  120. I needed an aete resource containing DoScript and the required
  121. AppleEvents.  I found one inside the ToolServer 1.1 application.  I
  122. just copied it since I don't have an aete editor.
  123.  
  124. I'm going to try this for porting standalone unix filters like grep.
  125. >>> Tell application "grep" to DoScript "grep -i foo somefile.txt"
  126. Something like "grep bar < infile > outfile" should work for unix style
  127. file names in a default directory.  I suppose something like this could
  128. be packaged up with a dropshell to make it a scriptshell.
  129.  
  130. - -
  131. Ronald H. Nicholson, Jr.    rhn@netcom.com, rhn@engr.sgi.com, N6YWU
  132. #include <canonical.disclaimer>     // I speak only for myself, etc.
  133.  
  134.  
  135. ---------------------------
  136.  
  137. >From stara@holmes.ece.orst.edu (Aaron Starr)
  138. Subject: Exception Handling
  139. Date: 29 Aug 1994 18:58:11 GMT
  140. Organization: College of Engineering, Oregon State University
  141.  
  142.  
  143. Until we have a compiler that supports exception handling, I need to use
  144. some sort of approximation in my code.  Anyone have any preferences?
  145.  
  146. I know that Symantec has an exception library for TCL, as well as a
  147. Bedrock exception library, and I know that Metrowerks has something
  148. similar for PowerPlant.  Does anyone know which of these is most similar
  149. to likely implementations in the compiler?
  150.  
  151. Thanks for info,
  152.  
  153. Aaron Starr
  154. stara@ece.orst.edu
  155.  
  156. +++++++++++++++++++++++++++
  157.  
  158. >From afcjlloyd@aol.com (AFC JLloyd)
  159. Date: 30 Aug 1994 02:59:30 -0400
  160. Organization: America Online, Inc. (1-800-827-6364)
  161.  
  162. Aaron Starr (stara@holmes.ece.orst.edu ) writes:
  163.  
  164. >Until we have a compiler that supports exception handling, I need to use
  165. >some sort of approximation in my code.  Anyone have any preferences?
  166. >I know that Symantec has an exception library for TCL, as well as a
  167. >Bedrock exception library, and I know that Metrowerks has something
  168. >similar for PowerPlant.  Does anyone know which of these is most similar
  169. >to likely implementations in the compiler?
  170.  
  171. I'm the engineer who did most of the work on BEL.  If your criteria is
  172. compatibility to the C++ standard, then I think BEL is your best choice. 
  173. Of course, I'm biased, but let me try to give you enough facts so that you
  174. can make an objective decision.
  175.  
  176. The original TCL exception handling implementation made no attempt to
  177. throw/catch objects, and no attempt to delete stack-based objects as the
  178. stack is unwound.
  179.  
  180. The PowerPlant mechanism does not throw objects, though it does delete
  181. stack-based objects.  However, it calls constructors for partially
  182. constructed objects, and doesn't prevent memory leaks when exceptions are
  183. thrown from constructors of objects that are being allocated from the
  184. heap.
  185.  
  186. BEL does throw/catch objects; in fact, BEL only throws objects.  It
  187. doesn't allow throwing of arbitrary types like integers and strings.  Of
  188. course, you can package integers and strings inside exception classes of
  189. your own design.
  190.  
  191. BEL properly deletes stack based objects as the stack is unwound. 
  192. Destructors are called only for fully constructed objects.  However, BEL
  193. doesn't do this automatically; you must insert a macro call at the end of
  194. every constructor and the start of every destructor for the classes that
  195. need automatic cleanup.  You must also derive such classes from a special
  196. class.  If you use multiple inheritance there are some restrictions; the
  197. major one being that you can't inherit from the special "CAutoDestruct"
  198. class more than once, and virtual base classes are not supported.  If you
  199. use mixin style inheritance, then your mixin classes should not be derived
  200. from CAutoDestruct.
  201.  
  202. BEL also handles the case where an object is allocated from the heap using
  203. operator new and an exception is thrown from the constructor.  In this
  204. case, the raw memory allocated (with ::operator new()) must be deleted by
  205. the exception handling mechanism.
  206.  
  207. The BEL macros that implement the programming interface are designed to be
  208. compatible with the C++ exception handling syntax.  When compilers provide
  209. exception handling, BEL's macros can be redefined to the C++ syntax.  You
  210. can then recompile your code without making any changes to take advantage
  211. of the compilers support.  Of course, you can then globally replace the
  212. macros with the real syntax, but there may be good reasons to continue
  213. using the macros for a while.   For example, an implementation of BEL for
  214. Windows exists, so if you write cross platform code using BEL you will
  215. want to wait to use the true C++ syntax until all of your compilers
  216. support exceptions (and do so relatively bug-free).
  217.  
  218. Finally, even though Bedrock is no more, the OpenDoc Parts Framework (OPF)
  219. is being developed with BEL.  I am now a contractor at Apple working on
  220. OPF, and I am enhancing BEL as part of the contract.
  221.  
  222. What is the downside to BEL?  The main issue is performance and code size.
  223.  There are lots of things a compiler can do that can't be done using
  224. portable C++ code; that is why Stroustrup wanted exceptions in the
  225. language, and not just a part of the standard library.  You'll have to
  226. settle with some overhead until the compilers implement exceptions.  There
  227. are of course other compromises.
  228.  
  229. Jim Lloyd
  230. afcjlloyd@aol.com  -or- Jim_Lloyd@powertalk.apple.com
  231.  
  232.  
  233. +++++++++++++++++++++++++++
  234.  
  235. >From jahess@metrowerks.com (Jonathan Hess)
  236. Date: 30 Aug 1994 18:53:50 GMT
  237. Organization: ViviStar Consulting
  238.  
  239. In article <33tb43$1r2@engr.orst.edu>
  240. stara@holmes.ece.orst.edu (Aaron Starr) writes:
  241.  
  242. > I know that Symantec has an exception library for TCL, as well as a
  243. > Bedrock exception library, and I know that Metrowerks has something
  244. > similar for PowerPlant.  Does anyone know which of these is most similar
  245. > to likely implementations in the compiler?
  246.  
  247. TCL 2 uses the Bedrock exception library "BEL."  Once you get past the
  248. macros, BEL probably is closer to C++ exceptions for throwing actual
  249. objects and the like.
  250.  
  251. But, if you like simplicity, UExceptions from PowerPlant is REAL clean.
  252.  
  253. In both cases you'll probably be able to global GREP search and
  254. replaces for C++ exceptions.
  255.  
  256. As for my personal preference... well I'm biased.   :)
  257.  
  258. , Jonathan Hess
  259. Metrowerks, Inc.
  260. jahess@metrowerks.com
  261.  
  262. +++++++++++++++++++++++++++
  263.  
  264. >From afcjlloyd@aol.com (AFC JLloyd)
  265. Date: 31 Aug 1994 03:16:03 -0400
  266. Organization: America Online, Inc. (1-800-827-6364)
  267.  
  268. In article <33vv7u$7i4@tracker.ramp.com>, jahess@metrowerks.com (Jonathan
  269. Hess) writes:
  270.  
  271. >In article <33tb43$1r2@engr.orst.edu>
  272. >stara@holmes.ece.orst.edu (Aaron Starr) writes:
  273. >
  274. >> I know that Symantec has an exception library for TCL, as well as a
  275. >> Bedrock exception library, and I know that Metrowerks has something
  276. >> similar for PowerPlant.  Does anyone know which of these is most
  277. similar
  278. >> to likely implementations in the compiler?
  279. >
  280. >TCL 2 uses the Bedrock exception library "BEL."  Once you get past the
  281. >macros, BEL probably is closer to C++ exceptions for throwing actual
  282. >objects and the like.
  283. >
  284. >But, if you like simplicity, UExceptions from PowerPlant is REAL clean.
  285. >
  286. >In both cases you'll probably be able to global GREP search and
  287. >replaces for C++ exceptions.
  288. >
  289. >As for my personal preference... well I'm biased.   :)
  290.  
  291. The number one design criteria for BEL was to be "sufficiently" close to
  292. the C++ standard.  To achieve this we wanted application developers to be
  293. able to write exception handling code in almost exactly the same style
  294. they would use with C++ exceptions, with only minimal restrictions, and
  295. that code written using BEL could be recompiled without changes and work
  296. correctly when compilers support C++ exceptions.
  297.  
  298. Alas, this criteria often precluded simplicity.
  299.  
  300. As it happens, I spend a little of my spare time working on an idea I have
  301. for an educational game.  The exception library I wrote for it is even
  302. simpler than PowerPlant's UExceptions.  You see, I too believe that for
  303. some applications, simplicity is more important than adherence to some
  304. external standard.
  305.  
  306. Jim Lloyd
  307. afcjlloyd@aol.com -or- Jim_Lloyd@powertalk.apple.com
  308.  
  309.  
  310. +++++++++++++++++++++++++++
  311.  
  312. >From sparent@mv.us.adobe.com (Sean Parent)
  313. Date: Wed, 31 Aug 1994 20:49:22 GMT
  314. Organization: Adobe Systems Incorporated
  315.  
  316. How does BEL handle the case of an auto-destruct member within another
  317. auto-destruct derived class? That is, how do you handle:
  318.  
  319. class CFoo : CAutoDestruct {
  320.    ...
  321. }
  322. class CBar : CAutoDestruct {
  323.    CFoo  fooMember;
  324. }
  325.  
  326. void Test {
  327.    CBar bar;
  328.    CFoo foo;
  329.    Failure(); // or throw
  330. }
  331.  
  332. You need to thread foo and bar onto your exception stack but not fooMember
  333. (since it's destructor will get called when bar is destructed).
  334.  
  335. Sean
  336.  
  337. In article <341anj$sv3@search01.news.aol.com>, afcjlloyd@aol.com (AFC
  338. JLloyd) wrote:
  339.  
  340. > In article <33vv7u$7i4@tracker.ramp.com>, jahess@metrowerks.com (Jonathan
  341. > Hess) writes:
  342. > >In article <33tb43$1r2@engr.orst.edu>
  343. > >stara@holmes.ece.orst.edu (Aaron Starr) writes:
  344. > >
  345. > >> I know that Symantec has an exception library for TCL, as well as a
  346. > >> Bedrock exception library, and I know that Metrowerks has something
  347. > >> similar for PowerPlant.  Does anyone know which of these is most
  348. > similar
  349. > >> to likely implementations in the compiler?
  350. > >
  351. > >TCL 2 uses the Bedrock exception library "BEL."  Once you get past the
  352. > >macros, BEL probably is closer to C++ exceptions for throwing actual
  353. > >objects and the like.
  354. > >
  355. > >But, if you like simplicity, UExceptions from PowerPlant is REAL clean.
  356. > >
  357. > >In both cases you'll probably be able to global GREP search and
  358. > >replaces for C++ exceptions.
  359. > >
  360. > >As for my personal preference... well I'm biased.   :)
  361. > The number one design criteria for BEL was to be "sufficiently" close to
  362. > the C++ standard.  To achieve this we wanted application developers to be
  363. > able to write exception handling code in almost exactly the same style
  364. > they would use with C++ exceptions, with only minimal restrictions, and
  365. > that code written using BEL could be recompiled without changes and work
  366. > correctly when compilers support C++ exceptions.
  367. > Alas, this criteria often precluded simplicity.
  368. > As it happens, I spend a little of my spare time working on an idea I have
  369. > for an educational game.  The exception library I wrote for it is even
  370. > simpler than PowerPlant's UExceptions.  You see, I too believe that for
  371. > some applications, simplicity is more important than adherence to some
  372. > external standard.
  373. > Jim Lloyd
  374. > afcjlloyd@aol.com -or- Jim_Lloyd@powertalk.apple.com
  375.  
  376. -- 
  377. Sean Parent
  378. sparent@mv.us.adobe.com
  379. "The critical driver of every successful project is its focused ruthlessness."
  380.         Grady Booch
  381.  
  382. +++++++++++++++++++++++++++
  383.  
  384. >From objfactory@aol.com (ObjFactory)
  385. Date: 1 Sep 1994 16:48:03 -0400
  386. Organization: America Online, Inc. (1-800-827-6364)
  387.  
  388. In article <sparent-3108941249220001@macb041.mv.us.adobe.com>,
  389. sparent@mv.us.adobe.com (Sean Parent) writes:
  390.  
  391. >How does BEL handle the case of an auto-destruct member within another
  392. >auto-destruct derived class? That is, how do you handle:
  393.  
  394. >class CFoo : CAutoDestruct {
  395. >   ...
  396. >}
  397. >class CBar : CAutoDestruct {
  398. >   CFoo  fooMember;
  399. >}
  400.  
  401. >void Test {
  402. >   CBar bar;
  403. >   CFoo foo;
  404. >   Failure(); // or throw
  405. >}
  406.  
  407. >You need to thread foo and bar onto your exception stack but not
  408. fooMember
  409. >(since it's destructor will get called when bar is destructed).
  410.  
  411. You seem to have answered your own question. :)
  412.  
  413. Bob Foster
  414. Object Factory
  415.  
  416. +++++++++++++++++++++++++++
  417.  
  418. >From afcjlloyd@aol.com (AFC JLloyd)
  419. Date: 1 Sep 1994 18:13:09 -0400
  420. Organization: America Online, Inc. (1-800-827-6364)
  421.  
  422. In article <345em3$a1d@search01.news.aol.com>, objfactory@aol.com
  423. (ObjFactory) writes:
  424.  
  425. >In article <sparent-3108941249220001@macb041.mv.us.adobe.com>,
  426. >sparent@mv.us.adobe.com (Sean Parent) writes:
  427. >
  428. >>How does BEL handle the case of an auto-destruct member within another
  429. >>auto-destruct derived class? That is, how do you handle:
  430. >
  431. >>class CFoo : CAutoDestruct {
  432. >>   ...
  433. >>}
  434. >>class CBar : CAutoDestruct {
  435. >>   CFoo  fooMember;
  436. >>}
  437. >
  438. >>void Test {
  439. >>   CBar bar;
  440. >>   CFoo foo;
  441. >>   Failure(); // or throw
  442. >>}
  443. >
  444. >>You need to thread foo and bar onto your exception stack but not
  445. >fooMember
  446. >>(since it's destructor will get called when bar is destructed).
  447. >
  448. >You seem to have answered your own question. :)
  449. >
  450. >Bob Foster
  451. >Object Factory
  452.  
  453. No, BEL threads all three objects on the delete stack, but Sean's
  454. assumption that the fooMember is on the top of the stack is incorrect --
  455. subobjects are constructed before their owning object.  So, the stack
  456. order at the time of failure is:
  457.  
  458. bar.fooMember; bar; foo;
  459.  
  460. BEL first calls foo.CFoo::~CFoo(), then calls bar.CBar::~CBar.  The
  461. destructor of CBar implicitly calls the destructor
  462. bar.fooMember.CFoo::~CFoo().  Inside this destructor is the
  463. START_DESTRUCTOR macro, which informs BEL to pop the deletestack entry for
  464. bar.fooMember.  When the destructor returns to BEL, the delete stack is
  465. now empty, so BEL doesn't try to delete bar.fooMember.
  466.  
  467. This strategy results in more items being placed onto the delete stack
  468. than is theoretically necessary, but less computation at runtime to
  469. determine if an entry should be pushed onto the stack or not.  We
  470. therefore have traded off a little extra storage for faster code.
  471.  
  472. Jim Lloyd - AFC JLloyd
  473.  
  474.  
  475. ---------------------------
  476.  
  477. >From nick+@pitt.edu ( nick.c )
  478. Subject: NIM on develop, as of 19
  479. Date: Wed, 31 Aug 94 14:50:26 GMT
  480. Organization: The Pitt, Chemistry
  481.  
  482.  
  483. Folks:
  484.  
  485.     Someone was asking about the new NIM policy for _develop_, and what
  486.       volumes would be on 19 that weren't on 18.  Just got 19, and noticed
  487.       the absense of the Old IM and beta QD GX books, but they added as 
  488.       "specials" Sound and Imaging with Quickdraw.  Here's a running
  489.       index of NIM I'm keeping for my own use, with 19 added.
  490.       If you have issue 17 and up you have 15 of the NIM, with 7 (beta) 
  491.       QD GX books, the Human Interface guidelines and Old IM VI.
  492.       
  493.     BTW, I saw a CD at the bookstore with the Human Interface Guidelines
  494.       and _Making it Macintosh_ on one CD for $49.  Anyone checked this
  495.       out?  There has got to be more on it that just that, but the package
  496.       wasn't very helpfull.
  497.       
  498.                                         -- nick
  499.  
  500.  
  501.  
  502. develop NIM Index:
  503. ~~~~~~~~~~~~~~~~~~
  504.  
  505. volume 17: (last "comprehensive")
  506. =================================
  507.  
  508.   NIM (presume "core")
  509.     Toolbox Essentials
  510.     More Mac Toolbox
  511.     Memory
  512.     Files
  513.   
  514.   NIM (unique this CD)
  515.     Overview
  516.     Processes
  517.     Devices (Preview)
  518.     Interapplication Comm
  519.     QuickTime
  520.     QuickTime Components
  521.     Text
  522.  
  523.   QD GX 1.0b3 <- Note beta
  524.     Environment & Utilities
  525.     Extensions & Drivers
  526.     Functin Index
  527.     Graphics
  528.     Objects
  529.     Printing
  530.     Typography
  531.     
  532.   Misc.
  533.     Human Interface Guidelines
  534.     Old IM volume VI
  535.  
  536.  
  537. volume 18: (first "reduced")
  538. ============================
  539.     
  540.   NIM (presume "core")
  541.     Toolbox Essentials
  542.     More Mac Toolbox
  543.     Memory
  544.     Files
  545.  
  546.   NIM (unique this CD)
  547.     PowerPC Numerics
  548.     PowerPC System Software
  549.  
  550.   QD GX b3 <- Note beta
  551.     Environment & Utilities
  552.     Extensions & Drivers
  553.     Functin Index
  554.     Graphics
  555.     Objects
  556.     Printing
  557.     Typography
  558.     
  559.   Misc.
  560.     Human Interface Guidelines
  561.     Old IM volume VI
  562.  
  563.  
  564. volume 19: (second "reduced")
  565. =============================
  566.     
  567.   NIM (presume "core")
  568.     Toolbox Essentials
  569.     More Mac Toolbox
  570.     Memory
  571.     Files
  572.  
  573.   NIM (unique this CD)
  574.     Imaging With Quickdraw
  575.     Sound
  576.  
  577.   Misc.
  578.     Human Interface Guidelines
  579.  
  580.  
  581. The README explanation of new NIM policy:
  582. =========================================
  583.  
  584. Why aren't all of the volumes of New Inside Macintosh on this
  585. issue of the Bookmark CD?
  586.  
  587. Later this year, Apple and Addison-Wesley will release the
  588. New Inside Macintosh (NIM) CD.  The NIM CD will offer all
  589. Inside Macintosh volumes to date in Apple DocViewer format,
  590. a complete cross reference, and numerous prebuilt DocViewer
  591. collections to allow easy querying across the information. 
  592. All of the NIM books, if purchased separately, would cost
  593. several hundred dollars. The complete electronic set,
  594. however, will be offered at the introductory price of $99
  595. (suggested retail price).
  596.  
  597. To avoid conflicts, the introduction of this product has
  598. caused us to alter our practice of providing all NIM volumes
  599. on the Bookmark CD.  Because the low subscription price for
  600. develop and the Bookmark cannot support the necessary
  601. enhancements, updates, and wider distribution of the
  602. electronic NIM product, we've had to make some concessions. 
  603. The initial plan was to simply remove all NIM content from
  604. the Bookmark CD.  We realize, however, that this content is
  605. extremely important to a great many of you and that it is
  606. necessary for your development projects.  
  607.  
  608. So, we've compromised a bit - beginning with this CD, the
  609. Bookmark will include a core set of NIM volumes. 
  610. Additionally, each issue of the Bookmark CD will feature
  611. other volumes of NIM.  The core set will stay fairly
  612. consistent, but the featured volumes will change on each
  613. subsequent issue of the Bookmark CD. 
  614.  
  615. While this solution may not be optimal for all develop
  616. subscribers, it was a compromise that was necessary to make.
  617.  We hope, of course, that you feel that develop and the
  618. other content on the Bookmark CD is well worth the low
  619. subscription price.
  620.  
  621. Sincerely,
  622. The develop and Bookmark CD team
  623.  
  624. - -
  625.  
  626.  
  627.  
  628.                                     _/   _/  _/  _/_/_/   _/   _/  
  629.      Interet: nick@pitt.edu        _/_/ _/  _/  _/   _/  _/_/_/    
  630.       eWorld: nick                _/ _/_/  _/  _/       _/ _/      
  631.          CIS: 71232,766          _/   _/  _/   _/_/_/  _/   _/     
  632.  
  633.  
  634. +++++++++++++++++++++++++++
  635.  
  636. >From nick+@pitt.edu ( nick.c )
  637. Date: Wed, 31 Aug 94 15:15:54 GMT
  638. Organization: The Pitt, Chemistry
  639.  
  640.  
  641.     
  642.     This might be more usefull.
  643.  
  644.                         -- nick
  645.  
  646. - -
  647.  
  648.  
  649. develop NIM Index:
  650. ~~~~~~~~~~~~~~~~~~
  651.  
  652.     NIM: Toolbox Essentials             ANY develop (17up)
  653.     NIM: More Mac Toolbox               ANY develop (17up)
  654.     NIM: Memory                         ANY develop (17up)
  655.     NIM: Files                          ANY develop (17up)
  656.     
  657.     NIM: Overview                       17  develop
  658.     NIM: Processes                      17  develop
  659.     NIM: Devices (Preview)              17  develop
  660.     NIM: Interapplication Comm          17  develop
  661.     NIM: QuickTime                      17  develop
  662.     NIM: QuickTime Components           17  develop
  663.     NIM: Text                           17  develop
  664.     
  665.     NIM: Imaging With Quickdraw         19  develop
  666.     NIM: Sound                          19  develop
  667.     
  668.     NIM: PowerPC Numerics               18  develop
  669.     NIM: PowerPC System Software        18  develop ___ 15 volumes
  670.     
  671.     NIM: QD/GX Environment & Utilities  17 or 18 develop
  672.     NIM: QD/GX Extensions & Drivers     17 or 18 develop
  673.     NIM: QD/GX Functin Index            17 or 18 develop
  674.     NIM: QD/GX Graphics                 17 or 18 develop
  675.     NIM: QD/GX Objects                  17 or 18 develop
  676.     NIM: QD/GX Printing                 17 or 18 develop
  677.     NIM: QD/GX Typography               17 or 18 develop ___ 7 volumes
  678.     
  679.     Human Interface Guidelines          ANY develop (17up)
  680.     Old IM volume VI                    17 or 18 develop
  681.     
  682.  
  683.  
  684.                                     _/   _/  _/  _/_/_/   _/   _/  
  685.      Interet: nick@pitt.edu        _/_/ _/  _/  _/   _/  _/_/_/    
  686.       eWorld: nick                _/ _/_/  _/  _/       _/ _/      
  687.          CIS: 71232,766          _/   _/  _/   _/_/_/  _/   _/     
  688.  
  689.  
  690. ---------------------------
  691.  
  692. >From jflet@dir.mcc.ac.uk (J. Fletcher)
  693. Subject: Need to Stop flashing Desktop when changing palletes
  694. Date: Tue, 30 Aug 1994 18:28:53 GMT
  695. Organization: University of Manchester, UK
  696.  
  697.  
  698. I'm writing a small database application which displays 256 colour
  699. picts in a window. As I swap in different pictures, I set a new
  700. optimised pallette to get the best colour scheme possible.
  701.  
  702. The problem is that every time a set a new palatte, everything 
  703. flashes all over the place, scroll bars, desktop pattern etc.
  704.  
  705. What steps can I use to minimise these visual irritations?
  706.  
  707. I've got some ideas but does Anybody have any ideas on how to
  708. implement the following :-
  709.  
  710. 1) Get the Desktop pattern, save it, Set it to a black/white
  711. checkerboard 'grey' ands restore at app. quit time.
  712.  
  713. 2) Force all screen windows to display their window bar/controls
  714. in neat black/white (like setting to black/white only in monitors
  715. CP) yet allowing colour drawing.
  716.  
  717. Julian
  718. jflet@dir.mcc.ac.uk
  719.  
  720. +++++++++++++++++++++++++++
  721.  
  722. >From radixinc@aol.com (RadixInc)
  723. Date: 30 Aug 1994 18:34:01 -0400
  724. Organization: America Online, Inc. (1-800-827-6364)
  725.  
  726. In article <jflet-300894192149@grice.ch.man.ac.uk>, jflet@dir.mcc.ac.uk
  727. (J. Fletcher) writes:
  728.  
  729. <<The problem is that every time a set a new palatte, everything 
  730. flashes all over the place, scroll bars, desktop pattern etc.
  731.  
  732. What steps can I use to minimise these visual irritations?
  733.  
  734. I've got some ideas but does Anybody have any ideas on how to
  735. implement the following :-
  736.  
  737. 1) Get the Desktop pattern, save it, Set it to a black/white
  738. checkerboard 'grey' ands restore at app. quit time.
  739.  
  740. 2) Force all screen windows to display their window bar/controls
  741. in neat black/white (like setting to black/white only in monitors
  742. CP) yet allowing colour drawing.>>
  743.  
  744. The problem is inherent in the way the Pallette Manager and color devices
  745. work. The video card for each device has a table with and RGB entry for
  746. each color entry--there are 256 of them on an 8-bit card. When you change
  747. pallettes the Pallette Manager tries to keep everything in order, but if
  748. there aren't enough available (unused) colors in the color table it has to
  749. remap some colors, and that's when you get the flash and weird colors.
  750.  
  751. Both of the solutions you propose are, in my opinion, worse than the
  752. problem. You would be making changes that affect other programs, and there
  753. is no way to tell what that will do to them. Fiddling with the desktop
  754. pattern is not a good idea; that should be under the user's control. And
  755. how would you force other apps to get only B&W controls without installing
  756. a patch at startup time? Also what will you do when your app is switched
  757. out--flip everything back? That will cause more flashing than the pallette
  758. problem.
  759.  
  760. If you can't use the System Pallette, you'll have to live with the colors
  761. flashing.
  762.  
  763. Gregory Jorgensen
  764. Radix Consulting Inc.
  765.  
  766. +++++++++++++++++++++++++++
  767.  
  768. >From hanrek@cts.com (Mark Hanrek)
  769. Date: 31 Aug 1994 09:19:24 GMT
  770. Organization: The Information Workshop
  771.  
  772. > In article <jflet-300894192149@grice.ch.man.ac.uk>, jflet@dir.mcc.ac.uk
  773. > (J. Fletcher) writes:
  774. > <<The problem is that every time a set a new palatte, everything 
  775. > flashes all over the place, scroll bars, desktop pattern etc.
  776.  
  777. The problem is that we've forgotten that "the flash" is the tradeoff we
  778. had accepted for the benefit of being able to use custom color tables,
  779. which usually yield stunning color accuracy and realism for a 256-color
  780. system.
  781.  
  782. There are "ways" to minimize the effects.
  783.  
  784. * Use a gamma fader to fade down the monitor between pictures to hide the flash.
  785.  
  786. * Utilize a "backdrop window" with a gray pattern (alternate black and
  787. white pixels) to hide the desktop and other application's windows, since
  788. black and white are always in every custom color table, and will not
  789. flash.
  790.  
  791. * Use a black backdrop which is traditional with the "slide show" options
  792. of most graphics applications.
  793.  
  794. * Always make sure the display window is full screen.
  795.  
  796. * Always create greedy palettes with all hte entries always set to
  797. pmTolerant + pmExplicity and a tolerance of zero, so that all other
  798. applications and the Finder are forced to black and white mode.
  799.  
  800. Hopefully one of these suggestions will help.
  801.  
  802. There are only 256 colors available in the hardware, and that's it.
  803.  
  804.  
  805. Mark Hanrek
  806.  
  807. +++++++++++++++++++++++++++
  808.  
  809. >From carlf2@aol.com (CarlF2)
  810. Date: 31 Aug 1994 09:45:08 -0400
  811. Organization: America Online, Inc. (1-800-827-6364)
  812.  
  813. In article <jflet-300894192149@grice.ch.man.ac.uk>, jflet@dir.mcc.ac.uk
  814. (J. Fletcher) writes:
  815.  
  816. >I'm writing a small database application which displays 256 colour
  817. >picts in a window. As I swap in different pictures, I set a new
  818. >optimised pallette to get the best colour scheme possible.
  819.  
  820. >The problem is that every time a set a new palatte, everything 
  821. >flashes all over the place, scroll bars, desktop pattern etc.
  822.  
  823. >......[deleted]
  824.  
  825. Try using a single animated palette for your application, with every entry
  826. but black and white reserved for your application. (This will force the
  827. background applications to use B&W; if you can, you might leave some other
  828. entries for them to use as well.) Then when you want to change your
  829. colors, use AnimatePalette. Since no other application is using those
  830. entries, no flash will occur.
  831.  
  832. Carl Fristrom
  833. Medfield MA
  834.  
  835. ---------------------------
  836.  
  837. >From sbill@informix.com (Bill Stackhouse)
  838. Subject: PPostEvent mouse events
  839. Date: 26 Aug 1994 20:25:24 GMT
  840. Organization: Informix Software, Inc.
  841.  
  842. I am trying to post mouseUp and mouseDown events to my application
  843. using PPostEvent. After call PPostEvent, the what field is set to
  844. -1. The return value is 0. If I scan the event queue, there are
  845. no events. Even though I set the mouse position using low mem
  846. globals before the post, the where field has a different value
  847. than where the mouse is.
  848.  
  849. What does it take to post mouse events?
  850.  
  851. Thanks
  852. Bill
  853.  
  854. +++++++++++++++++++++++++++
  855.  
  856. >From pbonner@pbcomputing.com (Pace Bonner)
  857. Date: 29 Aug 1994 18:01:19 GMT
  858. Organization: PB Computing
  859.  
  860. In article <33lj3k$k08@infmx.informix.com>, sbill@informix.com (Bill
  861. Stackhouse) wrote:
  862.  
  863. > I am trying to post mouseUp and mouseDown events to my application
  864. > using PPostEvent. After call PPostEvent, the what field is set to
  865. > -1. The return value is 0. If I scan the event queue, there are
  866. > no events. Even though I set the mouse position using low mem
  867. > globals before the post, the where field has a different value
  868. > than where the mouse is.
  869. > What does it take to post mouse events?
  870.  
  871. Try this code....It works for me.
  872.  
  873.         /* do a mouse down with correct cmd keys */
  874. void MakeMouse(where,Mods)
  875. Point             where;
  876. short             Mods;
  877. {
  878.     EvQEl            *MyEventPtr;
  879.     OsErr            err;
  880.  
  881.     err = PPostEvent(mouseDown, 0, &MyEventPtr);
  882.     MyEventPtr->evtQWhere.h = where.h;
  883.     MyEventPtr->evtQWhere.v = where.v;
  884.     MyEventPtr->evtQModifiers = Mods;
  885.     
  886.     err = PPostEvent(mouseUp, 0, &MyEventPtr);
  887.     MyEventPtr->evtQWhere.h = where.h;
  888.     MyEventPtr->evtQWhere.v = where.v;
  889.     MyEventPtr->evtQModifiers = Mods;
  890.     
  891. }
  892.  
  893. +------------------------------------------------------------------------+
  894. Pace Bonner                Macintosh & Newton        512.335.1033
  895. PB Computing              Software Development       11100 Spear Oak Cove
  896. pbonner@pbcomputing.com         Services             Austin, TX 78759-7004
  897. +------------------------------------------------------------------------+
  898.  
  899. +++++++++++++++++++++++++++
  900.  
  901. >From rollin@newton.apple.com (Keith Rollin)
  902. Date: Thu, 01 Sep 1994 19:42:04 -0800
  903. Organization: Apple ][ -> Mac -> Taligent -> Newton -> Windows?
  904.  
  905. In article <33lj3k$k08@infmx.informix.com>, sbill@informix.com (Bill
  906. Stackhouse) wrote:
  907.  
  908. >I am trying to post mouseUp and mouseDown events to my application
  909. >using PPostEvent. After call PPostEvent, the what field is set to
  910. >-1. The return value is 0. If I scan the event queue, there are
  911. >no events. Even though I set the mouse position using low mem
  912. >globals before the post, the where field has a different value
  913. >than where the mouse is.
  914. >
  915. >What does it take to post mouse events?
  916.  
  917. This is the way I did it for Macintosh Programming Secrets:
  918.  
  919.                 PPostEvent(mouseDown, 0, &qElPtr);
  920.                 qElPtr->evtQWhere = location;
  921.                 PPostEvent(mouseUp, 0, &qElPtr);
  922.                 qElPtr->evtQWhere = location;
  923.  
  924. This code has always worked for me so far. I don't know if there are any
  925. A/UX issues.
  926.  
  927. - --------------------------------------------------------------------------
  928. Keith Rollin --- Phantom Programmer --- Apple Computer, Inc. --- Team Newton
  929.  
  930. ---------------------------
  931.  
  932. >From U086753@adpdp2.lanl.gov (Jeff Dunning)
  933. Subject: Sample MacTcp Programs
  934. Date: Wed, 31 Aug 94 18:49:44 GMT
  935. Organization: Los Alamos National lab.
  936.  
  937. I am looking for a couple of sample MacTcp programs. Where might some be found.
  938.  
  939. Thanks. 
  940. jsd@lanl.gov
  941. Jeff Dunning
  942. Los Alamos National Laboratory
  943. (505)667-8418
  944.  
  945. +++++++++++++++++++++++++++
  946.  
  947. >From hanrek@cts.com (Mark Hanrek)
  948. Date: 31 Aug 1994 20:52:10 GMT
  949. Organization: The Information Workshop
  950.  
  951. In article <U086753.1128746624A@newshost.lanl.gov>, jsd@lanl.gov wrote:
  952.  
  953. > I am looking for a couple of sample MacTcp programs. 
  954. > Where might some be found?
  955.  
  956.  
  957. Jeff,
  958.  
  959. Here are some leads to resources...
  960.  
  961.  
  962.   * Snippets/network section of Developer CD
  963.  
  964.   * Snippets section of ftp://ftp.apple.com/
  965.  
  966.   * ftp://seeding.apple.com/mactcp/MacTCP_Dev_Kit
  967.  
  968.   * articles in "develop" magazine ftp://ftp.apple.com
  969.  
  970.   * source code archives everywhere
  971.       ( start at nic.switch.ch )
  972.  
  973.  
  974. This should help. :)
  975.  
  976. Mark Hanrek
  977.  
  978. +++++++++++++++++++++++++++
  979.  
  980. >From resnick@uiuc.edu (Pete Resnick)
  981. Date: Wed, 31 Aug 1994 18:16:38 -0500
  982. Organization: University of Illinois at Urbana-Champaign
  983.  
  984. In article <hanrek-3108941354220001@auke.cts.com>, hanrek@cts.com (Mark
  985. Hanrek) wrote:
  986.  
  987. >In article <U086753.1128746624A@newshost.lanl.gov>, jsd@lanl.gov wrote:
  988. >
  989. >> I am looking for a couple of sample MacTcp programs. 
  990. >> Where might some be found?
  991. >
  992. >Here are some leads to resources...
  993. >
  994. >  * Snippets/network section of Developer CD
  995. >
  996. >  * Snippets section of ftp://ftp.apple.com/
  997.  
  998. Eeeek!!! No, don't use those as examples. They're horribly written,
  999. useless pieces of code. They do synchronous I/O that will hang your
  1000. machine. Just say no!
  1001.  
  1002. >  * ftp://seeding.apple.com/mactcp/MacTCP_Dev_Kit
  1003.  
  1004. I don't believe there is any code in there.
  1005.  
  1006. >  * articles in "develop" magazine ftp://ftp.apple.com
  1007.  
  1008. Don't look at the articles by Steve Falkenburg. Same warning as above on
  1009. Snippets.
  1010.  
  1011. >  * source code archives everywhere
  1012. >      ( start at nic.switch.ch )
  1013.  
  1014. Also look at the NewsWatcher source code--
  1015.  
  1016. ftp://ftp.acns.nwu.edu//pub/newswatcher/source-20b9.sea.hqx
  1017.  
  1018. And some of Peter Lewis's stuff (which should be lots of places).
  1019.  
  1020. pr
  1021. -- 
  1022. Pete Resnick        (...so what is a mojo, and why would one be rising?)
  1023. Doctoral Student - Philosophy Department, Gregory Hall, UIUC
  1024. System manager - Cognitive Science Group, Beckman Institute, UIUC
  1025. Internet: resnick@uiuc.edu
  1026.  
  1027. ---------------------------
  1028.  
  1029. >From jbeeghly@u.washington.edu (Jeff Beeghly)
  1030. Subject: Selecting Window via menus
  1031. Date: 31 Aug 1994 17:37:50 GMT
  1032. Organization: University of Washington
  1033.  
  1034.  
  1035. I'm creating an app that will contain multiple windows that are 
  1036. dynamically created and destroyed.  I was keeping track of each window 
  1037. and it's data via a linked-list, but some friends of mine said that the 
  1038. "Mac way of handling multiple child windows is to use window reference 
  1039. values".
  1040.  
  1041.  
  1042. So I converted my app from using linked-lists to using window references 
  1043. (not an easy task, mind you) and I'm finding out that this method has 
  1044. several setbacks compared to my original method, one of which is bringing 
  1045. a window to the front via menus.
  1046.  
  1047. I was digging through THINK Reference and I found out that a Window 
  1048. Record contains a pointer to the next window.  Well, I implemented a test 
  1049. into my program that displays the title of each child window:
  1050.  
  1051. i = 0;
  1052. whichWindow = FrontWindow();
  1053. while( whichWindow )
  1054. {
  1055.     GetWTitle(whichWindow, title);
  1056.     MoveTo(4, 10 + i);
  1057.     DrawString(title);
  1058.     whichWindow = (WindowPtr )(((WindowPeek )whichWindow)->nextWindow);
  1059.     i += 20;
  1060. }
  1061.  
  1062. I'm comming across 2 problems with this:
  1063. 1) In my app, if I create 4 new windows, then invoke this operation, only 
  1064. the top window's (window #4) title is displayed.  However, if I click on 
  1065. one of the other windows (causing the window to be moved to the front), 
  1066. then invoke this function, all four titles appear.  Thus, if I was to use 
  1067. this implementation of getting a list of windows, it wouldn't be valid 
  1068. until one of the windows was topped.
  1069.  
  1070. 2) Even when the items are displayed, they aren't displayed in the order 
  1071. in which they were created.  In other words, if I create 4 new windows, 
  1072. then select window #1 to come up, I would expect to see the titles of 
  1073. win1, win2, win3, win4 displayed.  Instead, I get win1, win4, win3, win2.  
  1074. I've tested this out a bit more, and it seems that the nextWindow points 
  1075. to the window underneath the current window, not the window that was created 
  1076. after the current window.
  1077.  
  1078. This makes sense, but it doesn't help me out.  What I was going to do was 
  1079. have a counter.  If menu item #2 was selected, then that must mean that 
  1080. the second window needs to be topped.  I would then imcrement the window 
  1081. pointer to the second created window and select it.  Obviously this will 
  1082. not work.
  1083.  
  1084. So right now I'm thinking about creating an array holding the window pointers
  1085. and it would look something like this:
  1086.  
  1087. menuItem = 2;  // The third window needs to be topped
  1088.  
  1089. winPtr = ourArray[ menuItem ];
  1090.  
  1091. SelectWindow( winPtr );
  1092.  
  1093.  
  1094. I was wondering: Is there an easier (and more standardised) way of doing 
  1095. this?  Are there any code examples of this floating around?
  1096.  
  1097.  
  1098. P.S.  I have thought about comparing the string in the menu item with the 
  1099. title of the window.  The problem is this:  What do you do if you have 
  1100. two windows with the same title?  Suppose you have two files from two 
  1101. different folders opened with the same name?  I know that some apps add a 
  1102. number at the end of the name (MyDoc:1 vs MyDoc:2), but personally, I 
  1103. don't like doing that.
  1104.  
  1105.  
  1106. +++++++++++++++++++++++++++
  1107.  
  1108. >From bb@lightside.com (Bob Bradley)
  1109. Date: Tue, 30 Aug 1994 02:03:58 -0800
  1110. Organization: SS Software Inc.
  1111.  
  1112. In article <342f5e$2mf@news.u.washington.edu>, jbeeghly@u.washington.edu
  1113. (Jeff Beeghly) wrote:
  1114.  
  1115. > I was digging through THINK Reference and I found out that a Window 
  1116. > Record contains a pointer to the next window.  Well, I implemented a test 
  1117. > into my program that displays the title of each child window:
  1118. > i = 0;
  1119. > whichWindow = FrontWindow();
  1120. > while( whichWindow )
  1121. > {
  1122. >         GetWTitle(whichWindow, title);
  1123. >         MoveTo(4, 10 + i);
  1124. >         DrawString(title);
  1125. >         whichWindow = (WindowPtr )(((WindowPeek )whichWindow)->nextWindow);
  1126. >         i += 20;
  1127. > }
  1128. > I'm comming across 2 problems with this:
  1129. > 1) In my app, if I create 4 new windows, then invoke this operation, only 
  1130. > the top window's (window #4) title is displayed.  However, if I click on 
  1131. > one of the other windows (causing the window to be moved to the front), 
  1132. > then invoke this function, all four titles appear.  Thus, if I was to use 
  1133. > this implementation of getting a list of windows, it wouldn't be valid 
  1134. > until one of the windows was topped.
  1135.  
  1136. One probably you may be having is you may be drawing in a part of the
  1137. window that isn't visible so it's not showing up. Accessing the nextWindow
  1138. field of the WindowRecord doesn't select the window. Try moving your
  1139. windows apart so you know the part you are trying to draw into is visible
  1140. (normally you would always do any drawing from your updateEvt handler.).
  1141.  
  1142. > 2) Even when the items are displayed, they aren't displayed in the order 
  1143. > in which they were created.  In other words, if I create 4 new windows, 
  1144. > then select window #1 to come up, I would expect to see the titles of 
  1145. > win1, win2, win3, win4 displayed.  Instead, I get win1, win4, win3, win2.  
  1146. > I've tested this out a bit more, and it seems that the nextWindow points 
  1147. > to the window underneath the current window, not the window that was created 
  1148. > after the current window.
  1149.  
  1150. You are correct, nextWindow points to the window beneath the current
  1151. window. You can use this to step down thru your windows one beneath the
  1152. other.
  1153.  
  1154. > This makes sense, but it doesn't help me out.  What I was going to do was 
  1155. > have a counter.  If menu item #2 was selected, then that must mean that 
  1156. > the second window needs to be topped.  I would then imcrement the window 
  1157. > pointer to the second created window and select it.  Obviously this will 
  1158. > not work.
  1159.  
  1160. There is an example of keeping track of windows in a menu in the book Mac
  1161. Programming Secrets (Keith Rollin and Scott Knaster) and the source is
  1162. available almost everyway (usually named MPS 1.0.1). They keep track of
  1163. the order which the windows were created and access the windows via menus
  1164. in the same manner.
  1165.  
  1166. Another way you could do it is to attach some private data to the window
  1167. that contains a variable to keep track of which menuItem # the window goes
  1168. with, then write a simple routine to step thru the window list (using
  1169. nextWindow) checking each window's private data for the menuItem # you're
  1170. trying to find.
  1171.  
  1172. +++++++++++++++++++++++++++
  1173.  
  1174. >From Matt Slot <fprefect@engin.umich.edu>
  1175. Date: 1 Sep 1994 01:43:11 GMT
  1176. Organization: University of Michigan
  1177.  
  1178. Jeff Beeghly, jbeeghly@u.washington.edu writes:
  1179.  > I was wondering: Is there an easier (and more standardised) way of doing 
  1180.  > this?  Are there any code examples of this floating around?
  1181.  
  1182. - ---------
  1183.  
  1184. I have just written such a beast. Here is some sample code that handles
  1185. a windows menu. The default menu looks like this...
  1186.  
  1187.     Windows
  1188.     --------------------
  1189.     Show/Hide Floater #1
  1190.     Show/Hide Floater #2
  1191.  
  1192. And I add a separator when I put any document windows underneath.
  1193. Basically, I keep a Mac Queue of window information, that is ordered by
  1194. window creation. As I make, destroy, or rename a window, I make the
  1195. appropriate call and I am magically taken care of. I map the index of the
  1196. menu item into the element of the queue.
  1197.     
  1198. Share and enjoy
  1199.  
  1200. Matt
  1201.     
  1202. // * **************************************************************************** * //
  1203. // * **************************************************************************** * //
  1204. // Menu Item numbers
  1205.  
  1206. #define    kWindowsFloater1        1
  1207. #define    kWindowsFloater2        2
  1208. #define    kWindowsSeparator1        3
  1209.  
  1210. // * **************************************************************************** * //
  1211.  
  1212. typedef struct WindowQElem {
  1213.     struct WindowQElem qLink;
  1214.     short qType;
  1215.     WindowPtr win;
  1216.     } WindowQElem, *WindowQElemPtr;
  1217.         
  1218. // * **************************************************************************** * //
  1219.  
  1220. QHdr gDocsOpen;
  1221.  
  1222. // * **************************************************************************** * //
  1223.  
  1224. void AddToWindowsMenu(WindowPtr win) {
  1225.     Str255 textBuff;
  1226.     MenuHandle theMenu;
  1227.     WindowQElemPtr wQPtr;
  1228.     
  1229.     theMenu = GetMenu(kWindowsMenuID);
  1230.     if (CountMItems(theMenu) < kWindowsSeparator1)
  1231.         InsMenuItem(theMenu, "\p-", kWindowsSeparator1);
  1232.     
  1233.     if (wQPtr = (WindowQElemPtr) NewPtrClear(sizeof(*wQPtr))) {
  1234.         
  1235.         wQPtr->win = win;
  1236.         Enqueue((QElemPtr) wQPtr, &gDocsOpen);
  1237.  
  1238.         AppendMenu(theMenu, "\p ");
  1239.         GetWTitle(win, textBuff);
  1240.         SetItem(theMenu, CountMItems(theMenu), textBuff);
  1241.         
  1242.         DrawMenuBar();
  1243.         }
  1244.     }
  1245.  
  1246. // * **************************************************************************** * //
  1247. // * **************************************************************************** * //
  1248.  
  1249. void ModifyFromWindowsMenu(WindowPtr win) {
  1250.     short i;
  1251.     Str255 textBuff;
  1252.     MenuHandle theMenu;
  1253.     WindowQElemPtr wQPtr;
  1254.     
  1255.     theMenu = GetMenu(kWindowsMenuID);
  1256.     
  1257.     for(wQPtr = (WindowQElemPtr) gDocsOpen.qHead, i=0; wQPtr;
  1258.             wQPtr = wQPtr->next, i++)
  1259.         if (wQPtr->win == win) {
  1260.             GetWTitle(win, textBuff);
  1261.             SetItem(theMenu, kWindowsFirstWinItem + i, textBuff);
  1262.             DrawMenuBar();
  1263.  
  1264.             return;
  1265.             }
  1266.  
  1267.     }
  1268.  
  1269. // * **************************************************************************** * //
  1270. // * **************************************************************************** * //
  1271.  
  1272. void RemoveFromWindowsMenu(WindowPtr win) {
  1273.     short i;
  1274.     Str255 textBuff;
  1275.     MenuHandle theMenu;
  1276.     WindowQElemPtr wQPtr;
  1277.     
  1278.     theMenu = GetMenu(kWindowsMenuID);
  1279.     
  1280.     for(wQPtr = (WindowQElemPtr) gDocsOpen.qHead, i=0; wQPtr;
  1281.             wQPtr = wQPtr->next, i++)
  1282.         if ((wQPtr->win == win) && ! Dequeue((QElemPtr) wQPtr, &gDocsOpen)) {
  1283.             DelMenuItem(theMenu, kWindowsFirstWinItem + i);
  1284.             if (CountMItems(theMenu) == kWindowsSeparator1)
  1285.                 DelMenuItem(theMenu, kWindowsSeparator1);
  1286.             DrawMenuBar();
  1287.  
  1288.             return;
  1289.             }
  1290.     }
  1291.  
  1292. +++++++++++++++++++++++++++
  1293.  
  1294. >From h+@nada.kth.se (Jon W{tte)
  1295. Date: Thu, 01 Sep 1994 14:55:32 +0200
  1296. Organization: Royal Institute of Something or other
  1297.  
  1298. In article <342f5e$2mf@news.u.washington.edu>,
  1299. jbeeghly@u.washington.edu (Jeff Beeghly) wrote:
  1300.  
  1301. >whichWindow = FrontWindow();
  1302. >while( whichWindow )
  1303. >{
  1304. >    GetWTitle(whichWindow, title);
  1305. >    MoveTo(4, 10 + i);
  1306. >    DrawString(title);
  1307. >    whichWindow = (WindowPtr )(((WindowPeek )whichWindow)->nextWindow);
  1308. >    i += 20;
  1309. >}
  1310.  
  1311. This looks quite allright.
  1312.  
  1313. >1) In my app, if I create 4 new windows, then invoke this operation, only 
  1314. >the top window's (window #4) title is displayed.  However, if I click on 
  1315. >one of the other windows (causing the window to be moved to the front), 
  1316. >then invoke this function, all four titles appear.  Thus, if I was to use 
  1317.  
  1318. This is strange. You're probably doing something wrong in 
  1319. creating and showing the windows. Or maybe you're now showing 
  1320. the windows? FrontWindow() returns the frontmost VISIBLE 
  1321. window. If you want to get the list of ALL windows, you have to 
  1322. use LMGetWindowList() and walk from there.
  1323.  
  1324. >2) Even when the items are displayed, they aren't displayed in the order 
  1325. >in which they were created.  In other words, if I create 4 new windows, 
  1326. >then select window #1 to come up, I would expect to see the titles of 
  1327. >win1, win2, win3, win4 displayed.  Instead, I get win1, win4, win3, win2.  
  1328.  
  1329. Yes; the titles come up in the order they lie in the layers. If 
  1330. you create each new window on top of the preceeding window, 
  1331. it'll be before it in the list.
  1332.  
  1333. Cheers,
  1334.  
  1335.                 / h+
  1336.  
  1337.  
  1338. --
  1339.   Jon W‰tte (h+@nada.kth.se), Hagagatan 1, 113 48 Stockholm, Sweden
  1340.  
  1341.   Reality exists only in your imagination.
  1342.  
  1343.  
  1344. ---------------------------
  1345.  
  1346. >From phixus@netcom.com (Chris DeSalvo)
  1347. Subject: SetDialogDefaultItem real?
  1348. Date: Wed, 17 Aug 1994 08:28:47 GMT
  1349. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1350.  
  1351. Think Reference mentions two traps:
  1352.  
  1353. SetDialogDefaultItem and
  1354. SetDialogCancelItem
  1355.  
  1356. They are supposed to take care of button hiliting, outlining, and
  1357. keyboard mapping of things like return/enter and escape.
  1358.  
  1359. The traps are definied in the Universal Headers but they don't seem to
  1360. work.  They are not documented in the Dialog Manager section of
  1361. NIM:Toolbox Essentials.
  1362.  
  1363. Are these entries just place holders or is there some magic I have not
  1364. learned to get them to work?
  1365.  
  1366.  
  1367. Thanx
  1368. Chris
  1369. -- 
  1370. +-----------------------------------------------------------------+
  1371. | phixus@netcom.com           |   Macintosh:  Changing the world, |
  1372. | Chris De Salvo              |        one person at a time!      |
  1373. | Professional Mac Geek       |    -----------------------------  |
  1374. | for MacPlay, Inc.           |      (I wish they'd hurry up!)    |
  1375. +-----------------------------------------------------------------+
  1376.  
  1377. Any opinions expressed, or implied, are my own!  They should not be
  1378. considered representative of the opinions or policies of my employer,
  1379. MacPlay, a division of Interplay Productions, Inc.
  1380.  
  1381. +++++++++++++++++++++++++++
  1382.  
  1383. >From spencerl@crl.com (Spencer Low)
  1384. Date: Wed, 17 Aug 1994 12:24:56 -0800
  1385. Organization: LowTek Creations
  1386.  
  1387. In article <phixusCuo7K0.Fzr@netcom.com>, phixus@netcom.com (Chris DeSalvo)
  1388. wrote:
  1389. > The traps are definied in the Universal Headers but they don't seem to
  1390. > work.  They are not documented in the Dialog Manager section of
  1391. > NIM:Toolbox Essentials.
  1392.  
  1393. Make sure that you don't have an extension that messes with ModalDialog
  1394. filter procs - I was running the cool Escapade, but it seemed to stop this
  1395. "default" behavior.
  1396.  
  1397. If you have your own custom filter proc, make sure it calls the Standard
  1398. proc with GetStdFilterProc().
  1399.  
  1400. Spencer (please correct me if I'm wrong..)
  1401.  
  1402. +++++++++++++++++++++++++++
  1403.  
  1404. >From phixus@netcom.com (Chris DeSalvo)
  1405. Date: Thu, 18 Aug 1994 11:03:40 GMT
  1406. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1407.  
  1408. Spencer Low (spencerl@crl.com) wrote:
  1409. : In article <phixusCuo7K0.Fzr@netcom.com>, phixus@netcom.com (Chris DeSalvo)
  1410. : wrote:
  1411. : > The traps are definied in the Universal Headers but they don't seem to
  1412. : > work.  They are not documented in the Dialog Manager section of
  1413. : > NIM:Toolbox Essentials.
  1414.  
  1415. : If you have your own custom filter proc, make sure it calls the Standard
  1416. : proc with GetStdFilterProc().
  1417.  
  1418. That is probably the case, I do indeed have a custom event filter on
  1419. this dialog.  I will check it out.
  1420.  
  1421. Thanx
  1422. Chris
  1423. -- 
  1424. +-----------------------------------------------------------------+
  1425. | phixus@netcom.com           |   Macintosh:  Changing the world, |
  1426. | Chris De Salvo              |        one person at a time!      |
  1427. | Professional Mac Geek       |    -----------------------------  |
  1428. | for MacPlay, Inc.           |      (I wish they'd hurry up!)    |
  1429. +-----------------------------------------------------------------+
  1430.  
  1431. Any opinions expressed, or implied, are my own!  They should not be
  1432. considered representative of the opinions or policies of my employer,
  1433. MacPlay, a division of Interplay Productions, Inc.
  1434.  
  1435. +++++++++++++++++++++++++++
  1436.  
  1437. >From Chris Anthes <chrisa@dsea.com>
  1438. Date: Thu, 18 Aug 1994 17:25:43 GMT
  1439. Organization: DSEA
  1440.  
  1441. In article <phixusCuq9E4.8tG@netcom.com> Chris DeSalvo, phixus@netcom.com
  1442. writes:
  1443. >: If you have your own custom filter proc, make sure it calls the Standard
  1444. >: proc with GetStdFilterProc().
  1445. >
  1446. >That is probably the case, I do indeed have a custom event filter on
  1447. >this dialog.  I will check it out.
  1448.  
  1449. Even if you are using a custom dialog filter, you can still use
  1450. SetDialogDefaultItem, SetDialogCancelItem, and SetDialogTrackCursor. 
  1451. After you are done processing whatever you need to in your filter, make a
  1452. call to the Standard Dialog Filter.  This is all explained in detail in
  1453. Mac Tech Note #304.  Here is the code I use to handle custom dialog
  1454. filters.  This code differs slightly because I use returnVal to determine
  1455. whether or not I need to call the standard dialog routines.  I did this I
  1456. think because I needed to filter Return & Enter and alias them to Tab when
  1457. all of the data in my dialog wasn't entered (e.g. OK button grayed out).
  1458.  
  1459. /***** myDialogFilter *****/
  1460.  
  1461. pascal Boolean    myDialogFilter( DialogPtr theDialog, EventRecord
  1462.         *theDialogEvent, short *theDialogItem )
  1463. {
  1464.     ModalFilterProcPtr        standardProc;
  1465.     Boolean                    returnVal = false;
  1466.     WindowPtr                temp;
  1467.  
  1468.     //
  1469.     // Do all of your filter processing here...
  1470.     //
  1471.  
  1472.     // Go to the standard dialog filter if the event wasn't completely
  1473.     // handled
  1474.     if ( returnVal != true ) {
  1475.         GetPort( &temp );
  1476.         SetPort( theDialog );
  1477.         GetStdFilterProc( &standardProc );
  1478.         returnVal = ((ModalFilterProcPtr)standardProc)( theDialog,
  1479.             theDialogEvent, theDialogItem );
  1480.         SetPort( temp );
  1481.     }
  1482.     
  1483.     return( returnVal );
  1484. }
  1485.  
  1486. If you need some more info on this, send me an email.
  1487.  
  1488. Cya L8r,
  1489.  
  1490. Chris
  1491.  
  1492. ***************************************************************************
  1493. *                             *                                           *
  1494. *  It's not the crime,        *  Chris Anthes          (chrisa@dsea.com)  *
  1495. *  It's not the thought,      *  ---------------------------------------  *
  1496. *  It's not the deed,         *  DAINIPPON SCREEN ENGINEERING OF AMERICA  *
  1497. *                             *  3700 West Segerstrom Avenue              *
  1498. *  IT'S IF YOU GET CAUGHT!!!  *  Santa Ana, CA 92704                      *
  1499. *                             *                                           *
  1500. ***************************************************************************
  1501.  
  1502. +++++++++++++++++++++++++++
  1503.  
  1504. >From b-clark@nwu.edu (Brian Clark)
  1505. Date: Wed, 17 Aug 1994 11:00:34 -0500
  1506. Organization: Northwestern University
  1507.  
  1508. In article <phixusCuo7K0.Fzr@netcom.com>, phixus@netcom.com (Chris
  1509. DeSalvo) wrote:
  1510.  
  1511. > Think Reference mentions two traps:
  1512. > SetDialogDefaultItem and
  1513. > SetDialogCancelItem
  1514. > Are these entries just place holders or is there some magic I have not
  1515. > learned to get them to work?
  1516.  
  1517. They work fine, but only when the standard system dialog filter proc is
  1518. called (either because you haven't specified your own, or you explicitly
  1519. call it from within your custom filter proc.
  1520.  
  1521. +++++++++++++++++++++++++++
  1522.  
  1523. >From andrew@csgrad.cs.vt.edu (Andrew Southwick)
  1524. Date: 19 Aug 1994 14:02:53 GMT
  1525. Organization: IBM SWSD, Lexington, KY, USA
  1526.  
  1527. b-clark@nwu.edu (Brian Clark) writes:
  1528. > phixus@netcom.com (Chris DeSalvo) wrote:
  1529. >> SetDialogDefaultItem and
  1530. >> SetDialogCancelItem
  1531.  
  1532. >They work fine, but only when the standard system dialog filter proc is
  1533. >called (either because you haven't specified your own, or you explicitly
  1534. >call it from within your custom filter proc.
  1535.  
  1536. Also, these traps have to be defined by the headers that you are using.
  1537. The headers that come with ThinkC up til (at least) 6.0 don't define
  1538. them, so you have to do one of those
  1539.     void SetDialogDefaultItem( blah ) 0xYYYY;
  1540. things at the top of your code.  Sorry, don't have the trap number with me.
  1541. It's mentioned in the ThinkC Programming Primer, though, and ThinkRef
  1542. might have the trap numbers, too.
  1543.  
  1544.  
  1545. Best Premises,                                      andrew@csgrad.cs.vt.edu
  1546. Andrew R. Southwick                                 asouthwick@vnet.ibm.com
  1547.  
  1548.  
  1549. +++++++++++++++++++++++++++
  1550.  
  1551. >From Dave Falkenburg <falken@apple.com>
  1552. Date: Thu, 1 Sep 1994 16:52:43 GMT
  1553. Organization: Apple Computer, Inc.
  1554.  
  1555. In article <phixusCuo7K0.Fzr@netcom.com> Chris DeSalvo, phixus@netcom.com
  1556. writes:
  1557. >SetDialogDefaultItem and
  1558. >SetDialogCancelItem
  1559. >
  1560. >The traps are definied in the Universal Headers but they don't seem to
  1561. >work.  They are not documented in the Dialog Manager section of
  1562. >NIM:Toolbox Essentials.
  1563.  
  1564. They were documented in the Technotes, but do to a race condition were never
  1565. included with IM:Toolbox Essentials. During the PowerPC effort, we figured
  1566. this out and added them to the headers.
  1567.  
  1568. >Are these entries just place holders or is there some magic I have not
  1569. >learned to get them to work?
  1570.  
  1571. Yes they work, but you must supply a dialog filter proc which calls
  1572. StdFilterProc in order to make them work as advertised. See technote
  1573. TB 37 "Pending Update Perils".
  1574.  
  1575. Whenever using modal dialogs it is best to always supply a filter proc
  1576. to keep pending updates in your application from blocking background
  1577. processing. The same technote which documents these calls explains this
  1578. problem in more detail.
  1579.  
  1580. Watch for an upcomming issue of MacTech, which will include "Sprocket",
  1581. an application shell with code that deals with these calls.
  1582.  
  1583. -Dave Falkenburg
  1584. -Apple Computer, Inc.
  1585.  
  1586. ---------------------------
  1587.  
  1588. >From Bernd Mathiske <mathiske@dbis1.informatik.uni-hamburg.de>
  1589. Subject: Stack sniffer - how can I turn it off?
  1590. Date: 16 Aug 1994 18:02:53 GMT
  1591. Organization: Universitaet Hamburg
  1592.  
  1593. Dear internet-community!
  1594.  
  1595. Help!
  1596. Do you know how I can get rid of the very annoying vbl-"stack sniffer"
  1597. that causes error #28 when I move the stack pointer into the heap?
  1598. I do not see the point why I should not have my stacks allocated
  1599. where I like them to be, in particular if there are several of them
  1600. between which I want to switch around, the latter allowing me to
  1601. implement coroutines.
  1602.  
  1603. Any idea anybody?
  1604.  
  1605. %  ======================================================
  1606. %                Bernd Mathiske
  1607. %  voice:        +49-40/54715-330
  1608. %  e-mail:       mathiske@dbis1.informatik.uni-hamburg.de
  1609. %  snail mail:   Universitaet Hamburg
  1610. %                Vogt-Koelln-Strasse 30
  1611. %                D-22527 Hamburg, Deutschland
  1612. %  ======================================================
  1613.  
  1614. +++++++++++++++++++++++++++
  1615.  
  1616. >From bobo@reed.edu (Eric Bowman)
  1617. Date: 17 Aug 1994 04:24:16 GMT
  1618. Organization: Reed College,  Portland, Oregon
  1619.  
  1620. In article <32qv0d$7t1@rzsun02.rrz.uni-hamburg.de>,
  1621. Bernd Mathiske  <mathiske@dbis1.informatik.uni-hamburg.de> wrote:
  1622. >Do you know how I can get rid of the very annoying vbl-"stack sniffer"
  1623. >that causes error #28 when I move the stack pointer into the heap?
  1624. >I do not see the point why I should not have my stacks allocated
  1625. >where I like them to be, in particular if there are several of them
  1626. >between which I want to switch around, the latter allowing me to
  1627. >implement coroutines.
  1628.  
  1629. To disable the stack sniffer,
  1630.  
  1631. Ptr oldTopOfStack = LMGetStackLowPoint();
  1632. LMSetStackLowPoint(NULL);
  1633.  
  1634. To undo the damage,
  1635.  
  1636. LMSetStackLowPoint(oldTopOfStack);
  1637.  
  1638. cheers,
  1639. bobo
  1640.  
  1641. +++++++++++++++++++++++++++
  1642.  
  1643. >From quinn@cs.uwa.edu.au (Quinn "The Eskimo!")
  1644. Date: Wed, 17 Aug 1994 17:20:16 +0800
  1645. Organization: Department of Computer Science, The University of Western Australia
  1646.  
  1647. In article <32qv0d$7t1@rzsun02.rrz.uni-hamburg.de>, Bernd Mathiske
  1648. <mathiske@dbis1.informatik.uni-hamburg.de> wrote:
  1649.  
  1650. >Do you know how I can get rid of the very annoying vbl-"stack sniffer"
  1651. >that causes error #28 when I move the stack pointer into the heap?
  1652. >I do not see the point why I should not have my stacks allocated
  1653. >where I like them to be, in particular if there are several of them
  1654. >between which I want to switch around, the latter allowing me to
  1655. >implement coroutines.
  1656.  
  1657. No it won't (:  There are problems with putting the stack in the heap,
  1658. specifically a number of toolbox calls expect the stack to be above the
  1659. heap and get very upset when it isn't.  If you want to do co-routines, use
  1660. the Thread Manager.
  1661.  
  1662. btw You can disable the stack sniffer by putting 0 into the low memory
  1663. global StkLowPt.  I've also seen Apple code that disables it by patching
  1664. SysError and preventing error 28 getting through (:
  1665. -- 
  1666. Quinn "The Eskimo!"      <quinn@cs.uwa.edu.au>     "Support HAVOC!"
  1667. Department of Computer Science, The University of Western Australia
  1668.  
  1669. +++++++++++++++++++++++++++
  1670.  
  1671. >From ari@world.std.com (Ari I Halberstadt)
  1672. Date: Wed, 17 Aug 1994 17:54:25 GMT
  1673. Organization: The World Public Access UNIX, Brookline, MA
  1674.  
  1675. In article <quinn-1708941720160001@edu-dynamic1.educ.ecel.uwa.edu.au>,
  1676. Quinn "The Eskimo!" <quinn@cs.uwa.edu.au> wrote:
  1677. >In article <32qv0d$7t1@rzsun02.rrz.uni-hamburg.de>, Bernd Mathiske
  1678. ><mathiske@dbis1.informatik.uni-hamburg.de> wrote:
  1679. >
  1680. >>Do you know how I can get rid of the very annoying vbl-"stack sniffer"
  1681. >>that causes error #28 when I move the stack pointer into the heap?
  1682. >>I do not see the point why I should not have my stacks allocated
  1683. >>where I like them to be, in particular if there are several of them
  1684. >>between which I want to switch around, the latter allowing me to
  1685. >>implement coroutines.
  1686. >
  1687. >No it won't (:  There are problems with putting the stack in the heap,
  1688. >specifically a number of toolbox calls expect the stack to be above the
  1689. >heap and get very upset when it isn't.  If you want to do co-routines, use
  1690. >the Thread Manager.
  1691.  
  1692. You can fool them into being happy by setting 3 low-memory globals.
  1693. It's tricky though.
  1694. -- 
  1695. Ari Halberstadt                                 ari@world.std.com
  1696. One generation passes away, and another generation comes: but the
  1697. earth abides for ever. -- Ecclesiastes, 1:4.
  1698.  
  1699. +++++++++++++++++++++++++++
  1700.  
  1701. >From sparent@mv.us.adobe.com (Sean Parent)
  1702. Date: Wed, 17 Aug 1994 22:48:18 GMT
  1703. Organization: Adobe Systems Incorporated
  1704.  
  1705. It is tricky to fool the toolbox because one of the lowmem globals that
  1706. has to be set is the HiHeapMark (thus confusing the memory manager). The
  1707. cleanest way (other than using the Thread Manager) that I have seen is to
  1708. just BlockMoveData your alternate stacks into the stack. It costs a few
  1709. extra cycles but can save you a boat load of time getting other stuff
  1710. working.
  1711.  
  1712. In article <Cuoxqq.L94@world.std.com>, ari@world.std.com (Ari I
  1713. Halberstadt) wrote:
  1714.  
  1715. > In article <quinn-1708941720160001@edu-dynamic1.educ.ecel.uwa.edu.au>,
  1716. > Quinn "The Eskimo!" <quinn@cs.uwa.edu.au> wrote:
  1717. > >In article <32qv0d$7t1@rzsun02.rrz.uni-hamburg.de>, Bernd Mathiske
  1718. > ><mathiske@dbis1.informatik.uni-hamburg.de> wrote:
  1719. > >
  1720. > >>Do you know how I can get rid of the very annoying vbl-"stack sniffer"
  1721. > >>that causes error #28 when I move the stack pointer into the heap?
  1722. > >>I do not see the point why I should not have my stacks allocated
  1723. > >>where I like them to be, in particular if there are several of them
  1724. > >>between which I want to switch around, the latter allowing me to
  1725. > >>implement coroutines.
  1726. > >
  1727. > >No it won't (:  There are problems with putting the stack in the heap,
  1728. > >specifically a number of toolbox calls expect the stack to be above the
  1729. > >heap and get very upset when it isn't.  If you want to do co-routines, use
  1730. > >the Thread Manager.
  1731. > You can fool them into being happy by setting 3 low-memory globals.
  1732. > It's tricky though.
  1733. > -- 
  1734. > Ari Halberstadt                                 ari@world.std.com
  1735. > One generation passes away, and another generation comes: but the
  1736. > earth abides for ever. -- Ecclesiastes, 1:4.
  1737.  
  1738. -- 
  1739. Sean Parent
  1740. sparent@mv.us.adobe.com
  1741. "The critical driver of every successful project is its focused ruthlessness."
  1742.         Grady Booch
  1743.  
  1744. +++++++++++++++++++++++++++
  1745.  
  1746. >From ari@world.std.com (Ari I Halberstadt)
  1747. Date: Thu, 18 Aug 1994 03:00:21 GMT
  1748. Organization: The World Public Access UNIX, Brookline, MA
  1749.  
  1750. In article <sparent-1708941448180001@macb042.mv.us.adobe.com>,
  1751. Sean Parent <sparent@mv.us.adobe.com> wrote:
  1752. >It is tricky to fool the toolbox because one of the lowmem globals that
  1753. >has to be set is the HiHeapMark (thus confusing the memory manager). The
  1754. >cleanest way (other than using the Thread Manager) that I have seen is to
  1755. >just BlockMoveData your alternate stacks into the stack. It costs a few
  1756. >extra cycles but can save you a boat load of time getting other stuff
  1757. >working.
  1758.  
  1759. There is a third solution. It is very similar to the Thread Manager,
  1760. but has context switch times from over 2 to nearly 4 times faster than
  1761. the Thread Manager. It's my free Thread Library (not to be confused
  1762. with Apple's ThreadsLib). It's called ThreadLib-10d4.hqx (or some
  1763. similar name, depending on the archive), includes full source code,
  1764. and is available from info-mac mirrors in the dev/src directory, and
  1765. from the alt.sources.mac archive. I tested it under emulation on a
  1766. PowerPC, and it ran fine. It has been tested on a Plus, Quadra 950,
  1767. and PowerPC, with systems 6.0.5, 7Pro, and whatever the PowerPC needed
  1768. (7.1.1, or something like that). My Thread Library does not run
  1769. in native PPC mode, and does not support preemptive threads.
  1770. -- 
  1771. Ari Halberstadt                                 ari@world.std.com
  1772. One generation passes away, and another generation comes: but the
  1773. earth abides for ever. -- Ecclesiastes, 1:4.
  1774.  
  1775. +++++++++++++++++++++++++++
  1776.  
  1777. >From Clinton Bauder <gecko1@applelink.apple.com>
  1778. Date: Tue, 23 Aug 1994 19:28:07 GMT
  1779. Organization: Apple Computer Inc.
  1780.  
  1781. In article <32qv0d$7t1@rzsun02.rrz.uni-hamburg.de> Bernd Mathiske,
  1782. mathiske@dbis1.informatik.uni-hamburg.de writes:
  1783. >Do you know how I can get rid of the very annoying vbl-"stack sniffer"
  1784. >that causes error #28 when I move the stack pointer into the heap?
  1785. >I do not see the point why I should not have my stacks allocated
  1786. >where I like them to be, in particular if there are several of them
  1787. >between which I want to switch around, the latter allowing me to
  1788. >implement coroutines.
  1789. >
  1790. >Any idea anybody?
  1791.  
  1792. You should use the Thread Manager if you can.  If you can't - say your
  1793. code is a driver or something - then you can disable the Stack Sniffer by
  1794. clearing the low memory global StkLowPt (0x110 - 32 bits).  Of course
  1795. when you are done using your private stack you should put it back to what
  1796. it was.  Also your stack should be at least 4K in size plus whatever you
  1797. expect to use in your own code.  This should be sufficient for most
  1798. interrupt code which might end up using your stack.  Note that this is
  1799. not the worlds most forward compatible kind of programming but if you can
  1800. accept the possibility of future incompatibility then this is a useful
  1801. technique.
  1802.  
  1803. Clinton
  1804. - -------------------------------------------------------------
  1805. Clinton Bauder        | Opinions expressed are very likely to
  1806. SCSI Grunt and Chief  | be entirely different from the official
  1807. Herpetoculturist      | party line of Apple Computer Inc.
  1808. Apple Computer Inc.   | Support your local herp society.
  1809. - -------------------------------------------------------------
  1810.  
  1811. +++++++++++++++++++++++++++
  1812.  
  1813. >From ari@world.std.com (Ari I Halberstadt)
  1814. Date: Wed, 24 Aug 1994 01:37:38 GMT
  1815. Organization: The World Public Access UNIX, Brookline, MA
  1816.  
  1817. In article <1994Aug23.192807.4763@gallant.apple.com>,
  1818. Clinton Bauder  <gecko1@applelink.apple.com> wrote:
  1819. >it was.  Also your stack should be at least 4K in size plus whatever you
  1820. >expect to use in your own code.  This should be sufficient for most
  1821. >interrupt code which might end up using your stack.  Note that this is
  1822.  
  1823. Actually, you want at least MinStack bytes, plus whatever your app
  1824. will need. MinStack is a low-mem global.
  1825.  
  1826.  
  1827. -- 
  1828. Ari Halberstadt                                 ari@world.std.com
  1829. One generation passes away, and another generation comes: but the
  1830. earth abides for ever. -- Ecclesiastes, 1:4.
  1831.  
  1832. +++++++++++++++++++++++++++
  1833.  
  1834. >From Dave Falkenburg <falken@apple.com>
  1835. Date: Wed, 31 Aug 1994 16:44:55 GMT
  1836. Organization: Apple Computer, Inc.
  1837.  
  1838. In article <32qv0d$7t1@rzsun02.rrz.uni-hamburg.de> Bernd Mathiske,
  1839. mathiske@dbis1.informatik.uni-hamburg.de writes:
  1840. >Dear internet-community!
  1841. >
  1842. >Help!
  1843. >Do you know how I can get rid of the very annoying vbl-"stack sniffer"
  1844. >that causes error #28 when I move the stack pointer into the heap?
  1845. >I do not see the point why I should not have my stacks allocated
  1846. >where I like them to be, in particular if there are several of them
  1847. >between which I want to switch around, the latter allowing me to
  1848. >implement coroutines.
  1849. >
  1850. >Any idea anybody?
  1851.  
  1852. The stack sniffer can be turned off by zeroing out STKLOWPT. However, this
  1853. isn't enough to keep the Macintosh working if you plan on calling the
  1854. toolbox from your coroutines.
  1855.  
  1856. The supported way of doing coroutines on the Macintosh is to use the
  1857. Thread Manager. The Thread Manager is available in the form of an
  1858. extension for System 7.0 or later, and has been rolled into the base
  1859. system software in System 7.5.
  1860.  
  1861. The current version of the extension is 2.0.1, which includes support for
  1862. PowerPC machines.
  1863.  
  1864. -Dave Falkenburg
  1865. -Apple Computer, Inc.
  1866.  
  1867. ---------------------------
  1868.  
  1869. End of C.S.M.P. Digest
  1870. **********************
  1871.  
  1872.  
  1873.