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

  1. Received-Date: Sun, 12 Jun 1994 14:10:25 +0200
  2. From: pottier@clipper.ens.fr (Francois Pottier)
  3. Subject: csmp-digest-v3-034
  4. To: csmp-digest@ens.fr
  5. Date: Sun, 12 Jun 1994 14:10:18 +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: 37
  13.  
  14. C.S.M.P. Digest             Sun, 12 Jun 94       Volume 3 : Issue 34
  15.  
  16. Today's Topics:
  17.  
  18.         32-Bit Addressing
  19.         AppleScript Questions
  20.         Code Warrior allocation of Objects
  21.         Code Warrior: ruminations of a long-time MPW user
  22.         Refinement of SC++ 7.0 code gen bug
  23.         Serial Port Programming?
  24.         Serial port use
  25.         THINK Class Library FTP Site?
  26.         storage for XCMDS
  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 spencerl@crl.com (Spencer Low)
  73. Subject: 32-Bit Addressing
  74. Date: 20 May 1994 18:43:48 -0700
  75. Organization: LowTek Creations
  76.  
  77. How do you detect whether 32-bit Addressing is enabled/disabled? Also, 
  78. how can you turn it on? I remember reading somewhere that there's a bit 
  79. in PRAM that you can modify. Does anyone have any specifics or sample 
  80. code (THINK C)? I realize that the Mac would be require to be rebooted, 
  81. but I would still like an automated way to turn it on (with the 
  82. authorization of the user).
  83.  
  84. Thanks,
  85. Spencer
  86.  
  87.  
  88. -- 
  89.   Spencer Low       | Creators of MaxRAM!!
  90.   LowTek Creations  | Anonymous FTP to crl.com and look in
  91.   spencerl@crl.com  | /users/ro/spencerl/ for more info.
  92.  
  93. +++++++++++++++++++++++++++
  94.  
  95. >From jwbaxter@olympus.net (John W. Baxter)
  96. Date: Fri, 20 May 1994 23:12:09 -0700
  97. Organization: Internet for the Olympic Peninsula
  98.  
  99. In article <2rjp0k$cqe@crl2.crl.com>, spencerl@crl.com (Spencer Low) wrote:
  100.  
  101. > How do you detect whether 32-bit Addressing is enabled/disabled? Also, 
  102. > how can you turn it on? I remember reading somewhere that there's a bit 
  103. > in PRAM that you can modify. Does anyone have any specifics or sample 
  104. > code (THINK C)? I realize that the Mac would be require to be rebooted, 
  105. > but I would still like an automated way to turn it on (with the 
  106. > authorization of the user).
  107.  
  108. Send a 4 byte -1 through the StripAddress trap, and see what comes out.
  109. -- 
  110. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  111.    jwbaxter@pt.olympus.net
  112.  
  113. +++++++++++++++++++++++++++
  114.  
  115. >From spencerl@crl.com (Spencer Low)
  116. Date: 21 May 1994 00:08:14 -0700
  117. Organization: LowTek Creations
  118.  
  119. John W. Baxter (jwbaxter@olympus.net) wrote:
  120. > Send a 4 byte -1 through the StripAddress trap, and see what comes out.
  121.  
  122. I just tried that and StripAddress returned 0xFFFFFFFF, or -1. What will 
  123. it return in 24-bit mode? 0x00FFFFFF?
  124.  
  125. I think I just answered my own question (well, part of it)... 
  126. GestaltEqu.h tells me that the gestaltAddressingModeAttr selector will 
  127. tell me about the addressing mode of the Mac. Just test for bit 0 
  128. (gestalt32BitAddressing).
  129.  
  130. So how do I turn it on? And I shouldn't turn it on if gestalt32BitCapable 
  131. is false?
  132.  
  133. Thanks,
  134. Spencer
  135. -- 
  136.   Spencer Low       | Creators of MaxRAM!!
  137.   LowTek Creations  | Anonymous FTP to crl.com and look in
  138.   spencerl@crl.com  | /users/ro/spencerl/ for more info.
  139.  
  140. +++++++++++++++++++++++++++
  141.  
  142. >From spencerl@crl.com (Spencer Low)
  143. Date: 21 May 1994 12:47:41 -0700
  144. Organization: LowTek Creations
  145.  
  146. Spencer Low (spencerl@crl.com, aka "me") wrote:
  147. > So how do I turn it on? And I shouldn't turn it on if gestalt32BitCapable 
  148. > is false?
  149.  
  150. I did soom searching on the 'net (the alt.sources.mac archive) and I 
  151. found out some information about extended PRAM (XPRAM) and memory 
  152. settings. I looked at the Extended PRAM Layout from Kiselyov Oleg 
  153. (oleg@ponder.csci.unt.edu) and I copied/composed the following code:
  154.  
  155. (THINK C style with inline assembly)
  156.  
  157. char    buffer;
  158.  
  159. asm {
  160.     LEA    buffer, A0    // pass the address as a parameter
  161.     MOVE.W    #1, D0        // the length of the data
  162.     SWAP    D0
  163.     MOVE.W    #0x8A, D0    // location in XPRAM
  164.     DC.W    0xA051        // ReadXPRam trap
  165. }
  166. BitSet( &buffer, 15 );    // Set xxxx x1x1 (should mean 32-bit on)
  167. BitSet( &buffer, 13 );
  168. asm {
  169.     LEA    buffer, A0    // pass the address as a parameter
  170.     MOVE.W    #1, D0        // the length of the data
  171.     SWAP    D0
  172.     MOVE.W    #0x8A, D0    // location in XPRAM
  173.     DC.W    0xA052        // WriteXPRam trap
  174. }
  175.  
  176. Kiselyov Oleg's info tells us the following:
  177.  
  178. Loc  Length
  179. (hex)  (dec)
  180. 8A      1               Bit field: Memory/cache control flags
  181.            1xxx xxxx    68040 Cache is OFF | Toggled through Cache control
  182.            0xxx xxxx    68040 Cache is ON  | panel
  183.            xxxx x1x1    32-bit addressing is ON (toggled through the Memory
  184.                         control panel)
  185.  
  186. So it seems like my code is setting the right stuff, correct? Does my 
  187. code make sense? I can't test it on my 660AV, since the 660AV doesn't 
  188. support 24-bit mode (or does it?). Also, I noticed that Kiselyov's info 
  189. says 1xxx xxxx means that the cache is off, but on my Mac, my cache is on 
  190. and ReadXPRam returns 1xxx xxxx. Is there a typo or something?
  191.  
  192. Thanks in advance for your help,
  193.  
  194. Spencer
  195. -- 
  196.   Spencer Low       | Creators of MaxRAM!!
  197.   LowTek Creations  | Anonymous FTP to crl.com and look in
  198.   spencerl@crl.com  | /users/ro/spencerl/ for more info.
  199.  
  200. +++++++++++++++++++++++++++
  201.  
  202. >From spencerl@crl.com (Spencer Low)
  203. Date: 21 May 1994 14:00:02 -0700
  204. Organization: LowTek Creations
  205.  
  206. Spencer Low (spencerl@crl.com) wrote:
  207. > BitSet( &buffer, 15 );    // Set xxxx x1x1 (should mean 32-bit on)
  208. > BitSet( &buffer, 13 );
  209.  
  210. Whoops! This code should be BitSet(&buffer, 5); & BitSet(&buffer, 7); 
  211. instead. (this is the first time I've ever used BitSet.)
  212.  
  213. > Kiselyov Oleg's info tells us the following:
  214.  
  215. > Loc  Length
  216. > (hex)  (dec)
  217. > 8A      1               Bit field: Memory/cache control flags
  218. >            1xxx xxxx    68040 Cache is OFF | Toggled through Cache control
  219. >            0xxx xxxx    68040 Cache is ON  | panel
  220. >            xxxx x1x1    32-bit addressing is ON (toggled through the Memory
  221. >                         control panel)
  222.  
  223. > So it seems like my code is setting the right stuff, correct? Does my 
  224. > code make sense? I can't test it on my 660AV, since the 660AV doesn't 
  225. > support 24-bit mode (or does it?). Also, I noticed that Kiselyov's info 
  226. > says 1xxx xxxx means that the cache is off, but on my Mac, my cache is on 
  227. > and ReadXPRam returns 1xxx xxxx. Is there a typo or something?
  228.  
  229. It seems like I was the one making the typo. I checked on my calculator 
  230. (conversions) and ReadXPRam was returning x1xx x1x1, meaning that 32-bit 
  231. addressing was on and the cache was on. I don't know what that second "1" 
  232. means, though. Perhaps it means that 32-bit can't be turned off?
  233.  
  234. Spencer
  235. -- 
  236.   Spencer Low       | Creators of MaxRAM!!
  237.   LowTek Creations  | Anonymous FTP to crl.com and look in
  238.   spencerl@crl.com  | /users/ro/spencerl/ for more info.
  239.  
  240. +++++++++++++++++++++++++++
  241.  
  242. >From jrb@mitre.org (Bob Boonstra)
  243. Date: Sun, 22 May 1994 07:37:29 -0500
  244. Organization: MITRE
  245.  
  246. In article <2rjp0k$cqe@crl2.crl.com>, spencerl@crl.com (Spencer Low) wrote:
  247.  
  248. > How do you detect whether 32-bit Addressing is enabled/disabled? Also, 
  249. > how can you turn it on?
  250.  
  251. mode = GetMMUMode();  /* returns false32b (0) or true32b (1) */
  252. SwapMMUMode(&mode);  /* sets addressing mode and returns old mode */
  253. -- 
  254. -- Bob Boonstra
  255. -- jrb@mitre.org
  256. -- My opinion, not my employer's
  257.  
  258. +++++++++++++++++++++++++++
  259.  
  260. >From spencerl@crl.com (Spencer Low)
  261. Date: 22 May 1994 12:56:20 -0700
  262. Organization: LowTek Creations
  263.  
  264. Bob Boonstra (jrb@mitre.org) wrote:
  265. > In article <2rjp0k$cqe@crl2.crl.com>, spencerl@crl.com (Spencer Low) wrote:
  266.  
  267. > > How do you detect whether 32-bit Addressing is enabled/disabled? Also, 
  268. > > how can you turn it on?
  269.  
  270. > mode = GetMMUMode();  /* returns false32b (0) or true32b (1) */
  271. > SwapMMUMode(&mode);  /* sets addressing mode and returns old mode */
  272.  
  273. Is this the same 32-bit mode that the Memory control panel controls? I 
  274. always thought that this was a different related thing. If there are 
  275. these routines, why do we have to reboot after changing the mode in the 
  276. Memory control panel?
  277.  
  278. Thanks,
  279. Spencer
  280. -- 
  281.   Spencer Low       | Creators of MaxRAM!!
  282.   LowTek Creations  | Anonymous FTP to crl.com and look in
  283.   spencerl@crl.com  | /users/ro/spencerl/ for more info.
  284.  
  285. +++++++++++++++++++++++++++
  286.  
  287. >From jwbaxter@olympus.net (John W. Baxter)
  288. Date: Mon, 23 May 1994 07:47:10 -0700
  289. Organization: Internet for the Olympic Peninsula
  290.  
  291. In article <2rodd4$99s@crl2.crl.com>, spencerl@crl.com (Spencer Low) wrote:
  292.  
  293. > Bob Boonstra (jrb@mitre.org) wrote:
  294. > > In article <2rjp0k$cqe@crl2.crl.com>, spencerl@crl.com (Spencer Low) wrote:
  295. > > > How do you detect whether 32-bit Addressing is enabled/disabled? Also, 
  296. > > > how can you turn it on?
  297. > > mode = GetMMUMode();  /* returns false32b (0) or true32b (1) */
  298. > > SwapMMUMode(&mode);  /* sets addressing mode and returns old mode */
  299. > Is this the same 32-bit mode that the Memory control panel controls? I 
  300. > always thought that this was a different related thing. If there are 
  301. > these routines, why do we have to reboot after changing the mode in the 
  302. > Memory control panel?
  303.  
  304. SwapMMUMode () is intended for *temporary* mode changes (such as the
  305. necessary switch to 32-bit mode to access video memory on typical cards). 
  306. It does not magically change all the heaps in the machine between 24-bit
  307. form and 32-bit form (not to mention that there are now [at least] two
  308. variations of the 32-bit heap).  [So...what you can do during the temporary
  309. switch is quite limited.]
  310.  
  311. -- 
  312. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  313.    jwbaxter@pt.olympus.net
  314.  
  315. +++++++++++++++++++++++++++
  316.  
  317. >From philip@cs.wits.ac.za (Philip Machanick)
  318. Date: Wed, 25 May 1994 07:32:57 +0200
  319. Organization: Computer Science Dept, U of Witwatersrand
  320.  
  321. In article <2rodd4$99s@crl2.crl.com>, spencerl@crl.com (Spencer Low) wrote:
  322.  
  323. > Is this the same 32-bit mode that the Memory control panel controls? I 
  324. > always thought that this was a different related thing. If there are 
  325. > these routines, why do we have to reboot after changing the mode in the 
  326. > Memory control panel?
  327.  
  328. Could it be that there's a difference between locally changing the mode for
  329. a little piece of your code (e.g., check if in 32-bit mode, if so switch it
  330. off for a piece of old code then switch it on again) and globally changing
  331. it for every piece of software on the system?
  332. -- 
  333. Philip Machanick                   philip@cs.wits.ac.za
  334. Department of Computer Science, University of the Witwatersrand
  335. 2050 Wits, South Africa
  336. phone 27(11)716-3309  fax 27(11)339-7965
  337.  
  338. +++++++++++++++++++++++++++
  339.  
  340. >From shirleyd@cognos.COM (Dieter Shirley)
  341. Date: Fri, 27 May 1994 17:27:04 GMT
  342. Organization: Cognos Incorporated, Ottawa CANADA
  343.  
  344. Spencer Low (spencerl@crl.com) wrote:
  345. : Bob Boonstra (jrb@mitre.org) wrote:
  346. : > mode = GetMMUMode();  /* returns false32b (0) or true32b (1) */
  347. : > SwapMMUMode(&mode);  /* sets addressing mode and returns old mode */
  348.  
  349. : Is this the same 32-bit mode that the Memory control panel controls? I 
  350. : always thought that this was a different related thing. If there are 
  351. : these routines, why do we have to reboot after changing the mode in the 
  352. : Memory control panel?
  353.  
  354. All the traps and stuff are initialized at boot up to either work in
  355. 24-bit or 32-bit mode.  If you swap it, you can do writes to upper
  356. (video and NuBus) memory, but if you call any traps during this time,
  357. they'll expect to be in the mode that the computer started in.  If you're
  358. in a different mode, they could crash horrifically.
  359.  
  360. If you need to know if 32-bit addressing is on, use the Gestalt call.
  361. If you need 32-bit addressing on for a *short* time use SwapMMUMode().
  362. If you need 32-bit addressing on for a long time (like, the whole
  363. course of your program) inform the user to turn it on via the control
  364. panel, and then quit.  You could set the bit in PRAM yourself, but
  365. then they'd still have to restart.
  366.  
  367. Good luck,
  368. -dete
  369.  
  370. ---------------------------
  371.  
  372. >From Stephan Bublava <stephan@iguwnext.tuwien.ac.at>
  373. Subject: AppleScript Questions
  374. Date: 14 May 1994 17:45:37 GMT
  375. Organization: Vienna University of Technology
  376.  
  377. Hi, I have two questions regarding AppleScript:
  378.  
  379. 1) Is there any way to allow/disallow user interaction?
  380.  
  381. 2) Can I run a script asynchronously? I am playing around
  382.    with OSA menu and whenever I activate a script the
  383.    front application is blocked until the script is finished.
  384.    I know that "ignoring application responses" works around
  385.    this, but on the other hand, I need application responses
  386.    for some scripts to work, and to get errors back.
  387.    
  388. Any info would be appreciated.
  389.  
  390. Stephan
  391.  
  392. --
  393. Stephan Bublava
  394. stephan@iguwnext.tuwien.ac.at
  395.  
  396. +++++++++++++++++++++++++++
  397.  
  398. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  399. Date: Wed, 25 May 1994 18:38:34 GMT
  400. Organization: Apple Computer
  401.  
  402. Stephan Bublava, stephan@iguwnext.tuwien.ac.at writes:
  403. > 1) Is there any way to allow/disallow user interaction?
  404.  
  405. I seem to remember that there is, but I can't remember the syntax. Check the
  406. manual...
  407.  
  408. > 2) Can I run a script asynchronously? I am playing around
  409. >    with OSA menu and whenever I activate a script the
  410. >    front application is blocked until the script is finished.
  411. >    I know that "ignoring application responses" works around
  412. >    this, but on the other hand, I need application responses
  413. >    for some scripts to work, and to get errors back.
  414.  
  415. If you save a script as an application ("applet") it will run asynchronously
  416. in its own process. If you still want the ease-of-triggering of a menu
  417. command, you can either put the applet in the Apple menu (which will bring
  418. its layer to the front) or write a little launcher script for OSAMenu that
  419. just launches your applet.
  420.  
  421. --Jens Alfke
  422.   jens_alfke@powertalk              Rebel girl, rebel girl,
  423.             .apple.com              Rebel girl you are the queen of my world
  424.  
  425. +++++++++++++++++++++++++++
  426.  
  427. >From Stephan Bublava <stephan@iguwnext.tuwien.ac.at>
  428. Date: 27 May 1994 12:17:14 GMT
  429. Organization: Vienna University of Technology
  430.  
  431. In article <1994May25.183834.6893@gallant.apple.com> Jens Alfke,
  432. jens_alfke@powertalk.apple.com writes:
  433.  
  434. >> 1) Is there any way to allow/disallow user interaction?
  435.  
  436. >I seem to remember that there is, but I can't remember the 
  437. >syntax. Check the manual...
  438.  
  439. Well, that's what I did before posting, but it does not contain
  440. anything (I checked the manual for 1.0, and the release notes
  441. for both 1.0  and 1.1).
  442.  
  443. Thanks for your information on my other question.
  444.  
  445. In the meantime I have yet another problem: I can't get 
  446. transactions to work.
  447.  
  448. For example:
  449.  
  450. tell application "FileMaker Pro"
  451.     with transaction
  452.     ...
  453.     end transaction
  454. end tell
  455.  
  456. The problem is "end transaction" because there also is
  457. a command with the same name. If you only write "end" then
  458. it will compile, but only once because AppleScript changes
  459. the line back to "end transaction".
  460.  
  461. But apart from that, it didn't work right (with FileMaker Pro): 
  462. In the transaction I created a new record and then searched
  463. for a record that did not exist. I expected that the record I 
  464. had created would be automatically deleted again (since the 
  465. search failed), but I just got an error message.
  466.  
  467. Is this one of the many problems FileMaker has with AppleScript,
  468. or am I doing something wrong?
  469.  
  470. Stephan
  471.  
  472. --
  473. Stephan Bublava
  474. stephan@iguwnext.tuwien.ac.at
  475.  
  476. +++++++++++++++++++++++++++
  477.  
  478. >From hades@coos.dartmouth.edu (Brian V. Hughes)
  479. Date: 27 May 1994 15:52:27 GMT
  480. Organization: Dartmouth College, Hanover, NH, USA
  481.  
  482. Stephan Bublava <stephan@iguwnext.tuwien.ac.at> writes:
  483.  
  484. >In the meantime I have yet another problem: I can't get 
  485. >transactions to work.
  486.  
  487. >For example:
  488.  
  489. >tell application "FileMaker Pro"
  490. >    with transaction
  491. >    ...
  492. >    end transaction
  493. >end tell
  494.  
  495. >The problem is "end transaction" because there also is
  496. >a command with the same name. If you only write "end" then
  497. >it will compile, but only once because AppleScript changes
  498. >the line back to "end transaction".
  499.  
  500.     I think what you need to do is use the "Begin Transation" and "End
  501. Transaction" AppleScript commands that are part of FM Pro's
  502. dictionary. I don't know how they differ from the with transaction
  503. control statement but my guess is that AppleEvents were added to FM Pro
  504. before the with transaction control statement was fully implimented, and
  505. therefore it doesn't support it correctly. That's why there are separate
  506. commands for it that are FM Pro specific.
  507.  
  508. -Hades
  509.  
  510. +++++++++++++++++++++++++++
  511.  
  512. >From jonpugh@netcom.com (Jon Pugh)
  513. Date: Sun, 29 May 1994 06:36:13 GMT
  514. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  515.  
  516. Jens Alfke (jens_alfke@powertalk.apple.com) wrote:
  517. > Stephan Bublava, stephan@iguwnext.tuwien.ac.at writes:
  518. > > 1) Is there any way to allow/disallow user interaction?
  519.  
  520. > I seem to remember that there is, but I can't remember the syntax. Check the
  521. > manual...
  522.  
  523. There are no user interaction events or settings in AppleScript.  That's
  524. why programs will need to implement something similar to what I did in 
  525. PhotoFlash.  I created an application property called "user iteraction" 
  526. which takes a set of enums; none, interact with local, interact with remote, 
  527. & interact with all.  Then before you put up any dialog, call a CanDoUI
  528. routine which checks the UI level and calls AEInteractWithUser if it is not
  529. none (since the AEM doesn't include a none setting).  This ensures that you
  530. get brought to the front and/or a notification is posted.  You need to 
  531. implement none because the AEM's minimum is "interact with local" and if you
  532. run a script (via a script menu or so) your script is local and allowed to
  533. interact.  Yuck.  You need to use a global to get the never interact level 
  534. and you need to provide defaults for every function that calls CanDoUI and
  535. gets back a false.
  536.  
  537. I would suggest that a future version of AppleScript and the AEM support 
  538. this feature, if there anyone working on either.  ;)
  539.  
  540. Jon
  541.  
  542.  
  543. +++++++++++++++++++++++++++
  544.  
  545. >From jwbaxter@olympus.net (John W. Baxter)
  546. Date: Sun, 29 May 1994 08:25:58 -0700
  547. Organization: Internet for the Olympic Peninsula
  548.  
  549. In article <jonpughCqJx0D.IE3@netcom.com>, jonpugh@netcom.com (Jon Pugh)
  550. wrote:
  551.  
  552. > There are no user interaction events or settings in AppleScript.  That's
  553. > why programs will need to implement something similar to what I did in 
  554. > PhotoFlash.  I created an application property called "user iteraction" 
  555. > which takes a set of enums; none, interact with local, interact with remote, 
  556. > & interact with all.  Then before you put up any dialog, call a CanDoUI
  557. > routine which checks the UI level and calls AEInteractWithUser if it is not
  558. > none (since the AEM doesn't include a none setting).  This ensures that you
  559. > get brought to the front and/or a notification is posted.  You need to 
  560. > implement none because the AEM's minimum is "interact with local" and if you
  561. > run a script (via a script menu or so) your script is local and allowed to
  562. > interact.  Yuck.  You need to use a global to get the never interact level 
  563. > and you need to provide defaults for every function that calls CanDoUI and
  564. > gets back a false.
  565.  
  566. Jon...The AE Manager is quite happy with "never interact" as sent by the
  567. sender.  It is of course true that the client side's minimum level for
  568. AESetInteractionAllowed () is self (which I think I consider "lower" than
  569. local, since it cuts out other clients).  So you are right that to achieve
  570. never, the application has to remember that it shouldn't interact.
  571.  
  572. > I would suggest that a future version of AppleScript and the AEM support 
  573. > this feature, if there anyone working on either.  ;)
  574.  
  575. I found it surprising that AppleScript elected to use only "can" interact. 
  576. Frontier, on the other hand, can currently be set to send either "never" or
  577. "always" (version 2 was "never" or "can"...the change to "always" has
  578. caused some scripting glitches with FileMaker, which now must be brought to
  579. the front before certain actions are sent from Frontier).
  580.  
  581. So an OSA Menu script which needs to be never interact could be written in
  582. UserTalk, with the level being set to never [the UserTalk for that is
  583. setEventInteraction (false)...the setting is per-script].
  584.  
  585. I concur that AppleScript should be enhanced to permit per-script settings
  586. of "never", "can", and "always" (and control might be desired for the
  587. kAECanSwitchLayer flag, too).
  588.  
  589. Good job with your PhotoFlash workaround...I'll have to remember to
  590. implement (ie, steal) that idea.
  591. -- 
  592. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  593.    jwbaxter@pt.olympus.net
  594.  
  595. ---------------------------
  596.  
  597. >From eshieh@po.EECS.Berkeley.EDU (Eric Shieh)
  598. Subject: Code Warrior allocation of Objects
  599. Date: 22 May 1994 20:54:17 GMT
  600. Organization: University of California, Berkeley
  601.  
  602. Just received CW Gold DR/2 2 weeks ago and have ported my program
  603. from Think C 5.0 to it...seems to work great except that the CW 
  604. compiler is a lot pickier about types...anyways, that's OK.
  605.  
  606. The bulk of my program is in standard C.  Now, I'm trying to add some
  607. stuff using C++. The problem: once I allocate an object via 'new' (i haven't
  608. tryied allocating it on the stack), about 80K is allocated in the heap...
  609. Now, this may be OK in a 2-3 meg program, but since my program's total
  610. file size is 68K in a 120K partition, 80K is a big deal...
  611.  
  612. Oh, and if I call delete, the 80K remains in the heap, non-relocatable. but
  613. calling new again doesn't try to allocate another 80K....
  614.  
  615. So, my question is: Is this just the way it works or is this a bug? It seems
  616. rather odd that it's allocating so much memory since as I said, my
  617. program size is 68K, what could it be sticking in that 80K block? 
  618.  
  619. Oh, btw, is their any way to create objects as Handles instead of Pointers?
  620.  
  621. And I also recall a codewarrior mailing list around here, anyone know the
  622. address/instructions?
  623.  
  624. Thanks for listening,
  625. Eric
  626.  
  627. eshieh@cory.berkeley.edu
  628.  
  629.  
  630. +++++++++++++++++++++++++++
  631.  
  632. >From scouten@maroon.tc.umn.edu (Eric Scouten)
  633. Date: Mon, 23 May 1994 13:31:56 GMT
  634. Organization: University of Minnesota, Student Affairs
  635.  
  636. In article <2rogpp$3j1@agate.berkeley.edu>, eshieh@po.EECS.Berkeley.EDU
  637. (Eric Shieh) wrote:
  638.  
  639. > The bulk of my program is in standard C.  Now, I'm trying to add some
  640. > stuff using C++. The problem: once I allocate an object via 'new' (i haven't
  641. > tryied allocating it on the stack), about 80K is allocated in the heap...
  642.  
  643. CodeWarrior's operator new bypasses the Memory Manager when allocating
  644. small objects. It allocates its own pool of (apparently) 80K for any
  645. objects that are below a certain threshold size (4K I think?). This pool
  646. remains permanently allocated until the app quits; if it fills, CW grabs
  647. another 80K pool to create the next set of objects.
  648.  
  649. The advantage of this is that the operator new/delete pair can manage
  650. objects more efficiently (both in memory and speed) than can the Memory
  651. Manager.
  652.  
  653.  
  654. > Oh, btw, is their any way to create objects as Handles instead of Pointers?
  655.  
  656. Not in any compiler that supports multiple inheritance. (At least SC++ 7.0
  657. and CodeWarrior don't support handle objects.) Handles are an ugly way to
  658. manage objects anyway: accessing member fields is considerably less
  659. efficient, and you have to be much more careful about how you use pointers.
  660.  
  661.  
  662. > And I also recall a codewarrior mailing list around here, anyone know the
  663. > address/instructions?
  664.  
  665. Yup. To subscribe send a one line message...
  666.  
  667.    subscribe cwarrior <Your name in real life, not e-mail address>
  668.  
  669. ... to the address listserv@netcom.com. Make sure your signature is turned
  670. off.
  671.  
  672. -Eric
  673.  
  674.  
  675. -- 
  676. Eric Scouten  *  Univ of Minnesota  *  Student Affairs  *  +1 612 626 0746
  677.   ** MS Computer Science student, Univ of Illinois, starting Aug '94 **
  678.  
  679. WYSIWIG: What You See Is What You Get
  680.  
  681. WYSIWOBBLE: What You See Isn't What's Output By the Blasted Laserwriter Eh?
  682.  
  683. +++++++++++++++++++++++++++
  684.  
  685. >From partingt@fwi.uva.nl (Vincent Partington)
  686. Date: 24 May 1994 11:58:59 GMT
  687. Organization: FWI, University of Amsterdam
  688.  
  689. eshieh@po.EECS.Berkeley.EDU (Eric Shieh) writes:
  690.  
  691. >The bulk of my program is in standard C.  Now, I'm trying to add some
  692. >stuff using C++. The problem: once I allocate an object via 'new' (i haven't
  693. >tryied allocating it on the stack), about 80K is allocated in the heap...
  694. >Now, this may be OK in a 2-3 meg program, but since my program's total
  695. >file size is 68K in a 120K partition, 80K is a big deal...
  696.  
  697. This is because new and delete use their own allocator system that gets
  698. chunks of OS-memory at once to efficiently manage memory.
  699. You can bypass this be recompiling the C++ Runtime library: the source-
  700. code for new/delete is in the C++ Runtime directory, there's a define that
  701. you can change to make new/delete use NewPtr/DisposePtr, just have
  702. a look at the code in the New.cp and NewMore.cp files.
  703.  
  704. Vincent.
  705. -- 
  706. My opinions are not my own. I copy them    | Internet : partingt@fwi.uva.nl
  707. from books, television, video, the net,    |            vincent@tnc.nl
  708. my friends, my parents, my teachers and    | FidoNet  : 2:281/202.15
  709. and numerous other contributors.           | NeST     : 90:500/202.15
  710.  
  711. +++++++++++++++++++++++++++
  712.  
  713. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  714. Date: Wed, 25 May 1994 19:15:42 GMT
  715. Organization: Apple Computer
  716.  
  717. In article <2rsq63$h0k@hermes.fwi.uva.nl> Vincent Partington,
  718. partingt@fwi.uva.nl writes:
  719. > This is because new and delete use their own allocator system that gets
  720. > chunks of OS-memory at once to efficiently manage memory.
  721. > You can bypass this be recompiling the C++ Runtime library...
  722.  
  723. Naw, just add an 'operator new' and 'operator delete' in the base class and
  724. have it use some other allocation scheme. NewPtr will work okay but will be
  725. lots slower if tons of objects are being created and deleted. If the program
  726. is already using some more efficient memory allocator (malloc or something)
  727. then you can use that.
  728.  
  729. --Jens Alfke
  730.   jens_alfke@powertalk              Rebel girl, rebel girl,
  731.             .apple.com              Rebel girl you are the queen of my world
  732.  
  733. +++++++++++++++++++++++++++
  734.  
  735. >From partingt@fwi.uva.nl (Vincent Partington)
  736. Date: 26 May 1994 10:47:10 GMT
  737. Organization: FWI, University of Amsterdam
  738.  
  739. Jens Alfke <jens_alfke@powertalk.apple.com> writes:
  740.  
  741. >> This is because new and delete use their own allocator system that gets
  742. >> chunks of OS-memory at once to efficiently manage memory.
  743. >> You can bypass this be recompiling the C++ Runtime library...
  744.  
  745. >Naw, just add an 'operator new' and 'operator delete' in the base class and
  746. >have it use some other allocation scheme. NewPtr will work okay but will be
  747. >lots slower if tons of objects are being created and deleted. If the program
  748. >is already using some more efficient memory allocator (malloc or something)
  749. >then you can use that.
  750.  
  751. When adding those operators to "the" base class you have to change your C++
  752. code and derive all your classes from that class. Changing the C++ Runtime lib
  753. is admittedly dirtier but doesn't require changing the C++ code.
  754. Changing the C++ Runtime lib also allows you to change the allocation routines
  755. for arrays becuase AFAIK you can't change operator new/delete for arrays.
  756.  
  757. Vincent\n
  758. -- 
  759. My opinions are not my own. I copy them    | Internet : partingt@fwi.uva.nl
  760. from books, television, video, the net,    |            vincent@tnc.nl
  761. my friends, my parents, my teachers and    | FidoNet  : 2:281/202.15
  762. and numerous other contributors.           | NeST     : 90:500/202.15
  763.  
  764. +++++++++++++++++++++++++++
  765.  
  766. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  767. Date: Fri, 27 May 1994 20:04:20 GMT
  768. Organization: Apple Computer
  769.  
  770. Vincent Partington, partingt@fwi.uva.nl writes:
  771. > When adding those operators to "the" base class you have to change your C++
  772. > code and derive all your classes from that class. Changing the C++ Runtime
  773. lib
  774. > is admittedly dirtier but doesn't require changing the C++ code.
  775.  
  776. That's a fair point; but you can always just define your own global operator
  777. new and operator delete, and then include the C++ runtime library without its
  778. operator new support. (I think there is a version of the library without
  779. operator new in it.) All of your classes will use the global operator
  780. new/delete by default.
  781.  
  782. I'm always leery of modifying system libraries, since they generally change
  783. in every release and then I have to redo my work all over again.
  784.  
  785. --Jens Alfke
  786.   jens_alfke@powertalk              Rebel girl, rebel girl,
  787.             .apple.com              Rebel girl you are the queen of my world
  788.  
  789. ---------------------------
  790.  
  791. >From amanda@intercon.com (Amanda Walker)
  792. Subject: Code Warrior: ruminations of a long-time MPW user
  793. Date: Tue, 24 May 1994 11:47:08 -0500
  794. Organization: InterCon Systems Corporation, Herndon, VA USA
  795.  
  796. Several people have expressed surprise at my couple of posts supporting Code 
  797. Warrior yesterday, since I've been a die-hard MPW user for years.  I thought
  798. I'd go into some more detail on this, since the issues involved are not unique 
  799. to me alone.
  800.  
  801. I've been using MPW since version 2.  I've also used just about every other C 
  802. compiler to come out for the Mac, from the Megamax C and Consulair C to THINK 
  803. C 7.0.  All of these systems have their good points and their bad points.  
  804. However, for multi-project multi-person development, MPW has held the lead.  
  805. It is no speed demon in terms of lines per minute compiled, but it is 
  806. extremely flexible.  The abilities to script the environment, provide multi-
  807. user source code and revision control, and add custom tools serve to make up 
  808. in the long term for a lack of compilation speed.  Also, Apple generally 
  809. releases new technology via MPW header files and/or libraries, which can be 
  810. especially important when dealing with pre-release versions of Apple software 
  811. (as I have been a number of times).  All of these things have kept me in the 
  812. MPW camp for the kind of work I do most.  Symantec C 6.0 looked promising, 
  813. since it was finally scriptable, but the bugs in it and the general manner in 
  814. which Symantec has handled 6.x and 7.0 have undermined my faith in their 
  815. ability to deliver a quality product, despite having used it off and on since 
  816. it was called "Lightspeed C".
  817.  
  818. I'd seen a preview of Code Warrior in December at one of Apple's "PowerPC 
  819. Coding Kitchens" which they ran for developers in the seeding program.  It 
  820. looked promising, but it was still kind of buggy, and was not scriptable.  The 
  821. person doing the demo characterized it as analogous to THINK C 5.x for the 
  822. PowerPC.  As a result, I sighed and went back to the Apple RISC SDK, which I 
  823. fought with for some time before finally getting a build that I felt 
  824. comfortable saying we could ship to customers.  However, by this time I was 
  825. getting aggravated at MPW as well.  The PowerPC C compilers and linker in 
  826. Apple's SDK are excruciatingly slow, and the optimizer breaks.  TCP/Connect II 
  827. 1.2.1 is built with optimization off to avoid compiler bus errors and bad code 
  828. generation.  It also doesn't run native, making the 8100/80 on my desk almost
  829. usefuless for anything but testing.
  830.  
  831. It has not been a fun spring in some respects.
  832.  
  833. By the WWDC, Code Warrior had started to get rave reviews, both here and from 
  834. other developers whose opinions I have learned to respect, so I went with an 
  835. open mind.  After watching the Metrowerks presentation, and sitting down with 
  836. Code Warrior myself, I became convinced that they really did know what they 
  837. were doing.  It was fast, native, and had an optimizer that seems to actually
  838. work.  It's scriptable, so that I can do a large multi-project build without 
  839. having to hand-drive the process.  It coexists nicely with SourceServer, so 
  840. that I can continue to use existing source code databases.  It's code 
  841. generator isn't a mangled version of an 8x86 code generator, so it actually 
  842. generates nice code.  I don't have to hook my PowerBook up to my Power Mac 
  843. just to run the debugger.  It's not perfect, but it finally tipped the scale 
  844. compared to MPW.  MPW tool versions of the compilers and linkers, which 
  845. Metrowerks says are in the pipeline, will be the final clincher, since they 
  846. will give me the best of both worlds.
  847.  
  848. Besides, Metrowerks seems to be as much a bunch of crazy workaholics as
  849. InterCon is :).
  850.  
  851.  
  852. Amanda Walker
  853. Advanced Projects
  854. InterCon Systems Corporation
  855.  
  856.  
  857.  
  858. +++++++++++++++++++++++++++
  859.  
  860. >From mikel@intercon.com (Michael W. Wellman)
  861. Date: Tue, 24 May 1994 14:30:57 -0500
  862. Organization: InterCon Systems Corp., Herndon, VA, USA
  863.  
  864. amanda@intercon.com (Amanda Walker) writes:
  865. > However, by this time I was getting aggravated at MPW as well.  
  866. > The PowerPC C compilers and linker in Apple's SDK are excruciatingly 
  867. > slow, and the optimizer breaks.  TCP/Connect II 1.2.1 is built with 
  868. > optimization off to avoid compiler bus errors and bad code generation.  
  869. > It also doesn't run native, making the 8100/80 on my desk almost 
  870. > usefuless for anything but testing. 
  871.  
  872. Er, I'd just like to make it clear that the "It" above refers to MPW and not 
  873. TCP/Connect II 1.2.1.  The latter works quite nicely natively...
  874.  
  875. Now if only Metrowerks and Apple's Open Transport would work out their 
  876. differences regards Apple's Shared Library Manager.
  877.  
  878. mikel
  879.  
  880.  
  881.  
  882.  
  883.  
  884. +++++++++++++++++++++++++++
  885.  
  886. >From peirce@outpost.SF-Bay.org (Michael Peirce)
  887. Date: Tue, 24 May 94 14:30:05 PST
  888. Organization: Peirce Software, Inc.
  889.  
  890.  
  891. In article <9405241430.AA57204@mikel.intercon.com> (comp.sys.mac.programmer), mikel@intercon.com (Michael W. Wellman) writes:
  892. > amanda@intercon.com (Amanda Walker) writes:
  893. > > However, by this time I was getting aggravated at MPW as well.  
  894. > > The PowerPC C compilers and linker in Apple's SDK are excruciatingly 
  895. > > slow, and the optimizer breaks.  TCP/Connect II 1.2.1 is built with 
  896. > > optimization off to avoid compiler bus errors and bad code generation.  
  897. > > It also doesn't run native, making the 8100/80 on my desk almost 
  898. > > usefuless for anything but testing. 
  899. > Er, I'd just like to make it clear that the "It" above refers to MPW and not 
  900. > TCP/Connect II 1.2.1.  The latter works quite nicely natively...
  901.  
  902. The "prerelease MPW" version 3.4a2 from E.T.O. 14 has some native
  903. parts in it now.
  904.  
  905. The shell is native, as is make, rez, derez, and rezdet.  Too bad
  906. Link and C aren't native, but the native shell (and my faster hard
  907. disk) make for a quicker startup.  And the Make doesn't take any time
  908. anymore either.
  909.  
  910. It's only a start, but at least its better than nothing.
  911.  
  912. (I'm very much looking forward to trying the CodeWarrior compiler
  913. and linker under MPW!)
  914.  
  915. __ Michael Peirce        __ peirce@outpost.sf-bay.org
  916. __ Peirce Software, Inc. __ 719 Hibiscus Place, Suite 301
  917. __                       __ San Jose, California USA 95117-1844
  918. __ Makers of: Smoothie & __ voice: +1.408.244.6554 fax: +1.408.244.6882
  919. __    Peirce Print Tools __ AppleLink: peirce & AOL: AFC Peirce
  920.  
  921. +++++++++++++++++++++++++++
  922.  
  923. >From songer@ovation.lexmark.com (Christopher Songer)
  924. Date: Wed, 25 May 1994 13:50:40 GMT
  925. Organization: Lexmark International, Lexington, KY
  926.  
  927. In article <9405241147.AA08906@fusion.intercon.com> amanda@intercon.com (Amanda Walker) writes:
  928.  
  929.    [...]
  930.    By the WWDC, Code Warrior had started to get rave reviews, both here and from 
  931.    other developers whose opinions I have learned to respect, so I went with an 
  932.    open mind.  
  933.    [...]
  934.  
  935. Hi!
  936.  
  937.      Thanks for the review -- it is much appreciated and was quite
  938. informative. Can you speak to the source control management provided
  939. by the CodeWarrior package? 
  940.  
  941. Thanks!
  942. -Chris
  943. songer@lexmark.com
  944.  
  945. +++++++++++++++++++++++++++
  946.  
  947. >From amanda@intercon.com (Amanda Walker)
  948. Date: Wed, 25 May 1994 17:35:41 -0400
  949. Organization: InterCon Systems Corporation, Herndon, VA USA
  950.  
  951. mikel@intercon.com (Michael W. Wellman) writes:
  952. > Er, I'd just like to make it clear that the "It" above refers to MPW 
  953. > and not TCP/Connect II 1.2.1.  The latter works quite nicely natively... 
  954.  
  955. Yes, indeed.  I used it to post that article, in fact :).
  956.  
  957.  
  958. Amanda Walker
  959. InterCon Systems Corporation
  960.  
  961.  
  962.  
  963. +++++++++++++++++++++++++++
  964.  
  965. >From jpurlia@qualcomm.com (John Purlia)
  966. Date: Thu, 26 May 1994 13:17:22 -0800
  967. Organization: Qualcomm, Inc.
  968.  
  969. In article <9405241147.AA08906@fusion.intercon.com> amanda@intercon.com
  970. (Amanda Walker) writes:
  971. >[...]
  972. >By the WWDC, Code Warrior had started to get rave reviews, both here and from 
  973. >other developers whose opinions I have learned to respect, so I went with an 
  974. >open mind.  
  975. >[...]
  976.  
  977. Yes, a very large number of Apple engineers are using and raving about Code
  978. Warrior which is encouraging when evaluating the stability and usefulness
  979. of a new development environment.  I'd very much prefer to use the power
  980. available to me through the MPW environment so I'm eagerly awaiting the
  981. release of native MPW tools from MetroWerks -- especially after talking to
  982. a couple of people at the MPW station at the conference expo who
  983. regrettably informed me that there are no plans for porting a 68K compiler
  984. to run native on PPC, which means... writing fat binaries will require you
  985. to compile the 68K portion of your app with an emulated compiler!  AARGH!!!
  986. ...........................................................................
  987. John Purlia          : My brain; not my company's brain.  My brain says...
  988. jpurlia@qualcomm.com :
  989. Applelink    AM0470  :   "Newton could never live on Via de la Valle,
  990. NewtonMail:  JPurlia :  but it would be right at home on Cruel Lucille"
  991.  
  992. +++++++++++++++++++++++++++
  993.  
  994. >From amanda@intercon.com (Amanda Walker)
  995. Date: Fri, 27 May 1994 12:27:38 -0500
  996. Organization: InterCon Systems Corporation, Herndon, VA USA
  997.  
  998. songer@ovation.lexmark.com (Christopher Songer) writes:
  999. > Thanks for the review -- it is much appreciated and was quite 
  1000. > informative. Can you speak to the source control management provided 
  1001. > by the CodeWarrior package? 
  1002.  
  1003. Currently, it is Projector-aware, so we're continuing to use SourceServer from 
  1004. MPW.  Code Warrior does not have its own source code control system.
  1005.  
  1006.  
  1007. Amanda Walker
  1008. InterCon Systems Corporation
  1009.  
  1010.  
  1011.  
  1012. ---------------------------
  1013.  
  1014. >From nathan@cse.ucsc.edu (Nathan J. Wilson)
  1015. Subject: Refinement of SC++ 7.0 code gen bug
  1016. Date: 27 May 1994 06:34:38 GMT
  1017. Organization: UC Santa Cruz CIS/CE
  1018.  
  1019. First, I must say that I have been pleased with the response to my
  1020. original posting (Thanks Tom and Phil!).  I managed to reduce the
  1021. bug to a small stand alone example.  I have already send this to
  1022. Symantec directly, but I thought I should post it here so other's
  1023. could know what to watch out for until a fix is available.  The
  1024. causes appears to be with assign in the results of virtual
  1025. member function that returns a double directly to a member of
  1026. another class (or struct) within a loop.  The effect is that some
  1027. unpreserved registers get trashed resulting in garbage.  Work around
  1028. is to assign the result to a temporary.
  1029.  
  1030. -Nathan
  1031.  
  1032. // main.cpp
  1033.  
  1034. // Demonstration of a code generation bug in Symantec C++ 7.0
  1035. // Output should be:
  1036. // 12.34 == <garbage float>
  1037. //
  1038. // If you set BUG to 0 then you get the correct output which should be
  1039. // 12.34 == 12.34
  1040. //
  1041.  
  1042. #define BUG 1
  1043.  
  1044. #include <stdio.h>
  1045.  
  1046. #define THE_TYPE double // Must be double, float works fine
  1047.  
  1048. class FeatureNum {
  1049. public:
  1050.   THE_TYPE num; // Destination must be a member of a class or struct
  1051. };
  1052.  
  1053. class Foo {
  1054. public:
  1055.   virtual THE_TYPE Eval() { return 12.34; }; // Function must be a virtual member function
  1056. };
  1057.  
  1058. int main()
  1059. {
  1060.   Foo *foo = new Foo(); // Must be pointer to an object.  Can't use Foo foo;
  1061.   FeatureNum table2[1];
  1062.   long i = 0;
  1063.   while (i < 1) { // Must have loop
  1064. #if BUG
  1065.       table2[i].num = foo->Eval(); // Obviously, assignment must be direct
  1066. #else
  1067.       THE_TYPE tmp = foo->Eval();
  1068.       table2[i].num = tmp;
  1069. #endif
  1070.       printf("%lg == %lg\n", foo->Eval(), table2[i].num);
  1071.       i++;
  1072.   }
  1073.   delete foo;
  1074.   return 0;
  1075. }
  1076.  
  1077. #ifdef NEVER
  1078.  
  1079. Here is the disassembled buggy code:
  1080.  
  1081. main:
  1082. 00000000: 4E56 FFDC          LINK      A6,#$FFDC
  1083. 00000004: 48E7 1838          MOVEM.L   D3/D4/A2-A4,-(A7)
  1084. 00000008: 7004               MOVEQ     #$04,D0
  1085. 0000000A: 2F00               MOVE.L    D0,-(A7)
  1086. 0000000C: 4EBA 0000          JSR       operator new(unsigned int)
  1087. 00000010: 2840               MOVEA.L   D0,A4
  1088. 00000012: 4A80               TST.L     D0
  1089. 00000014: 670C               BEQ.S     *+$000E        ; 00000022
  1090. 00000016: 2D40 FFE8          MOVE.L    D0,$FFE8(A6)
  1091. 0000001A: 41ED 0000          LEA       Foo::_vtbl,A0
  1092. 0000001E: 2240               MOVEA.L   D0,A1
  1093. 00000020: 2288               MOVE.L    A0,(A1)
  1094. 00000022: 200C               MOVE.L    A4,D0
  1095. 00000024: 2640               MOVEA.L   D0,A3
  1096. 00000026: 7000               MOVEQ     #$00,D0
  1097. 00000028: 2800               MOVE.L    D0,D4
  1098. 0000002A: 0C84 0000 0001     CMPI.L    #$00000001,D4
  1099. 00000030: 6C00 0096          BGE       *+$0098        ; 000000C8
  1100. 00000034: 2F0B               MOVE.L    A3,-(A7)
  1101. 00000036: 204B               MOVEA.L   A3,A0
  1102. 00000038: 2250               MOVEA.L   (A0),A1
  1103. 0000003A: 2251               MOVEA.L   (A1),A1
  1104. 0000003C: 4E91               JSR       (A1)
  1105. 0000003E: 2604               MOVE.L    D4,D3
  1106. 00000040: 2003               MOVE.L    D3,D0
  1107. 00000042: C6FC 000A          MULU.W    #$000A,D3
  1108. 00000046: 4840               SWAP      D0
  1109. 00000048: C0FC 000A          MULU.W    #$000A,D0
  1110. 0000004C: 4840               SWAP      D0
  1111. 0000004E: 4240               CLR.W     D0
  1112. 00000050: D680               ADD.L     D0,D3
  1113. 00000052: 45EE FFDC          LEA       $FFDC(A6),A2
  1114. 00000056: 3580 3000          MOVE.W    D0,$00(A2,D3.W)
  1115. 0000005A: 2581 3002          MOVE.L    D1,$02(A2,D3.W)
  1116. 0000005E: 2588 3006          MOVE.L    A0,$06(A2,D3.W)
  1117. 00000062: 2004               MOVE.L    D4,D0
  1118. 00000064: 2200               MOVE.L    D0,D1
  1119. 00000066: C0FC 000A          MULU.W    #$000A,D0
  1120. 0000006A: 4841               SWAP      D1
  1121. 0000006C: C2FC 000A          MULU.W    #$000A,D1
  1122. 00000070: 4841               SWAP      D1
  1123. 00000072: 4241               CLR.W     D1
  1124. 00000074: D081               ADD.L     D1,D0
  1125. 00000076: 2D72 0000 FFF6     MOVE.L    $00(A2,D0.W),$FFF6(A6)
  1126. 0000007C: 2D72 0004 FFFA     MOVE.L    $04(A2,D0.W),$FFFA(A6)
  1127. 00000082: 3D72 0008 FFFE     MOVE.W    $08(A2,D0.W),$FFFE(A6)
  1128. 00000088: 2F2E FFFC          MOVE.L    $FFFC(A6),-(A7)
  1129. 0000008C: 2F2E FFF8          MOVE.L    $FFF8(A6),-(A7)
  1130. 00000090: 3F2E FFF6          MOVE.W    $FFF6(A6),-(A7)
  1131. 00000094: 2F0B               MOVE.L    A3,-(A7)
  1132. 00000096: 204B               MOVEA.L   A3,A0
  1133. 00000098: 2050               MOVEA.L   (A0),A0
  1134. 0000009A: 2050               MOVEA.L   (A0),A0
  1135. 0000009C: 4E90               JSR       (A0)
  1136. 0000009E: 3D40 FFEC          MOVE.W    D0,$FFEC(A6)
  1137. 000000A2: 2D41 FFEE          MOVE.L    D1,$FFEE(A6)
  1138. 000000A6: 2D48 FFF2          MOVE.L    A0,$FFF2(A6)
  1139. 000000AA: 2F2E FFF2          MOVE.L    $FFF2(A6),-(A7)
  1140. 000000AE: 2F2E FFEE          MOVE.L    $FFEE(A6),-(A7)
  1141. 000000B2: 3F2E FFEC          MOVE.W    $FFEC(A6),-(A7)
  1142. 000000B6: 486D 0000          PEA       $0000(A5)
  1143. 000000BA: 4EBA 0000          JSR       printf
  1144. 000000BE: 4FEF 0018          LEA       $0018(A7),A7
  1145. 000000C2: 5284               ADDQ.L    #$1,D4
  1146. 000000C4: 6000 FF64          BRA       *-$009A        ; 0000002A
  1147. 000000C8: 2F0B               MOVE.L    A3,-(A7)
  1148. 000000CA: 4EBA 0000          JSR       operator delete(void *)
  1149. 000000CE: 7000               MOVEQ     #$00,D0
  1150. 000000D0: 4CDF 1C18          MOVEM.L   (A7)+,D3/D4/A2-A4
  1151. 000000D4: 4E5E               UNLK      A6
  1152. 000000D6: 4E75               RTS
  1153. 000000D8
  1154.  
  1155. Foo::Eval(void):
  1156. 00000000: 4E56 FFF4          LINK      A6,#$FFF4
  1157. 00000004: 2D7C 4002 C570     MOVE.L    #$4002C570,$FFF6(A6)
  1158.           FFF6           
  1159. 0000000C: 2D7C A3D7 0A3D     MOVE.L    #$A3D70A3D,$FFFA(A6)
  1160.           FFFA           
  1161. 00000014: 3D7C 7000 FFFE     MOVE.W    #$7000,$FFFE(A6)
  1162. 0000001A: 302E FFF6          MOVE.W    $FFF6(A6),D0
  1163. 0000001E: 222E FFF8          MOVE.L    $FFF8(A6),D1
  1164. 00000022: 206E FFFC          MOVEA.L   $FFFC(A6),A0
  1165. 00000026: 4E5E               UNLK      A6
  1166. 00000028: 225F               MOVEA.L   (A7)+,A1
  1167. 0000002A: 584F               ADDQ.W    #$4,A7
  1168. 0000002C: 4ED1               JMP       (A1)
  1169. 0000002E
  1170.  
  1171. Here is the disassembled non-buggy code.  Changes are commented:
  1172.  
  1173. main:
  1174. 00000000: 4E56 FFD0          LINK      A6,#$FFD0
  1175. 00000004: 48E7 1838          MOVEM.L   D3/D4/A2-A4,-(A7)
  1176. 00000008: 7004               MOVEQ     #$04,D0
  1177. 0000000A: 2F00               MOVE.L    D0,-(A7)
  1178. 0000000C: 4EBA 0000          JSR       operator new(unsigned int)
  1179. 00000010: 2840               MOVEA.L   D0,A4
  1180. 00000012: 4A80               TST.L     D0
  1181. 00000014: 670C               BEQ.S     *+$000E        ; 00000022
  1182. 00000016: 2D40 FFE8          MOVE.L    D0,$FFE8(A6)
  1183. 0000001A: 41ED 0000          LEA       Foo::_vtbl,A0
  1184. 0000001E: 2240               MOVEA.L   D0,A1
  1185. 00000020: 2288               MOVE.L    A0,(A1)
  1186. 00000022: 200C               MOVE.L    A4,D0
  1187. 00000024: 2640               MOVEA.L   D0,A3
  1188. 00000026: 7000               MOVEQ     #$00,D0
  1189. 00000028: 2800               MOVE.L    D0,D4
  1190. 0000002A: 0C84 0000 0001     CMPI.L    #$00000001,D4
  1191. 00000030: 6C00 00A8          BGE       *+$00AA        ; 000000DA
  1192. 00000034: 2F0B               MOVE.L    A3,-(A7)
  1193. 00000036: 204B               MOVEA.L   A3,A0
  1194. 00000038: 2250               MOVEA.L   (A0),A1
  1195. 0000003A: 2251               MOVEA.L   (A1),A1
  1196. 0000003C: 4E91               JSR       (A1)
  1197. 0000003E: 3D40 FFDC          MOVE.W    D0,$FFDC(A6) ; Added
  1198. 00000042: 2D41 FFDE          MOVE.L    D1,$FFDE(A6) ; Added
  1199. 00000046: 2D48 FFE2          MOVE.L    A0,$FFE2(A6) ; Added
  1200. 0000004A: 2604               MOVE.L    D4,D3
  1201. 0000004C: 2003               MOVE.L    D3,D0
  1202. 0000004E: C6FC 000A          MULU.W    #$000A,D3
  1203. 00000052: 4840               SWAP      D0
  1204. 00000054: C0FC 000A          MULU.W    #$000A,D0
  1205. 00000058: 4840               SWAP      D0
  1206. 0000005A: 4240               CLR.W     D0
  1207. 0000005C: D680               ADD.L     D0,D3
  1208. 0000005E: 45EE FFD0          LEA       $FFD0(A6),A2
  1209. 00000062: 25AE FFDC 3000     MOVE.L    $FFDC(A6),$00(A2,D3.W) ; Change
  1210. 00000068: 25AE FFE0 3004     MOVE.L    $FFE0(A6),$04(A2,D3.W) ; Change
  1211. 0000006E: 35AE FFE4 3008     MOVE.W    $FFE4(A6),$08(A2,D3.W) ; Change
  1212. 00000074: 2004               MOVE.L    D4,D0
  1213. 00000076: 2200               MOVE.L    D0,D1
  1214. 00000078: C0FC 000A          MULU.W    #$000A,D0
  1215. 0000007C: 4841               SWAP      D1
  1216. 0000007E: C2FC 000A          MULU.W    #$000A,D1
  1217. 00000082: 4841               SWAP      D1
  1218. 00000084: 4241               CLR.W     D1
  1219. 00000086: D081               ADD.L     D1,D0
  1220. 00000088: 2D72 0000 FFF6     MOVE.L    $00(A2,D0.W),$FFF6(A6)
  1221. 0000008E: 2D72 0004 FFFA     MOVE.L    $04(A2,D0.W),$FFFA(A6)
  1222. 00000094: 3D72 0008 FFFE     MOVE.W    $08(A2,D0.W),$FFFE(A6)
  1223. 0000009A: 2F2E FFFC          MOVE.L    $FFFC(A6),-(A7)
  1224. 0000009E: 2F2E FFF8          MOVE.L    $FFF8(A6),-(A7)
  1225. 000000A2: 3F2E FFF6          MOVE.W    $FFF6(A6),-(A7)
  1226. 000000A6: 2F0B               MOVE.L    A3,-(A7)
  1227. 000000A8: 204B               MOVEA.L   A3,A0
  1228. 000000AA: 2050               MOVEA.L   (A0),A0
  1229. 000000AC: 2050               MOVEA.L   (A0),A0
  1230. 000000AE: 4E90               JSR       (A0)
  1231. 000000B0: 3D40 FFEC          MOVE.W    D0,$FFEC(A6)
  1232. 000000B4: 2D41 FFEE          MOVE.L    D1,$FFEE(A6)
  1233. 000000B8: 2D48 FFF2          MOVE.L    A0,$FFF2(A6)
  1234. 000000BC: 2F2E FFF2          MOVE.L    $FFF2(A6),-(A7)
  1235. 000000C0: 2F2E FFEE          MOVE.L    $FFEE(A6),-(A7)
  1236. 000000C4: 3F2E FFEC          MOVE.W    $FFEC(A6),-(A7)
  1237. 000000C8: 486D 0000          PEA       $0000(A5)
  1238. 000000CC: 4EBA 0000          JSR       printf
  1239. 000000D0: 4FEF 0018          LEA       $0018(A7),A7
  1240. 000000D4: 5284               ADDQ.L    #$1,D4
  1241. 000000D6: 6000 FF52          BRA       *-$00AC        ; 0000002A
  1242. 000000DA: 2F0B               MOVE.L    A3,-(A7)
  1243. 000000DC: 4EBA 0000          JSR       operator delete(void *)
  1244. 000000E0: 7000               MOVEQ     #$00,D0
  1245. 000000E2: 4CDF 1C18          MOVEM.L   (A7)+,D3/D4/A2-A4
  1246. 000000E6: 4E5E               UNLK      A6
  1247. 000000E8: 4E75               RTS
  1248. 000000EA
  1249.  
  1250. Foo::Eval(void):
  1251. 00000000: 4E56 FFF4          LINK      A6,#$FFF4
  1252. 00000004: 2D7C 4002 C570     MOVE.L    #$4002C570,$FFF6(A6)
  1253.           FFF6           
  1254. 0000000C: 2D7C A3D7 0A3D     MOVE.L    #$A3D70A3D,$FFFA(A6)
  1255.           FFFA           
  1256. 00000014: 3D7C 7000 FFFE     MOVE.W    #$7000,$FFFE(A6)
  1257. 0000001A: 302E FFF6          MOVE.W    $FFF6(A6),D0
  1258. 0000001E: 222E FFF8          MOVE.L    $FFF8(A6),D1
  1259. 00000022: 206E FFFC          MOVEA.L   $FFFC(A6),A0
  1260. 00000026: 4E5E               UNLK      A6
  1261. 00000028: 225F               MOVEA.L   (A7)+,A1
  1262. 0000002A: 584F               ADDQ.W    #$4,A7
  1263. 0000002C: 4ED1               JMP       (A1)
  1264. 0000002E
  1265.  
  1266. Finally, here is a text version of the project file used to compile the code:
  1267. Wombat:Apps:ThinkC/C++:Play:Play.9
  1268. 1 segments
  1269. 3 files
  1270.  
  1271. Segment 3
  1272. Name: 
  1273. Preload: false
  1274. Protected: true
  1275. Locked: true
  1276. Purgeable: true
  1277. SystemHeap: false
  1278. 3 files:
  1279. Wombat:Apps:ThinkC/C++:SC++7.0:Standard Libraries:ANSI++
  1280. Wombat:Apps:ThinkC/C++:SC++7.0:Standard Libraries:CPlusLib
  1281. Wombat:Apps:ThinkC/C++:Play:main.cpp
  1282.  
  1283. #endif
  1284.  
  1285.  
  1286. ---------------------------
  1287.  
  1288. >From fever@winternet.com (Fever)
  1289. Subject: Serial Port Programming?
  1290. Date: 26 May 1994 20:45:00 GMT
  1291. Organization: StarNet Communications, Inc
  1292.  
  1293. Could someone direct me to where I can find information on programming the
  1294. Mac's serial ports?  (Specifically: For modems, in C)
  1295.  
  1296. I'd appreciate any information...
  1297.  
  1298.  
  1299.  
  1300. +++++++++++++++++++++++++++
  1301.  
  1302. >From d88-jwa@dront.nada.kth.se (Jon Wdtte)
  1303. Date: 27 May 1994 06:48:46 GMT
  1304. Organization: The Royal Institute of Technology
  1305.  
  1306. In <2s31oc$16d@blackice.winternet.com> fever@winternet.com (Fever) writes:
  1307.  
  1308. >Could someone direct me to where I can find information on programming the
  1309. >Mac's serial ports?  (Specifically: For modems, in C)
  1310.  
  1311. The comp.sys.mac.programmer FAQ answer sheet shows, in code, how
  1312. to make a list of all available serial ports, and then go on to
  1313. use it for something. You can also check Think Reference 2.0.
  1314.  
  1315. nada.kth.se:pub/hacks/mac-faq
  1316.  
  1317. Cheers,
  1318.  
  1319.                     / h+
  1320.  
  1321. -- 
  1322.  -- Jon W{tte, h+@nada.kth.se, Mac Software Engineer Deluxe --
  1323.   "After I first used the Mac, I had a dream in which I would walk up to
  1324.    people, touch them, and they'd turn black. Then I could talk to them."
  1325.                      -- Anon
  1326.  
  1327. +++++++++++++++++++++++++++
  1328.  
  1329. >From egurney@vcd.hp.com (Eddy J. Gurney)
  1330. Date: Sat, 28 May 1994 00:49:06 GMT
  1331. Organization: Hewlett-Packard VCD
  1332.  
  1333. Fever (fever@winternet.com) wrote:
  1334. >Could someone direct me to where I can find information on programming the
  1335. >Mac's serial ports?  (Specifically: For modems, in C)
  1336.  
  1337. Check out the sample code on ftp.apple.com in:
  1338.  
  1339. /dts/mac/sc/snippets/devices/pbxxx-serial-demo.hqx
  1340.  
  1341. It is a good example of using the Mac serial ports "correctly".
  1342.  
  1343. --
  1344. Eddy J. Gurney N8FPW   Hewlett-Packard Company, Vancouver (USA!) Division
  1345. egurney@vcd.hp.com                       #include <standard-disclaimer.h>
  1346. "Failures are divided into two classes-- those who thought and never did,
  1347.       and those who did and never thought."     John Charles Salak
  1348.  
  1349. ---------------------------
  1350.  
  1351. >From sfkaplan@alife.santafe.edu (Scott Kaplan)
  1352. Subject: Serial port use
  1353. Date: 24 May 1994 19:59:57 GMT
  1354. Organization: The Santa Fe Institute
  1355.  
  1356. Hi there.   I'm writing a quick little program which needs to make use of the
  1357. serial ports (specifically, the modem port attached to, of all things, a
  1358. modem...).  
  1359. For what this program is doing, it does not seem worth my time to figure out
  1360. how to use the Comm Toolbox, so I thought I'd do it directly by opening the
  1361. serial drivers and using good ol' FSRead and FSWrite.  I'm having trouble,
  1362. and I was hoping someone could tell me why.
  1363.  
  1364. Here's the problem.  I've go to do an FSRead on the modem port.  If there is
  1365. something waiting in the modem port's buffer, everything's great.  However,
  1366. if there is nothing there (nothing has come in since I read from it last),
  1367. I die.  Rather than returning a count of 0 bytes read in, and rather than
  1368. returning some error value from FSRead, the machine crashes completely.  I
  1369. have to reboot.  So, I am clearly doing something wrong here...
  1370.  
  1371. If someone knows what this might be, please let me know.  If more information
  1372. about what I'm doing is needed, please ask, I'll be happy to provide it.  and
  1373. if you think that I shouldn't be avoiding the Comm Toolbox and that it would
  1374. easily solve my problems, let me know about that too.
  1375.  
  1376. Thanks muchly.
  1377.  
  1378. Scott Kaplan
  1379.  
  1380.  
  1381. +++++++++++++++++++++++++++
  1382.  
  1383. >From egurney@vcd.hp.com (Eddy J. Gurney)
  1384. Date: Tue, 24 May 1994 23:23:40 GMT
  1385. Organization: Hewlett-Packard VCD
  1386.  
  1387. Scott Kaplan (sfkaplan@alife.santafe.edu) wrote:
  1388. >Hi there.   I'm writing a quick little program which needs to make use of the
  1389. >serial ports (specifically, the modem port attached to, of all things, a
  1390. >modem...).  
  1391. >For what this program is doing, it does not seem worth my time to figure out
  1392. >how to use the Comm Toolbox, so I thought I'd do it directly by opening the
  1393. >serial drivers and using good ol' FSRead and FSWrite.  I'm having trouble,
  1394. >and I was hoping someone could tell me why.
  1395.  
  1396. Check out the sample code on ftp.apple.com:
  1397.  
  1398. /dts/mac/sc/snippets/devices/pbxxx-serial-demo.hqx
  1399.  
  1400. The snippets directory is a GREAT place to look for answers to ALL of 
  1401. your questions BEFORE posting to net...
  1402.  
  1403. --
  1404. Eddy J. Gurney N8FPW   Hewlett-Packard Company, Vancouver (USA!) Division
  1405. egurney@vcd.hp.com                       #include <standard-disclaimer.h>
  1406. "Failures are divided into two classes-- those who thought and never did,
  1407.       and those who did and never thought."     John Charles Salak
  1408.  
  1409. +++++++++++++++++++++++++++
  1410.  
  1411. >From ab@crosfield.co.uk (Andrew Bradley)
  1412. Date: Thu, 26 May 1994 09:03:15 GMT
  1413. Organization: Crosfield, Hemel Hempstead, UK
  1414.  
  1415. In article <2rtmbt$o8m@tierra.santafe.ede> sfkaplan@alife.santafe.edu (Scott Kaplan) writes:
  1416. >Hi there.   I'm writing a quick little program which needs to make use of the
  1417. >serial ports (specifically, the modem port attached to, of all things, a
  1418. >modem...).  
  1419.  
  1420. >Here's the problem.  I've go to do an FSRead on the modem port.  If there is
  1421. >something waiting in the modem port's buffer, everything's great.  However,
  1422. >if there is nothing there (nothing has come in since I read from it last),
  1423. >I die.  Rather than returning a count of 0 bytes read in, and rather than
  1424. >returning some error value from FSRead, the machine crashes completely.  I
  1425. >have to reboot.  So, I am clearly doing something wrong here...
  1426. >
  1427.  
  1428.  
  1429. I use SerGetBuf to check whats available and read that in - if its zero
  1430. I use my own minimum data size because otherwise the FSRead will hang
  1431. until it got all the bytes you asked for.
  1432.  
  1433. Remember the Mac may be written in C but its not UNIX. You have to study
  1434. the Mac libraries very carefully and forget all your unix past !
  1435.  
  1436. Regards Andrew
  1437.  
  1438.  
  1439.  
  1440. -- 
  1441.  
  1442.  
  1443.   |\/\/\/\                   Andrew Bradley
  1444.   |      |                   Crosfield Electronics Limited
  1445.  
  1446. +++++++++++++++++++++++++++
  1447.  
  1448. >From cswan@actrix.gen.nz (Chris Swan)
  1449. Date: Thu, 26 May 1994 21:25:04 GMT
  1450. Organization: Actrix Information Exchange
  1451.  
  1452. Scott Kaplan <sfkaplan@alife.santafe.edu> wrote:
  1453. > Hi there.   I'm writing a quick little program which needs to make use of the
  1454. > serial ports (specifically, the modem port attached to, of all things, a
  1455. > modem...).  
  1456. > Here's the problem.  I've go to do an FSRead on the modem port.  If there is
  1457. > something waiting in the modem port's buffer, everything's great.  However,
  1458. > if there is nothing there (nothing has come in since I read from it last),
  1459. > I die.  Rather than returning a count of 0 bytes read in, and rather than
  1460. > returning some error value from FSRead, the machine crashes completely.  I
  1461. > have to reboot.  So, I am clearly doing something wrong here...
  1462.  
  1463. I'm not sure why you're crashing but the normal way is to call:
  1464.  
  1465. theError:= SerGetBuf(refNum,count);
  1466. if (theError=noErr) and (count>0) then
  1467.   theError:= FSRead(refNum,count,buffPtr);
  1468.  
  1469. works for me !
  1470. -- 
  1471. Chris Swan
  1472. cswan@actrix.gen.nz
  1473. --
  1474.  
  1475.  
  1476. +++++++++++++++++++++++++++
  1477.  
  1478. >From Bruce@hoult.actrix.gen.nz (Bruce Hoult)
  1479. Date: Fri, 27 May 1994 14:08:43 +1200 (NZST)
  1480. Organization: (none)
  1481.  
  1482. sfkaplan@alife.santafe.edu (Scott Kaplan) writes:
  1483. > Here's the problem.  I've go to do an FSRead on the modem port.  If there is
  1484. > something waiting in the modem port's buffer, everything's great.  However,
  1485. > if there is nothing there (nothing has come in since I read from it last),
  1486. > I die.  Rather than returning a count of 0 bytes read in, and rather than
  1487. > returning some error value from FSRead, the machine crashes completely.  I
  1488. > have to reboot.  So, I am clearly doing something wrong here...
  1489.  
  1490. The machine hasn't crashed -- it's just waiting for the data you asked for.
  1491.  
  1492. If you want your program to continue if there's nothing there then use...
  1493.  
  1494.    SerGetBuf(refNum:INTEGER;VAR count:LONGINT):OSErr;
  1495.     
  1496. ...to find out how many bytes are available, and then ask for at most
  1497. that many in your FSRead.
  1498.  
  1499. -- Bruce
  1500.  
  1501. btw, I just used ObiWan to paste the definition of SerGetBuf.  It's nice, but
  1502. what I *hate* about it is that the first time I use it after a restart, it
  1503. puts up a much larger window and all my Icons that are nicely arranged along
  1504. the bottom of my Finder desktop somehow get moved to the RH side of the desktop.
  1505.  
  1506. ::aaaarggghhhh::
  1507.  
  1508. +++++++++++++++++++++++++++
  1509.  
  1510. >From gurgle@netcom.com (Pete Gontier)
  1511. Date: Fri, 27 May 1994 21:33:37 GMT
  1512. Organization: cellular
  1513.  
  1514. ab@crosfield.co.uk (Andrew Bradley) writes:
  1515.  
  1516. >Remember the Mac may be written in C but its not UNIX.
  1517.  
  1518. I know it's a persistent rumor, but the Mac ROMs were not written in any
  1519. particular high-level language. I guess from now on the Power Mac ROMs
  1520. will mostly be written in C, or perhaps C++, but from what I understand,
  1521. much of that work has not yet been released. It's still mostly 68K
  1522. assembly using the Pascal calling convention.
  1523. -- 
  1524.  Pete Gontier, CTO, Integer Poet Software; gurgle@netcom.com
  1525.  
  1526.  "Bedrock does support a form of drag and drop. Development dragged on
  1527.  for about two years, and then was dropped." -- Brian Clark
  1528.  
  1529. +++++++++++++++++++++++++++
  1530.  
  1531. >From sfkaplan@alife.santafe.edu (Scott Kaplan)
  1532. Date: 29 May 1994 16:43:44 GMT
  1533. Organization: The Santa Fe Institute
  1534.  
  1535. Many thanks to those that responded!  I know now of a very useful place 
  1536. for sample source code from Apple, which will always be a good thing.  More-
  1537. over, I now know what I was doing wrong.  Sure enough, the use of SerGetBuf
  1538. fixed my troubles.
  1539.  
  1540. My apologies for not having read through the serial driver toolbox routines
  1541. more carefully.  It's been a little while since I had done Mac programming,
  1542. so I had fallen out of that good habit.
  1543.  
  1544. Scott Kaplan
  1545. sfkaplan@santafe.edu
  1546.  
  1547.  
  1548. ---------------------------
  1549.  
  1550. >From stevenj@ATHENA.MIT.EDU (Steven G. Johnson)
  1551. Subject: THINK Class Library FTP Site?
  1552. Date: 26 May 1994 18:32:48 GMT
  1553. Organization: Massachvsetts Institvte of Technology
  1554.  
  1555. There used to be an FTP site containing an archive of classes that
  1556. people have written for TCL.  It was connected to a mailing list
  1557. (called TCL-talk, I think), and was located at ftp.brown.edu.
  1558. However, I looked at this site today and I couldn't find anything!
  1559. Does anyone know what has happened to the archive (and the mailing
  1560. list)?  Has it been moved to someplace else?  If so, where?
  1561.  
  1562. Please email all responses, as it is difficult for me to read this
  1563. newsgroup at the moment.  I will post a summary of the replies if
  1564. anyone is interested.  Thanks!
  1565.  
  1566.                     Cordially,
  1567.                     Steven G. Johnson
  1568.  
  1569. +++++++++++++++++++++++++++
  1570.  
  1571. >From stevenj@ATHENA.MIT.EDU (Steven G. Johnson)
  1572. Date: 27 May 1994 16:28:35 GMT
  1573. Organization: Massachvsetts Institvte of Technology
  1574.  
  1575. I recently posted a request for the location of the FTP site
  1576. containing TCL classes and functions.  I was told that the new site
  1577. is:    daemon.ncsa.uiuc.edu  (I checked it out and this is indeed the
  1578. correct address).
  1579.  
  1580. Thanks to all who replied.
  1581.  
  1582.                         Cordially,
  1583.                         Steven G. Johnson
  1584.  
  1585. ---------------------------
  1586.  
  1587. >From Will Husain <whusain@azedlink1.state.az.us>
  1588. Subject: storage for XCMDS
  1589. Date: 23 May 1994 14:51:52 GMT
  1590. Organization: k12
  1591.  
  1592. I'd like to write an XCMD for hypercard that will store information
  1593. between successive calls from hypercard.  How can I keep track of global
  1594. data with this kind of resource?
  1595.  
  1596. Thanks for any suggestions
  1597.  
  1598. Will Glass-Husain
  1599. Catalina Foothills High School
  1600. whusain@k12.az.us
  1601.  
  1602. +++++++++++++++++++++++++++
  1603.  
  1604. >From alex@metcalf.demon.co.uk (Alex Metcalf)
  1605. Date: Tue, 24 May 1994 12:02:21 GMT
  1606. Organization: Best Before Yesterday
  1607.  
  1608. In article <2rqfu8$ffs@azedlink1.ade.state.az.us>, Will Husain
  1609. <whusain@azedlink1.state.az.us> wrote:
  1610.  
  1611. > I'd like to write an XCMD for hypercard that will store information
  1612. > between successive calls from hypercard.  How can I keep track of global
  1613. > data with this kind of resource?
  1614.  
  1615. You first need to make up your own struct of information which you want to
  1616. keep, something like this:
  1617.  
  1618. typedef struct
  1619. {
  1620.    Ptr    myMemory;
  1621.    long   myLong;
  1622.    short  myShort;
  1623. } MyData, *MyDataPtr;
  1624.  
  1625. So, you use NewPtr to make some space on the heap for your data. Then, you
  1626. take the pointer (to your data), typecast it to a 'long', use NumToString,
  1627. and store the string (which is actually the address of your info) in a
  1628. HyperCard global variable using SetGlobal.
  1629.  
  1630. Next time round, use GetGlobal, use StringToNum, and then typecast back to
  1631. a pointer. You can then access your information.
  1632.  
  1633. Hope this helps! Get in touch if you have any other questions.
  1634.  
  1635.  
  1636. Best wishes,
  1637.  
  1638.  
  1639.  
  1640.  
  1641. Alex
  1642.  
  1643. --
  1644. Alex Metcalf, Best Before Yesterday
  1645. Mac programmer in C, C++, HyperTalk, assembler
  1646.  
  1647. Internet, AOL, BIX: alex@metcalf.demon.co.uk            "Surely you
  1648. AppleLink:          alex@metcalf.demon.co.uk@internet#   can't be
  1649. CompuServe:         INTERNET:alex@metcalf.demon.co.uk    serious?"
  1650. Delphi:             alex@metcalf.demon.co.uk@inet#
  1651. FirstClass:         alex@metcalf.demon.co.uk,Internet   "I am serious...
  1652. Fax (UK):           (0570) 45636                         and don't call
  1653. Fax (US / Canada):  011 44 570 45636                     me Shirley."
  1654.  
  1655. +++++++++++++++++++++++++++
  1656.  
  1657. >From Arne.Venstad@DELAB.SINTEF.no (Arne Venstad)
  1658. Date: 25 May 1994 08:44:02 GMT
  1659. Organization: SINTEF DELAB
  1660.  
  1661. In article <alex-240594130138@metcalf.demon.co.uk>,
  1662. alex@metcalf.demon.co.uk (Alex Metcalf) wrote:
  1663. > In article <2rqfu8$ffs@azedlink1.ade.state.az.us>, Will Husain
  1664. > <whusain@azedlink1.state.az.us> wrote:
  1665. > > I'd like to write an XCMD for hypercard that will store information
  1666. > > between successive calls from hypercard.  How can I keep track of global
  1667. > > data with this kind of resource?
  1668. > You first need to make up your own struct of information which you want to
  1669. > keep, something like this:
  1670. > typedef struct
  1671. > {
  1672. >    Ptr    myMemory;
  1673. >    long   myLong;
  1674. >    short  myShort;
  1675. > } MyData, *MyDataPtr;
  1676. > So, you use NewPtr to make some space on the heap for your data. Then, you
  1677. > take the pointer (to your data), typecast it to a 'long', use NumToString,
  1678. > and store the string (which is actually the address of your info) in a
  1679. > HyperCard global variable using SetGlobal.
  1680. >...
  1681.  
  1682. I do not think it is wise to allocate locked memory blocks behind
  1683. the back of HyperCard. I would therefore suggest you use NewHandle
  1684. instead of NewPtr, and always unlock it before returning to HyperCard. 
  1685. Otherwise the schema is ok.
  1686.  
  1687. Arne Venstad    Internet: Arne.Venstad@delab.sintef.no
  1688. SINTEF DELAB,
  1689. N-7034 Trondheim,
  1690. Norway.
  1691.  
  1692. +++++++++++++++++++++++++++
  1693.  
  1694. >From alex@metcalf.demon.co.uk (Alex Metcalf)
  1695. Date: Wed, 25 May 1994 12:01:50 GMT
  1696. Organization: Best Before Yesterday
  1697.  
  1698. In article <Arne.Venstad-250594103928@mac-df17.er.sintef.no>,
  1699. Arne.Venstad@DELAB.SINTEF.no (Arne Venstad) wrote:
  1700.  
  1701. > In article <alex-240594130138@metcalf.demon.co.uk>,
  1702. > alex@metcalf.demon.co.uk (Alex Metcalf) wrote:
  1703. > > 
  1704. > > In article <2rqfu8$ffs@azedlink1.ade.state.az.us>, Will Husain
  1705. > > <whusain@azedlink1.state.az.us> wrote:
  1706. > > 
  1707. > > > I'd like to write an XCMD for hypercard that will store information
  1708. > > > between successive calls from hypercard.  How can I keep track of global
  1709. > > > data with this kind of resource?
  1710. > > 
  1711. > > You first need to make up your own struct of information which you want to
  1712. > > keep, something like this:
  1713. > > 
  1714. > > typedef struct
  1715. > > {
  1716. > >    Ptr    myMemory;
  1717. > >    long   myLong;
  1718. > >    short  myShort;
  1719. > > } MyData, *MyDataPtr;
  1720. > > 
  1721. > > So, you use NewPtr to make some space on the heap for your data. Then, you
  1722. > > take the pointer (to your data), typecast it to a 'long', use NumToString,
  1723. > > and store the string (which is actually the address of your info) in a
  1724. > > HyperCard global variable using SetGlobal.
  1725. > > 
  1726. > >...
  1727. > I do not think it is wise to allocate locked memory blocks behind
  1728. > the back of HyperCard. I would therefore suggest you use NewHandle
  1729. > instead of NewPtr, and always unlock it before returning to HyperCard. 
  1730. > Otherwise the schema is ok.
  1731.  
  1732. I've had problems before with NewHandle: HyperCard enjoys moving memory
  1733. around, especially when stacks are switched/closed. If HyperCard (or the
  1734. system memory fuctions) decide to purge your block then there's no way to
  1735. get your data back.
  1736.  
  1737.  
  1738.  
  1739. Alex
  1740.  
  1741. +++++++++++++++++++++++++++
  1742.  
  1743. >From Ron_Hunsinger@bmug.org (Ron Hunsinger)
  1744. Date: Wed, 25 May 94 22:52:20 PST
  1745. Organization: Berkeley Macintosh Users Group
  1746.  
  1747. Will Husain <whusain@azedlink1.state.az.us> writes:
  1748.  
  1749. >I'd like to write an XCMD for hypercard that will store information
  1750. >between successive calls from hypercard.  How can I keep track of global
  1751. >data with this kind of resource?
  1752.  
  1753. Store the data in a relocatable block, and convert the Handle to that
  1754. block to a string and store the string in a global variable.  (Choose a 
  1755. name that won't be used by somebody else.)
  1756.  
  1757. On entry to the XCMD, get the value of that variable.  If it doesn't 
  1758. have a value, you know this is the first call of the XCMD, and you should
  1759. allocate your data.  If the variable does have a value, convert it
  1760. back to a long, and cast it as a Handle to your data.
  1761.  
  1762. -Ron Hunsinger
  1763.  
  1764. +++++++++++++++++++++++++++
  1765.  
  1766. >From Kevin Marks <Kevin@pinner.demon.co.uk>
  1767. Date: Sat, 28 May 1994 11:08:05 GMT
  1768. Organization: Me
  1769.  
  1770. In article <001565AE.fc@bmug.org> Ron Hunsinger, Ron_Hunsinger@bmug.org
  1771. writes:
  1772. >Store the data in a relocatable block, and convert the Handle to that
  1773. >block to a string and store the string in a global variable.  (Choose a 
  1774. >name that won't be used by somebody else.)
  1775.  
  1776. This is a bit dodgy - you can't guarantee that someone else won't trash
  1777. your variable...
  1778. The best way is to write a XWindow instead, and store your Handle in the
  1779. window's refcon. You don't have to show the window if it's not working on
  1780. visual stuf, and thsi means you can send messages to it and set
  1781. properties, so your HyperTalk looks less obscure.
  1782.  
  1783. ---------------------------
  1784.  
  1785. End of C.S.M.P. Digest
  1786. **********************
  1787.  
  1788.  
  1789.