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

  1. Received-Date: Fri, 2 Dec 1994 16:35:35 +0100
  2. From: pottier@clipper.ens.fr (Francois Pottier)
  3. Subject: csmp-digest-v3-072
  4. To: csmp-digest@ens.fr
  5. Date: Fri, 2 Dec 1994 16:35:30 +0100 (MET)
  6. X-Mailer: ELM [version 2.4 PL23]
  7. Mime-Version: 1.0
  8. Content-Type: text/plain; charset=ISO-8859-1
  9. Content-Transfer-Encoding: 8bit
  10. Errors-To: listman@ens.fr
  11. Reply-To: pottier@clipper.ens.fr
  12. X-Sequence: 78
  13.  
  14. C.S.M.P. Digest             Fri, 02 Dec 94       Volume 3 : Issue 72
  15.  
  16. Today's Topics:
  17.  
  18.         ADSP, PPC, Apple Events ? Which to use?
  19.         ASLM, CFM, etc
  20.         Background Only Apps
  21.         Call PostEvent() from a TimeMgr task!
  22.         OSACompile and OSAExecute
  23.         PBCatSearch finder flags?
  24.         Q: SICompletionUPP
  25.  
  26.  
  27.  
  28. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  29. (pottier@clipper.ens.fr).
  30.  
  31. The digest is a collection of article threads from the internet newsgroup
  32. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  33. regularly and want an archive of the discussions.  If you don't know what a
  34. newsgroup is, you probably don't have access to it.  Ask your systems
  35. administrator(s) for details.  If you don't have access to news, you may
  36. still be able to post messages to the group by using a mail server like
  37. anon.penet.fi (mail help@anon.penet.fi for more information).
  38.  
  39. Each issue of the digest contains one or more sets of articles (called
  40. threads), with each set corresponding to a 'discussion' of a particular
  41. subject.  The articles are not edited; all articles included in this digest
  42. are in their original posted form (as received by our news server at
  43. nef.ens.fr).  Article threads are not added to the digest until the last
  44. article added to the thread is at least two weeks old (this is to ensure that
  45. the thread is dead before adding it to the digest).  Article threads that
  46. consist of only one message are generally not included in the digest.
  47.  
  48. The digest is officially distributed by two means, by email and ftp.
  49.  
  50. If you want to receive the digest by mail, send email to listserv@ens.fr
  51. with no subject and one of the following commands as body:
  52.     help                        Sends you a summary of commands
  53.     subscribe csmp-digest Your Name    Adds you to the mailing list
  54.     signoff csmp-digest            Removes you from the list
  55. Once you have subscribed, you will automatically receive each new
  56. issue as it is created.
  57.  
  58. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  59. Questions related to the ftp site should be directed to
  60. scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
  61. digest are available there.
  62.  
  63. Also, the digests are available to WAIS users.  To search back issues
  64. with WAIS, use comp.sys.mac.programmer.src. With Mosaic, use
  65. http://www.wais.com/wais-dbs/comp.sys.mac.programmer.html.
  66.  
  67.  
  68. -------------------------------------------------------
  69.  
  70. >From gerrard@luga.latrobe.edu.au (Graeme Gerrard)
  71. Subject: ADSP, PPC, Apple Events ? Which to use?
  72. Date: Fri, 11 Nov 1994 13:51:40 GMT
  73. Organization: LaTrobe University
  74.  
  75. I need to send messages to a number
  76. of Macintoshes connected to a host over Localtalk.
  77.  
  78. The remote Macs will be running the *same program* continuously
  79. and different messages need to be sent to them.
  80. The messages are short, a couple of hundred bytes each
  81. and have to be sent every second or so.
  82. The main criteria is robustness.  The system has to run, with a minimum of
  83. maintenance, for several months.
  84.  
  85. Which is the best way to go, Apple Events, PPC toolbox, or a combination
  86. of NBP and ADSP?
  87.  
  88. Advice from anyone with experience in this kind of thing would be
  89. greatly appreciated.
  90.  
  91. -- 
  92. Graeme Gerrard                G.Gerrard@latrobe.edu.au
  93. Music Dept
  94. La Trobe University
  95.  
  96. +++++++++++++++++++++++++++
  97.  
  98. >From stevec@jolt.mpx.com.au (Stephen Coy)
  99. Date: Sun, 13 Nov 1994 00:23:28 +1100
  100. Organization: Resolve Software (WA) Pty Ltd
  101.  
  102. In article <gerrard-1211940051400001@131.172.10.162>,
  103. gerrard@luga.latrobe.edu.au (Graeme Gerrard) wrote:
  104.  
  105. > I need to send messages to a number
  106. > of Macintoshes connected to a host over Localtalk.
  107. > The remote Macs will be running the *same program* continuously
  108. > and different messages need to be sent to them.
  109. > The messages are short, a couple of hundred bytes each
  110. > and have to be sent every second or so.
  111. > The main criteria is robustness.  The system has to run, with a minimum of
  112. > maintenance, for several months.
  113. > Which is the best way to go, Apple Events, PPC toolbox, or a combination
  114. > of NBP and ADSP?
  115. > Advice from anyone with experience in this kind of thing would be
  116. > greatly appreciated.
  117.  
  118. Given the frequency of your messages, I would be inclined to build on top
  119. of the PPC toolbox. Combining this with the Threads Manager will allow
  120. your applications to function pseudo-asynchronously, independently of the
  121. Event Manager. The PPC toolbox provides functionality that you would have
  122. to build anyway if you were to build your own stuff on top of ADSP/NBP.
  123.  
  124. I suspect that the AppleEvent Manager would have trouble with the volume.
  125.  
  126. -- 
  127. Steve Coy
  128. Resolve Software (WA) Pty Ltd
  129. 4/69 Lynwood Ave
  130. Dee Why NSW 2099
  131. Australia
  132.  
  133. +++++++++++++++++++++++++++
  134.  
  135. >From h+@metrowerks.com (Jon W{tte)
  136. Date: Sun, 13 Nov 1994 11:16:47 +0100
  137. Organization: The Conspiracy
  138.  
  139. In article <gerrard-1211940051400001@131.172.10.162>,
  140. gerrard@luga.latrobe.edu.au (Graeme Gerrard) wrote:
  141.  
  142. >The main criteria is robustness.  The system has to run, with a minimum of
  143. >maintenance, for several months.
  144.  
  145. >Which is the best way to go, Apple Events, PPC toolbox, or a combination
  146. >of NBP and ADSP?
  147.  
  148. >Advice from anyone with experience in this kind of thing would be
  149. >greatly appreciated.
  150.  
  151. For the criteria mentioned, you can use any one of the methods. 
  152. NBP/ADSP is the most work, and the easiest on the network. 
  153. AppleEvents are much easier to code, but take more bandwidth. 
  154. PPC is just in the middle of them. I would use AppleEvents 
  155. because they're safe and easy to debug.
  156.  
  157. What worries me is this:
  158.  
  159. >I need to send messages to a number
  160. >of Macintoshes connected to a host over Localtalk.
  161. >The messages are short, a couple of hundred bytes each
  162. >and have to be sent every second or so.
  163.  
  164. LocalTalk has a MAXIMUM data throughput of 25 kB per second. 
  165. You have to divide by at least two, probably four, to get a 
  166. reliably sustainable data rate without too many collissions. 
  167. Two for the collission evasion on an ether media (not Ethernet, 
  168. but any CSMD media like LocalTalk), and two more for overhead 
  169. in protocols and replies. This gives you 6 kB/sec, or about 12 
  170. macs with 500 byte messages.
  171.  
  172. Max.
  173.  
  174. Cheers,
  175.  
  176.                     / h+
  177.  
  178.  
  179. --
  180.   Jon W‰tte (h+@nada.kth.se), Hagagatan 1, 113 48 Stockholm, Sweden
  181.  Santa's Reindeer: Fry 1 minced onion, add 1 lb thinly sliced frozen reindeer,
  182.  fry to color, add 1/2 lb mushrooms and 1/2 lb sour cream, simmer 5 mins, add
  183.  soy to taste, salt, pepper. Serve with boiled rice and redcurrant jelly.
  184.  
  185.  
  186. +++++++++++++++++++++++++++
  187.  
  188. >From pgontier@novell.com (Pete Gontier)
  189. Date: Mon, 14 Nov 1994 20:32:55 -0800
  190. Organization: Novell, Inc., Walnut Creek/Macintosh Site
  191.  
  192. In article <gerrard-1211940051400001@131.172.10.162>,
  193. gerrard@luga.latrobe.edu.au (Graeme Gerrard) wrote:
  194.  
  195. > I need to send messages to a number
  196. > of Macintoshes connected to a host over Localtalk.
  197. > ...The main criteria is robustness....
  198. > Which is the best way to go, Apple Events, PPC toolbox, or a combination
  199. > of NBP and ADSP?
  200.  
  201. Be aware that AppleEvents are based on PPC Toolbox, and PPC Toolbox is
  202. based on ADSP. You probably already knew this, but sometimes it's useful
  203. to hear it out loud. What it means is that no matter which of the three
  204. you pick, your choice will only be as robust as ADSP, but might be less
  205. robust. This might lead you to go with ADSP, if only to reduce the number
  206. of layers involved. However, PPC Toolbox does buy you quicker comm between
  207. processes on the same Mac, and AppleEvents buy you some amount of
  208. simplification, which might end up meaning that the least tested code,
  209. yours, is more robust.
  210.  
  211. -- 
  212.  The views expressed here do not necessarily reflect those of my employer.
  213.  
  214.  "Furthermore, in my mad haste to switch CDs, I dragged the Inside Mac CD-ROM 
  215.  icon to the trash and when the Mac ejected it, the tray pushed a glass of 
  216.  grape juice off my desk and into my lap. Let that be a lesson to 
  217.  development tool vendors: all this would have been avoided with better 
  218.  documentation." -- Miguel Cruz <mnc@netcom.com>
  219.  
  220. +++++++++++++++++++++++++++
  221.  
  222. >From bdiamand@netcom.com (Ben Diamand)
  223. Date: Wed, 16 Nov 1994 03:44:59 GMT
  224. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  225.  
  226. Pete Gontier (pgontier@novell.com) wrote:
  227. : In article <gerrard-1211940051400001@131.172.10.162>,
  228. : gerrard@luga.latrobe.edu.au (Graeme Gerrard) wrote:
  229.  
  230. : > I need to send messages to a number
  231. : > of Macintoshes connected to a host over Localtalk.
  232. : > 
  233. : > ...The main criteria is robustness....
  234. : > 
  235. : > Which is the best way to go, Apple Events, PPC toolbox, or a combination
  236. : > of NBP and ADSP?
  237.  
  238. : Be aware that AppleEvents are based on PPC Toolbox, and PPC Toolbox is
  239. : based on ADSP. You probably already knew this, but sometimes it's useful
  240. : to hear it out loud. What it means is that no matter which of the three
  241. : you pick, your choice will only be as robust as ADSP, but might be less
  242. : robust. This might lead you to go with ADSP, if only to reduce the number
  243. : of layers involved. However, PPC Toolbox does buy you quicker comm between
  244. : processes on the same Mac, and AppleEvents buy you some amount of
  245. : simplification, which might end up meaning that the least tested code,
  246. : yours, is more robust.
  247.  
  248. Also be aware that ADSP in built on top of DDP.  Now I know that ddp
  249. is lower level than most want to go, BUT, if you minimum overhead and
  250. still maintain compatability, you might consider DDP as an option.  One
  251. fault of DDP is that it's connection-less, meaning packets can be lost,
  252. so if you can't afford that, ADSP is the way to go...
  253.  
  254. Ben Diamand
  255. bdiamand@netcom.com
  256.  
  257.  
  258. +++++++++++++++++++++++++++
  259.  
  260. >From Chris Russo <chris@sonicsys.com>
  261. Date: 17 Nov 1994 01:56:47 GMT
  262. Organization: Sonic Systems, Inc.
  263.  
  264. In article <gerrard-1211940051400001@131.172.10.162> Graeme Gerrard,
  265. gerrard@luga.latrobe.edu.au writes:
  266. >I need to send messages to a number
  267. >of Macintoshes connected to a host over Localtalk.
  268. >
  269. >The remote Macs will be running the *same program* continuously
  270. >and different messages need to be sent to them.
  271. >The messages are short, a couple of hundred bytes each
  272. >and have to be sent every second or so.
  273. >The main criteria is robustness.  The system has to run, with a minimum of
  274. >maintenance, for several months.
  275. >
  276. >Which is the best way to go, Apple Events, PPC toolbox, or a combination
  277. >of NBP and ADSP?
  278. >
  279. >Advice from anyone with experience in this kind of thing would be
  280. >greatly appreciated.
  281.  
  282. Go with NBP and ADSP.
  283.  
  284. Anecdote*:  My office-mate wrote Server Sentry, a remote AppleShare admin,
  285. using AppleEvents - at first.  Unfortunately, he found that AppleEvents sent
  286. to a very busy machine can die without notifying the sender of the error.  He
  287. then took a step back to rely on the PPC toolbox.  Then, you still have to
  288. mess with program linking's dialogs since the PPC toolbox doesn't allow you to
  289. authenticate a user programmatically.  He ended up having to patch
  290. GetNewDialog() to hide Program Linking's password dialog offscreen while he
  291. stuffed the user's name and password into the dialog by posting the events. 
  292. Yuck.
  293.  
  294. Stick with ADSP.  It's a little nitty grittier, but simplicity of a protocol
  295. can have a lot of advantages.  Better to spend a little extra time getting
  296. started with a project because the building blocks are smaller than to start
  297. with a higher level protocol then get stuck mid-project because the protocol
  298. lacks some functionality.  Then you have to hack the hell out of the thing. 
  299. See the previous example.
  300.  
  301. Of course, you might not want to take my word for it.  I like to use DDP
  302. whenever I can. :-)
  303.  
  304. * Don't blame me for technical inaccuracies in this anecdote.  If necessary,
  305. I'll post the source of these complaints to avoid being flamed. :-)
  306.  
  307. Thanks,
  308.  
  309. - ------------------------------------------------------------------------
  310. Chris Russo                      Macintosh Programmer
  311. Sonic Systems, Inc.              (408) 736-1900 #107
  312. chris@sonicsys.com               I'm tired of my signature.
  313.  
  314. +++++++++++++++++++++++++++
  315.  
  316. >From bdiamand@netcom.com (Ben Diamand)
  317. Date: Wed, 16 Nov 1994 03:44:59 GMT
  318. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  319.  
  320. Pete Gontier (pgontier@novell.com) wrote:
  321. : In article <gerrard-1211940051400001@131.172.10.162>,
  322. : gerrard@luga.latrobe.edu.au (Graeme Gerrard) wrote:
  323.  
  324. : > I need to send messages to a number
  325. : > of Macintoshes connected to a host over Localtalk.
  326. : > 
  327. : > ...The main criteria is robustness....
  328. : > 
  329. : > Which is the best way to go, Apple Events, PPC toolbox, or a combination
  330. : > of NBP and ADSP?
  331.  
  332. : Be aware that AppleEvents are based on PPC Toolbox, and PPC Toolbox is
  333. : based on ADSP. You probably already knew this, but sometimes it's useful
  334. : to hear it out loud. What it means is that no matter which of the three
  335. : you pick, your choice will only be as robust as ADSP, but might be less
  336. : robust. This might lead you to go with ADSP, if only to reduce the number
  337. : of layers involved. However, PPC Toolbox does buy you quicker comm between
  338. : processes on the same Mac, and AppleEvents buy you some amount of
  339. : simplification, which might end up meaning that the least tested code,
  340. : yours, is more robust.
  341.  
  342. Also be aware that ADSP in built on top of DDP.  Now I know that ddp
  343. is lower level than most want to go, BUT, if you minimum overhead and
  344. still maintain compatability, you might consider DDP as an option.  One
  345. fault of DDP is that it's connection-less, meaning packets can be lost,
  346. so if you can't afford that, ADSP is the way to go...
  347.  
  348. Ben Diamand
  349. bdiamand@netcom.com
  350.  
  351.  
  352. +++++++++++++++++++++++++++
  353.  
  354. >From bdiamand@netcom.com (Ben Diamand)
  355. Date: Wed, 16 Nov 1994 03:44:59 GMT
  356. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  357.  
  358. Pete Gontier (pgontier@novell.com) wrote:
  359. : In article <gerrard-1211940051400001@131.172.10.162>,
  360. : gerrard@luga.latrobe.edu.au (Graeme Gerrard) wrote:
  361.  
  362. : > I need to send messages to a number
  363. : > of Macintoshes connected to a host over Localtalk.
  364. : > 
  365. : > ...The main criteria is robustness....
  366. : > 
  367. : > Which is the best way to go, Apple Events, PPC toolbox, or a combination
  368. : > of NBP and ADSP?
  369.  
  370. : Be aware that AppleEvents are based on PPC Toolbox, and PPC Toolbox is
  371. : based on ADSP. You probably already knew this, but sometimes it's useful
  372. : to hear it out loud. What it means is that no matter which of the three
  373. : you pick, your choice will only be as robust as ADSP, but might be less
  374. : robust. This might lead you to go with ADSP, if only to reduce the number
  375. : of layers involved. However, PPC Toolbox does buy you quicker comm between
  376. : processes on the same Mac, and AppleEvents buy you some amount of
  377. : simplification, which might end up meaning that the least tested code,
  378. : yours, is more robust.
  379.  
  380. Also be aware that ADSP in built on top of DDP.  Now I know that ddp
  381. is lower level than most want to go, BUT, if you minimum overhead and
  382. still maintain compatability, you might consider DDP as an option.  One
  383. fault of DDP is that it's connection-less, meaning packets can be lost,
  384. so if you can't afford that, ADSP is the way to go...
  385.  
  386. Ben Diamand
  387. bdiamand@netcom.com
  388.  
  389.  
  390. +++++++++++++++++++++++++++
  391.  
  392. >From Chris Russo <chris@sonicsys.com>
  393. Date: 17 Nov 1994 01:56:47 GMT
  394. Organization: Sonic Systems, Inc.
  395.  
  396. In article <gerrard-1211940051400001@131.172.10.162> Graeme Gerrard,
  397. gerrard@luga.latrobe.edu.au writes:
  398. >I need to send messages to a number
  399. >of Macintoshes connected to a host over Localtalk.
  400. >
  401. >The remote Macs will be running the *same program* continuously
  402. >and different messages need to be sent to them.
  403. >The messages are short, a couple of hundred bytes each
  404. >and have to be sent every second or so.
  405. >The main criteria is robustness.  The system has to run, with a minimum of
  406. >maintenance, for several months.
  407. >
  408. >Which is the best way to go, Apple Events, PPC toolbox, or a combination
  409. >of NBP and ADSP?
  410. >
  411. >Advice from anyone with experience in this kind of thing would be
  412. >greatly appreciated.
  413.  
  414. Go with NBP and ADSP.
  415.  
  416. Anecdote*:  My office-mate wrote Server Sentry, a remote AppleShare admin,
  417. using AppleEvents - at first.  Unfortunately, he found that AppleEvents sent
  418. to a very busy machine can die without notifying the sender of the error.  He
  419. then took a step back to rely on the PPC toolbox.  Then, you still have to
  420. mess with program linking's dialogs since the PPC toolbox doesn't allow you to
  421. authenticate a user programmatically.  He ended up having to patch
  422. GetNewDialog() to hide Program Linking's password dialog offscreen while he
  423. stuffed the user's name and password into the dialog by posting the events. 
  424. Yuck.
  425.  
  426. Stick with ADSP.  It's a little nitty grittier, but simplicity of a protocol
  427. can have a lot of advantages.  Better to spend a little extra time getting
  428. started with a project because the building blocks are smaller than to start
  429. with a higher level protocol then get stuck mid-project because the protocol
  430. lacks some functionality.  Then you have to hack the hell out of the thing. 
  431. See the previous example.
  432.  
  433. Of course, you might not want to take my word for it.  I like to use DDP
  434. whenever I can. :-)
  435.  
  436. * Don't blame me for technical inaccuracies in this anecdote.  If necessary,
  437. I'll post the source of these complaints to avoid being flamed. :-)
  438.  
  439. Thanks,
  440.  
  441. - ------------------------------------------------------------------------
  442. Chris Russo                      Macintosh Programmer
  443. Sonic Systems, Inc.              (408) 736-1900 #107
  444. chris@sonicsys.com               I'm tired of my signature.
  445.  
  446. +++++++++++++++++++++++++++
  447.  
  448. >From pjd@triassic.midnight.com (Peter Desnoyers)
  449. Date: 18 Nov 94 15:06:14
  450. Organization: Midnight Networks Inc., Waltham MA
  451.  
  452. In article <AAEBA61F96683F2D@klkmac006.nada.kth.se> h+@metrowerks.com (Jon W{tte) writes:
  453.  >
  454.  >LocalTalk has a MAXIMUM data throughput of 25 kB per second. 
  455.  >You have to divide by at least two, probably four, to get a 
  456.  >reliably sustainable data rate without too many collissions. 
  457.  >Two for the collission evasion on an ether media (not Ethernet, 
  458.  >but any CSMD media like LocalTalk), and two more for overhead 
  459.  >in protocols and replies. This gives you 6 kB/sec, or about 12 
  460.  >macs with 500 byte messages.
  461.  
  462. You might want to go back and check your math on that one.
  463.  
  464. Localtalk is actually quite efficient - if you send max size packets
  465. on a loaded net, you will have 400us of inter-frame gap, followed by
  466. an average of 6 RTS transmissions (actually 2e) until one is ACKed
  467. successfully, at 200us each, followed by 20 ms of data. That's an
  468. efficiency of about 93%. (not counting framing and protocol overhead).
  469. Overhead goes up with smaller packets, but you could still get about
  470. 80% efficiency with 200-byte packets.
  471.  
  472. [also, the max data rate on LocalTalk is 230kb/8 = ~29kbyte/sec.]
  473.  
  474. As far as higher-layer protocol overhead goes, 2x seems like an overly
  475. high estimate, but with the right protocol I'm sure you could make it
  476. even worse than that.
  477.  
  478. ...............................................................................
  479.   Peter Desnoyers  : Midnight Networks Inc. 200 Fifth Avenue Waltham MA 02154 
  480.   pjd@midnight.com : Vox 617/890-1001 Fax -0028  The Best in Network Software
  481. --
  482.  
  483.  
  484. ...............................................................................
  485.   Peter Desnoyers  : Midnight Networks Inc. 200 Fifth Avenue Waltham MA 02154 
  486.   pjd@midnight.com : Vox 617/890-1001 Fax -0028  The Best in Network Software
  487.  
  488.  
  489. ---------------------------
  490.  
  491. >From erik@lexmark.com (Erik Ackerman)
  492. Subject: ASLM, CFM, etc
  493. Date: Wed, 16 Nov 1994 18:14:57 GMT
  494. Organization: AiC
  495.  
  496. I am working on a rewrite of an application that would greatly benefit from
  497. being "plugable".  I have been aiming for a code resource spec, but
  498. recently began to consider using ASLM or CFM (need to support 68K).  Does
  499. anyone have any recomendations as to what solution would be best?  Which
  500. will have the greatest longevity and/or support?  etc...
  501.  
  502. Thanks in advance.
  503.  
  504. Erik Ackerman
  505.  
  506. -- 
  507. erik@lexmark.com
  508.  
  509. Q: What is the difference between a duck?
  510. A: One of its legs is both the same.
  511.  
  512. +++++++++++++++++++++++++++
  513.  
  514. >From untulis@netcom.com (Jason Untulis)
  515. Date: Wed, 16 Nov 1994 20:12:22 GMT
  516. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  517.  
  518. Erik Ackerman (erik@lexmark.com) wrote:
  519. : I am working on a rewrite of an application that would greatly benefit from
  520. : being "plugable".  I have been aiming for a code resource spec, but
  521. : recently began to consider using ASLM or CFM (need to support 68K).  Does
  522. : anyone have any recomendations as to what solution would be best?  Which
  523. : will have the greatest longevity and/or support?  etc...
  524.  
  525. >From what I've read, CFM would be your best bet. ASLM is dependent on
  526. cfront C++-style name mangling, whereas CFM should work with any language.
  527. CFM alread exists on PPC, with the beta 68K CFM coming with the OpenDoc
  528. beta which is scheduled for January. I would think that CFM is the
  529. thing that will ge the most support from Apple.
  530. -- 
  531. - -----
  532. #include <std/disclaimer>           (C) 1994. All rights reserved.
  533. Jason Untulis        untulis@ (netcom.com) (tower.tandem.com)
  534.             untulis_jason@tandem.com, jason@hplcau.hpl.hp.com
  535.    "You don't want to upset the dinosaurs, do you?" -- CompuServe ad
  536.  
  537. +++++++++++++++++++++++++++
  538.  
  539. >From afcjlloyd@aol.com (AFC JLloyd)
  540. Date: 17 Nov 1994 16:20:06 -0500
  541. Organization: America Online, Inc. (1-800-827-6364)
  542.  
  543. In article <erik-161194131457@c21mac4.pfv.prtdev.lexmark.com>,
  544. erik@lexmark.com (Erik Ackerman) writes:
  545.  
  546. >I am working on a rewrite of an application that would greatly benefit
  547. from
  548. >being "plugable".  I have been aiming for a code resource spec, but
  549. >recently began to consider using ASLM or CFM (need to support 68K).  Does
  550. >anyone have any recomendations as to what solution would be best?  Which
  551. >will have the greatest longevity and/or support?  etc...
  552.  
  553. The answer probably depends upon other requirements.  Do you require C++? 
  554. Do you require the ability to develop your "plugs" with several different
  555. compilers?
  556.  
  557. If you require C++, then you should either use ASLM, which limits the
  558. compilers you can use, or you should use SOM on top of CFM.  If you don't
  559. require C++, then straight CFM is probably your best choice.  If you try
  560. to use C++ on CFM you'll probably be forced to use a single compiler, and
  561. you'll have to worry about the "fragile base class" problem.
  562.  
  563. If you use SOM, then you'll (in theory) be able to write plugs in multiple
  564. languages/compilers, and the fragile base class problem is almost
  565. completely solved.  SOM language bindings for C and C++ are available now,
  566. and other languages will probably be supported in the future.  Note that
  567. the SOM object model is very similar to Object Pascal's object model, so
  568. you give up some of the features of C++, e.g. no stack-based objects (but
  569. you can have multiple inheritance).  Also note that you can use SOM for
  570. your exported interface, but internally use all the features C++ if you so
  571. choose.
  572.  
  573. By the way, OpenDoc is being built with SOM/CFM.  One question you should
  574. answer is: can your application be built using OpenDoc?
  575.  
  576. Jim Lloyd
  577. afcjlloyd@aol.com
  578.  
  579. +++++++++++++++++++++++++++
  580.  
  581. >From mattm@apple.com (Matthew Melmon)
  582. Date: Thu, 17 Nov 1994 20:28:53 GMT
  583. Organization: Cabal Noir:  Glorious Leader
  584.  
  585. In article <untulisCzDMsn.Ir4@netcom.com>, untulis@netcom.com (Jason
  586. Untulis) wrote:
  587.  
  588. > Erik Ackerman (erik@lexmark.com) wrote:
  589. > : I am working on a rewrite of an application that would greatly benefit from
  590. > : being "plugable".  I have been aiming for a code resource spec, but
  591. > : recently began to consider using ASLM or CFM (need to support 68K).  Does
  592. > : anyone have any recomendations as to what solution would be best?  Which
  593. > : will have the greatest longevity and/or support?  etc...
  594. > From what I've read, CFM would be your best bet. ASLM is dependent on
  595. > cfront C++-style name mangling, whereas CFM should work with any language.
  596. > CFM alread exists on PPC, with the beta 68K CFM coming with the OpenDoc
  597. > beta which is scheduled for January. I would think that CFM is the
  598. > thing that will ge the most support from Apple.
  599.  
  600. A really, really, really close-to-beta (RRRCtB) of CFM-68K will be
  601. shipping on ETO 16, in a matter of weeks, now, I suppose.
  602.  
  603. -- 
  604. *X*
  605.  
  606. ---------------------------
  607.  
  608. >From ctaylor@fox.nstn.ns.ca (Christian Taylor)
  609. Subject: Background Only Apps
  610. Date: 7 Nov 1994 16:45:24 -0400
  611. Organization: Nova Scotia Technology Network
  612.  
  613. Could someone please send me some sample source code of a background only
  614. app in Pascal?  (THINK Pascal actually).  Everytime I try to make a
  615. program background only, the Mac crashes whenever I click in the
  616. Application menu!  And yes, I've read the Tech Note from ftp.apple.com on
  617. BOAs.  Thanks!
  618.  
  619. Christian
  620.  
  621. +++++++++++++++++++++++++++
  622.  
  623. >From williar2@miavx1.acs.muohio.edu (Bob Williams)
  624. Date: 7 Nov 94 19:34:03 -0500
  625. Organization: Enterprise Software
  626.  
  627. In article <ctaylor-0711941646450001@wolfville-ts-15.nstn.ca>, ctaylor@fox.nstn.ns.ca (Christian Taylor) writes:
  628. > Could someone please send me some sample source code of a background only
  629. > app in Pascal?  (THINK Pascal actually).  Everytime I try to make a
  630. > program background only, the Mac crashes whenever I click in the
  631. > Application menu!  And yes, I've read the Tech Note from ftp.apple.com on
  632. > BOAs.  Thanks!
  633. > Christian
  634.  
  635. Me too!!! I have the exact same problem. I posted here once before, but noone
  636. answered. I would greatly appreciate it. Thanks!!!
  637.  
  638. Regards,
  639. Bob
  640. -- 
  641. +------------------------------------------------------+
  642. |  Robert E. Williams, Jr.                             |
  643. |  Enterprise Software                                 |
  644. |  2006 State Route 380                                |
  645. |  Wilmington, Ohio  45177-9241                        |
  646. |  (513) 382-8232                                      |
  647. |                                                      |
  648. |  E-mail: williar2@miavx1.acs.muohio.edu              |
  649. +------------------------------------------------------+
  650. |   Those who are patient in the trivial things in     |
  651. |   life and control themselves will one day have the  |
  652. |   same mastery in great and important things.        |
  653. |      --Hapkido Master Bong Soo Han                   |
  654. +------------------------------------------------------+
  655.  
  656. +++++++++++++++++++++++++++
  657.  
  658. >From chris-b@cs.auckland.ac.nz (Chris Burns)
  659. Date: Tue, 08 Nov 1994 22:23:24 +1200
  660. Organization: AucklandUniversity:ComputerScience:HMU
  661.  
  662. In article <1994Nov7.193403.33348@miavx1>, williar2@miavx1.acs.muohio.edu
  663. (Bob Williams) wrote:
  664.  
  665. > In article <ctaylor-0711941646450001@wolfville-ts-15.nstn.ca>,
  666. ctaylor@fox.nstn.ns.ca (Christian Taylor) writes:
  667.  
  668. > > Could someone please send me some sample source code of a background only
  669. > > app in Pascal?  (THINK Pascal actually).  Everytime I try to make a
  670. > > program background only, the Mac crashes whenever I click in the
  671. > > Application menu!  And yes, I've read the Tech Note from ftp.apple.com on
  672. > > BOAs.  Thanks!
  673. > Me too!!! I have the exact same problem. I posted here once before, but noone
  674. > answered. I would greatly appreciate it. Thanks!!!
  675.  
  676. THINK Pascal automagically places standard toolbox initialization code at
  677. the beginning of your app. You need to turn this feature off for BOAs by
  678. placing a {$I-} near the top of your main program file. You also need a
  679. _MaxApplZone call (expands heap to fullest), an _InitGraf call (sets up
  680. your app A5 world) and a few _MoreMasters (to preallocate a few master
  681. pointer blocks). Your code goes after this stuff.
  682.  
  683. {-------------------------}
  684. {$I-}
  685.  
  686. program blah;
  687.  
  688. begin
  689.   MaxApplZone;
  690.   InitGraf(@thePort);
  691.  
  692.   MoreMasters;
  693.   MoreMasters;
  694.   MoreMasters;
  695.  
  696.  
  697.  
  698.  
  699.  
  700. end.
  701.  
  702. {-------------------------}
  703.  
  704. Chris B
  705. - ---------------------------------------------------------------------
  706. NewZealand:AucklandUniversity:ComputerScience:HyperMediaUnit:ChrisBurns
  707. Internet: chris-b@cs.auckland.ac.nz
  708. Phone:    +64 9 373-7599 x6194
  709. Fax:      +64 9 373-7453                         Async, therefore I am.
  710. - ---------------------------------------------------------------------
  711.  
  712. +++++++++++++++++++++++++++
  713.  
  714. >From asunta@convex.csc.FI (Miika Asunta)
  715. Date: 12 Nov 1994 17:08:43 GMT
  716. Organization: Sibelius Academy, Helsinki
  717.  
  718. In <1994Nov7.193403.33348@miavx1> williar2@miavx1.acs.muohio.edu (Bob Williams) writes:
  719.  
  720. >In article <ctaylor-0711941646450001@wolfville-ts-15.nstn.ca>, ctaylor@fox.nstn.ns.ca (Christian Taylor) writes:
  721. >> Could someone please send me some sample source code of a background only
  722. >> app in Pascal?  (THINK Pascal actually).  Everytime I try to make a
  723. >> program background only, the Mac crashes whenever I click in the
  724. >> Application menu!  And yes, I've read the Tech Note from ftp.apple.com on
  725. >> BOAs.  Thanks!
  726. >> 
  727.  
  728. I'm sorry this in in C, but I believe you can read it anyway.
  729. The projet type must be 'appe' for background application (NOT
  730. 'APPL'). In addition, set 'Only background' size option.
  731.  
  732. Since 'appe' is only background application, don't call usual
  733. toolbox-init routines. You must not use WindowManager, Menu manager
  734. etc. 
  735.  
  736. The following example misses MyQUIT() routine, an apple-event handler,
  737. that you should be able to write yourself.
  738.  
  739. That application waits quit-apple event forever, and it doesn't eat
  740. system time at all (-:
  741.  
  742. //----------------------------------------------------------
  743.  
  744. void HandleEvents(void)
  745. {
  746. WaitNextEvent(highLevelEventMask,&Event,-1L,NULL);
  747. switch(Event.what) {
  748. case kHighLevelEvent:AEProcessAppleEvent(&Event);break;
  749. }}
  750.  
  751.  
  752.  
  753. main()
  754. {
  755. MaxApplZone();
  756. MoreMasters();
  757.  
  758. AEInstallEventHandler(kCoreEventClass,kAEQuitApplication,&myQUIT,0L,0);
  759.  
  760. idletime=-1L;
  761.  
  762. do HandleEvents();
  763. while (!lopetus);
  764. }
  765.  
  766.  
  767. //------------------------------------------------------------------------
  768. --
  769. Miika Asunta
  770. asunta@convex.csc.fi            Double Bass Player
  771. tel. +358-31-255 9461            Macintosh Programmer
  772.  
  773. +++++++++++++++++++++++++++
  774.  
  775. >From chris-b@cs.auckland.ac.nz (Chris Burns)
  776. Date: Sun, 13 Nov 1994 23:07:59 +1200
  777. Organization: AucklandUniversity:ComputerScience:HMU
  778.  
  779. In article <3a2sqr$pla@pobox.csc.fi>, asunta@convex.csc.FI (Miika Asunta) wrote:
  780.  
  781. > void HandleEvents(void)
  782. > {
  783. > WaitNextEvent(highLevelEventMask,&Event,-1L,NULL);
  784. > switch(Event.what) {
  785. > case kHighLevelEvent:AEProcessAppleEvent(&Event);break;
  786. > }}
  787. > main()
  788. > {
  789. > MaxApplZone();
  790. > MoreMasters();
  791. > AEInstallEventHandler(kCoreEventClass,kAEQuitApplication,&myQUIT,0L,0);
  792. > idletime=-1L;
  793. > do HandleEvents();
  794. > while (!lopetus);
  795. > }
  796.  
  797. You really should do an:
  798.  
  799. InitGraf(&qd.thePort); // Metrowerks C/C++
  800.  
  801. or
  802.  
  803. InitGraf(&thePort); // Symantec C++
  804.  
  805. or 
  806.  
  807. InitGraf(@thePort); // THINK Pascal
  808.  
  809. after the calls to MaxApplZone() and MoreMasters(). This sets up the A5
  810. world necessary for WNE and context switching.
  811.  
  812. Chris B
  813. - ---------------------------------------------------------------------
  814. NewZealand:AucklandUniversity:ComputerScience:HyperMediaUnit:ChrisBurns
  815. Internet: chris-b@cs.auckland.ac.nz
  816. Phone:    +64 9 373-7599 x6194
  817. Fax:      +64 9 373-7453                         Async, therefore I am.
  818. - ---------------------------------------------------------------------
  819.  
  820. +++++++++++++++++++++++++++
  821.  
  822. >From jbobier@cybernetics.net (Jason Bobier)
  823. Date: Mon, 14 Nov 1994 09:12:45 -0500
  824. Organization: Prismatix Software
  825.  
  826.  
  827. Whoops... couple of problems with this...
  828.  
  829. In article <3a2sqr$pla@pobox.csc.fi>, asunta@convex.csc.FI (Miika Asunta) wrote:
  830. > I'm sorry this in in C, but I believe you can read it anyway.
  831. > The projet type must be 'appe' for background application (NOT
  832. > 'APPL'). In addition, set 'Only background' size option.
  833.  
  834. FBA's can have a type of 'APPL' and can be launched at anytime. If the
  835. type is 'appe' they will be put in the extensions folder and launched
  836. automatically at startup if dragged to the system folder.
  837.  
  838. > main()
  839. > {
  840. > MaxApplZone();
  841. > MoreMasters();
  842.  
  843. // Add the following
  844.    InitGraf(@qd.thePort);
  845.  
  846. > AEInstallEventHandler(kCoreEventClass,kAEQuitApplication,&myQUIT,0L,0);
  847. > idletime=-1L;
  848. > do HandleEvents();
  849. > while (!lopetus);
  850. > }
  851.  
  852. Jason
  853.  
  854. _____________________________________________________________________
  855. Jason A. Bobier
  856. Prismatix Software
  857.  
  858. Email: jbobier@cybernetics.net
  859.  
  860. "Living is easy with eyes closed..."  - The Beatles
  861.  
  862. +++++++++++++++++++++++++++
  863.  
  864. >From jbobier@cybernetics.net (Jason Bobier)
  865. Date: Mon, 14 Nov 1994 09:26:44 -0500
  866. Organization: Prismatix Software
  867.  
  868. In article <jbobier-1411940912450001@bobier.cybernetics.net>,
  869. jbobier@cybernetics.net (Jason Bobier) wrote:
  870.  
  871. > Whoops... couple of problems with this...
  872. Whoops... Late night with Macsbug...
  873.  
  874. > > main()
  875. > > {
  876. > > MaxApplZone();
  877. > > MoreMasters();
  878.  
  879. // What I said
  880. > // Add the following
  881. >    InitGraf(@qd.thePort);
  882.  
  883. // What I meant
  884.    InitGraf(&qd.thePort);
  885. > > 
  886. > > AEInstallEventHandler(kCoreEventClass,kAEQuitApplication,&myQUIT,0L,0);
  887. > > 
  888. > > idletime=-1L;
  889. > > 
  890. > > do HandleEvents();
  891. > > while (!lopetus);
  892. > > }
  893.  
  894. Sorry,
  895.  
  896. Jason
  897.  
  898. _____________________________________________________________________
  899. Jason A. Bobier
  900. Prismatix Software
  901.  
  902. Email: jbobier@cybernetics.net
  903.  
  904. "Living is easy with eyes closed..."  - The Beatles
  905.  
  906. +++++++++++++++++++++++++++
  907.  
  908. >From here@there (Somone)
  909. Date: 17 Nov 1994 01:10:52 GMT
  910. Organization: Large Fuzzy Room
  911.  
  912. Here.  The Rez code and the C code to make the simplest possbile FBA.
  913. I took all the comments out so it wouldn't take much space in a posting, if
  914. you need parts of this explained *please* do your research and pull an FBA
  915. sample off summex or somewhere.
  916.  
  917. /* rez data */
  918. resource 'SIZE' (-1) {
  919.     reserved,
  920.     acceptSuspendResumeEvents,
  921.     reserved,
  922.     canBackground,
  923.     notMultiFinderAware,
  924.     onlyBackground,
  925.     dontGetFrontClicks,
  926.     ignoreChildDiedEvents,
  927.     not32BitCompatible,
  928.     isHighLevelEventAware,
  929.     localAndRemoteHLEvents,
  930.     notStationeryAware,
  931.     dontUseTextEditServices,
  932.     reserved,
  933.     reserved,
  934.     reserved,
  935.     50000,
  936.     50000
  937. };
  938.  
  939. /* C code */
  940. #include <Events.h>
  941. #include <AppleEvents.h>
  942. #include <QuickDraw.h>
  943. #include <GestaltEqu.h>
  944. #include <SegLoad.h>
  945. struct AEinstalls {
  946.     AEEventClass theClass;
  947.     AEEventID theEvent;
  948.     EventHandlerProcPtr theProc;
  949. };
  950. typedef struct AEinstalls AEinstalls;
  951.  
  952. Boolean gQuit = false;
  953. EventRecord ERecord;
  954. Boolean gHasAppleEvents;
  955.  
  956. main()
  957. {
  958.     InitGraf((Ptr)&qd.thePort);   
  959.      InitAEStuff();
  960.     while (gQuit == false) {
  961.         WaitNextEvent(highLevelEventMask, &ERecord, 30, 0);
  962.         if (ERecord.what == kHighLevelEvent)
  963.             DoHighLevel(&ERecord);
  964.     }
  965. }
  966.  
  967. void InitAEStuff(void)
  968. {
  969.     AEinstalls HandlersToInstall[] =  {
  970.          {
  971.             kCoreEventClass, kAEOpenApplication, AEOpenHandler
  972.         },  {
  973.             kCoreEventClass, kAEOpenDocuments, AEOpenDocHandler
  974.         },  {
  975.             kCoreEventClass, kAEQuitApplication, AEQuitHandler
  976.         },  {
  977.             kCoreEventClass, kAEPrintDocuments, AEPrintHandler
  978.         }, 
  979.     
  980.         
  981.     };
  982.     
  983.     OSErr aevtErr = noErr;
  984.     long aLong = 0;
  985.     Boolean gHasAppleEvents = false;
  986.     gHasAppleEvents = (Gestalt(gestaltAppleEventsAttr, &aLong) == noErr);
  987.     if (gHasAppleEvents) {
  988.         register qq;
  989.         for (qq = 0; qq < ((sizeof(HandlersToInstall) /
  990. sizeof(AEinstalls))); qq++) {
  991.             aevtErr = AEInstallEventHandler(HandlersToInstall[qq].theClass,
  992. HandlersToInstall[qq].theEvent,
  993.                                             HandlersToInstall[qq].theProc,
  994. 0, false);
  995.             if (aevtErr) {
  996.                 ExitToShell();                              /* just fail,
  997. baby */
  998.             }
  999.         }
  1000.     } else {
  1001.         ExitToShell();
  1002.     }
  1003. }
  1004.  
  1005. void DoHighLevel(EventRecord *AERecord)
  1006. {
  1007.     AEProcessAppleEvent(AERecord);
  1008.     
  1009. }
  1010.  
  1011. pascal OSErr AEOpenHandler(AppleEvent *messagein, AppleEvent *reply, long
  1012. refIn)
  1013. {
  1014. #pragma unused (messagein,reply,refIn)
  1015.     return(noErr);
  1016. }
  1017. pascal OSErr AEOpenDocHandler(AppleEvent *messagein, AppleEvent *reply,
  1018. long refIn)
  1019. {
  1020. #pragma unused (reply, refIn,messagein)
  1021.     return(errAEEventNotHandled);
  1022. }
  1023.  
  1024. pascal OSErr AEPrintHandler(AppleEvent *messagein, AppleEvent *reply, long
  1025. refIn)
  1026. {
  1027. #pragma unused (reply,refIn,messagein)
  1028.     return(errAEEventNotHandled);
  1029. }
  1030.  
  1031. pascal OSErr AEQuitHandler(AppleEvent *messagein, AppleEvent *reply, long
  1032. refIn)
  1033. {
  1034. #pragma unused (messagein,refIn,reply)
  1035.     gQuit = true;
  1036.     return(noErr);
  1037.  
  1038. ---------------------------
  1039.  
  1040. >From euajgo@eua.ericsson.se (Joakim Grebeno)
  1041. Subject: Call PostEvent() from a TimeMgr task!
  1042. Date: 9 Nov 1994 15:38:47 GMT
  1043. Organization: Ellemtel Telecom Systems Labs, Stockholm, Sweden
  1044.  
  1045. Hi!
  1046. Would it actually be possible to do a PostEvent() from a task
  1047. (interrupt) triggered by the TimeManager, or is it forbidden?
  1048.  
  1049. I would like to:
  1050.  
  1051. 1. Setup an action to be executed at a later stage i.e. using
  1052.    InsTime() passing it a pointer to a function called A.
  1053.  
  1054. 2. When the timed action is due to be executed it passes the
  1055.    pointer to A to the main event loop using PostEvent() ['app1Evt'].
  1056.  
  1057. 3. The main event loop receives the event 'app1Evt' and calls
  1058.    function A contained in the event.
  1059.  
  1060. Would this actually be possible?
  1061.  
  1062. Thanks Joakim
  1063. -- 
  1064. A: Look! It's a blast-furnace!
  1065. B: It's a tree branch!
  1066. A: OK! I can see that now!
  1067.  
  1068. +++++++++++++++++++++++++++
  1069.  
  1070. >From Glenn L. Austin <glenn_a@efn.org>
  1071. Date: Thu, 10 Nov 1994 17:25:00 GMT
  1072. Organization: Eugene FreeNet
  1073.  
  1074. In article <39qqe7$mbp@euas20.eua.ericsson.se> Joakim Grebeno,
  1075. euajgo@eua.ericsson.se writes:
  1076. >Would it actually be possible to do a PostEvent() from a task
  1077. >(interrupt) triggered by the TimeManager, or is it forbidden?
  1078.  
  1079. PostEvent doesn't move memory, so as long as your time manager routine
  1080. doesn't move memory (a big no-no), yes, you could post an event.
  1081. //
  1082. // Glenn L. Austin
  1083. // Computer Wizard and Racing Car Driver
  1084. // Internet:  glenn_a@efn.org
  1085. //
  1086.  
  1087. +++++++++++++++++++++++++++
  1088.  
  1089. >From euajgo@eua.ericsson.se (Joakim Grebeno)
  1090. Date: 11 Nov 1994 08:14:04 GMT
  1091. Organization: Ellemtel Telecom Systems Labs, Stockholm, Sweden
  1092.  
  1093. Glenn L. Austin <glenn_a@efn.org> writes:
  1094.  
  1095. >In article <39qqe7$mbp@euas20.eua.ericsson.se> Joakim Grebeno,
  1096. >euajgo@eua.ericsson.se writes:
  1097. >>Would it actually be possible to do a PostEvent() from a task
  1098. >>(interrupt) triggered by the TimeManager, or is it forbidden?
  1099.  
  1100. >PostEvent doesn't move memory, so as long as your time manager routine
  1101. >doesn't move memory (a big no-no), yes, you could post an event.
  1102.  
  1103. Thanks! That's one problem out of the way! Furthermore I suppose that I
  1104. have to setup the my applications A5 world in the task before doing a
  1105. PostEvent()?
  1106. If this is the case I'm forced to pass two parameters to the TimeManager
  1107. task i.e the current A5 *and* the pointer to the function I want to post to
  1108. the main event loop. Could this really be done?
  1109.  
  1110. Thanks
  1111. Joakim
  1112.  
  1113. -- 
  1114. A: Look! It's a blast-furnace!
  1115. B: It's a tree branch!
  1116. A: OK! I can see that now!
  1117.  
  1118. +++++++++++++++++++++++++++
  1119.  
  1120. >From scouten@uiuc.edu (Eric Scouten)
  1121. Date: Fri, 11 Nov 1994 10:01:38 -0600
  1122. Organization: University of Illinois
  1123.  
  1124. [follow-ups redirected to comp.sys.mac.programmer.help]
  1125.  
  1126. In article <39v94c$s7h@euas20.eua.ericsson.se>, euajgo@eua.ericsson.se
  1127. (Joakim Grebeno) wrote:
  1128.  
  1129. > Thanks! That's one problem out of the way! Furthermore I suppose that I
  1130. > have to setup the my applications A5 world in the task before doing a
  1131. > PostEvent()?
  1132. > If this is the case I'm forced to pass two parameters to the TimeManager
  1133. > task i.e the current A5 *and* the pointer to the function I want to post to
  1134. > the main event loop. Could this really be done?
  1135.  
  1136. Yes, this is very easy to do. Just extend the TMTask record. You can do
  1137. something like this:
  1138.  
  1139. struct MyTMTask {
  1140.    TMTask       tm;
  1141.    long         itsA5;
  1142.    long         refCon;      // whatever your other parameter was
  1143. };
  1144.  
  1145.  
  1146. -es
  1147.  
  1148. __________________________________________________________________________
  1149. Eric Scouten <scouten@uiuc.edu> * MS Comp Sci '96, Univ of Illinois
  1150.  
  1151. IMPORTANT NOTICE TO READERS: The entire physical universe, including this
  1152. message, may one day collapse back into an infinitesimally small space.
  1153. Should another universe subsequently re-emerge, the existence of this message
  1154. cannot be guaranteed.
  1155.    -with apologies to Devine & Cohen (Absolute Zero Gravity)
  1156.  
  1157. +++++++++++++++++++++++++++
  1158.  
  1159. >From reed@medicine.wustl.edu (Thomas Reed)
  1160. Date: Thu, 10 Nov 1994 10:25:25 -0600
  1161. Organization: Washington University
  1162.  
  1163. I dunno if calling PostEvent is legal or not in that case.  However, it
  1164. sounds like for what you need, a safer method might be to have your TM
  1165. task set a certain global flag, which your main event loop constantly
  1166. checks for.  When you see the flag set, you call the function.  I use just
  1167. this method to draw a picture to the screen every 5 seconds in one of my
  1168. programs, and it works quite nicely.
  1169.  
  1170. -Thomas
  1171.  
  1172. =====================================================
  1173. Thomas Reed                     Washington University
  1174. reed@telesphere.wustl.edu           Medical School
  1175. reed@medicine.wustl.edu            Saint Louis, MO
  1176. - ---------------------------------------------------
  1177. Clothes make the man.  Naked people have little or no
  1178. influence on society.  -- Mark Twain
  1179. =====================================================
  1180.  
  1181. Opinions posted are not the opinions of Wash. U.
  1182.  
  1183. +++++++++++++++++++++++++++
  1184.  
  1185. >From bdiamand@netcom.com (Ben Diamand)
  1186. Date: Wed, 16 Nov 1994 04:04:16 GMT
  1187. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1188.  
  1189. Joakim Grebeno (euajgo@eua.ericsson.se) wrote:
  1190. : Hi!
  1191. : Would it actually be possible to do a PostEvent() from a task
  1192. : (interrupt) triggered by the TimeManager, or is it forbidden?
  1193.  
  1194. : I would like to:
  1195.  
  1196. : 1. Setup an action to be executed at a later stage i.e. using
  1197. :    InsTime() passing it a pointer to a function called A.
  1198.  
  1199. : 2. When the timed action is due to be executed it passes the
  1200. :    pointer to A to the main event loop using PostEvent() ['app1Evt'].
  1201.  
  1202. : 3. The main event loop receives the event 'app1Evt' and calls
  1203. :    function A contained in the event.
  1204.  
  1205. : Would this actually be possible?
  1206.  
  1207. While PostEvent doesn't move/purge memory, the MacOS is not necessarily
  1208. re-entrant in this area(or almost any area)...In other words, for all
  1209. you know, someone else was calling PostEvent whem the timer went off
  1210. and was right in the middle of posting an event when you call PostEvent!
  1211.  
  1212. This _could_ be really bad...I'd go for the flag/post scheme, where you
  1213. flag a variable and then call PostEvent from within your main event loop...
  1214.  
  1215. Ben Diamand
  1216. bdiamand@netcom.com
  1217.  
  1218.  
  1219. +++++++++++++++++++++++++++
  1220.  
  1221. >From greg@cosc.canterbury.ac.nz (Greg Ewing)
  1222. Date: 17 Nov 1994 01:13:51 GMT
  1223. Organization: University of Canterbury, Christchurch, New Zealand
  1224.  
  1225.  
  1226. In article <bdiamandCzCDz5.4HB@netcom.com>, bdiamand@netcom.com (Ben Diamand) writes:
  1227. |> for all
  1228. |> you know, someone else was calling PostEvent whem the timer went off
  1229. |> and was right in the middle of posting an event when you call PostEvent!
  1230.  
  1231. It must surely be possible to post events at interrupt
  1232. time - else what do the mouse and keyboard interrupt
  1233. handlers do?
  1234.  
  1235. I suspect that PostEvent disables interrupts while it is
  1236. manipulating the event queue, in which case it would be
  1237. safe to call it at interrupt time.
  1238.  
  1239. But this is only a *guess* - attempt it at your own
  1240. risk!
  1241.  
  1242. |> Ben Diamand
  1243. |> bdiamand@netcom.com
  1244.  
  1245. Greg Ewing, Computer Science Dept, +--------------------------------------+
  1246. University of Canterbury,       | A citizen of NewZealandCorp, a      |
  1247. Christchurch, New Zealand       | wholly-owned subsidiary of Japan Inc.|
  1248. greg@cosc.canterbury.ac.nz       +--------------------------------------+
  1249.  
  1250. +++++++++++++++++++++++++++
  1251.  
  1252. >From pchang@Xenon.Stanford.EDU (The Weasel)
  1253. Date: 17 Nov 1994 19:46:35 GMT
  1254. Organization: Computer Science Department, Stanford University.
  1255.  
  1256. In article <3aeaof$brg@cantua.canterbury.ac.nz>,
  1257. Greg Ewing <greg@cosc.canterbury.ac.nz> wrote:
  1258. >In article <bdiamandCzCDz5.4HB@netcom.com>, bdiamand@netcom.com (Ben Diamand) writes:
  1259. >|> for all
  1260. >|> you know, someone else was calling PostEvent whem the timer went off
  1261. >|> and was right in the middle of posting an event when you call PostEvent!
  1262. >
  1263. >It must surely be possible to post events at interrupt
  1264. >time - else what do the mouse and keyboard interrupt
  1265. >handlers do?
  1266.  
  1267. It is possible to do. Check out PPostEvent. What you get back is the
  1268. eventqueue element, dequeue and enqueue turn off interrupts when
  1269. playing with the queues. I'm pretty sure that PostEvent is just doing
  1270. the same thing.
  1271.  
  1272. However, consider what event queue you are going to be slamming this
  1273. event into. I sort of missed the start of this discussion so I'm not
  1274. sure why you are putting the events in the queue, but you really need
  1275. to check to make sure which app is frontmost at the time as it is that
  1276. apps eventqueue that is going to be mucked with.
  1277.  
  1278. Peter
  1279.  
  1280.  
  1281.  
  1282.  
  1283. +++++++++++++++++++++++++++
  1284.  
  1285. >From bdiamand@netcom.com (Ben Diamand)
  1286. Date: Wed, 16 Nov 1994 04:04:16 GMT
  1287. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1288.  
  1289. Joakim Grebeno (euajgo@eua.ericsson.se) wrote:
  1290. : Hi!
  1291. : Would it actually be possible to do a PostEvent() from a task
  1292. : (interrupt) triggered by the TimeManager, or is it forbidden?
  1293.  
  1294. : I would like to:
  1295.  
  1296. : 1. Setup an action to be executed at a later stage i.e. using
  1297. :    InsTime() passing it a pointer to a function called A.
  1298.  
  1299. : 2. When the timed action is due to be executed it passes the
  1300. :    pointer to A to the main event loop using PostEvent() ['app1Evt'].
  1301.  
  1302. : 3. The main event loop receives the event 'app1Evt' and calls
  1303. :    function A contained in the event.
  1304.  
  1305. : Would this actually be possible?
  1306.  
  1307. While PostEvent doesn't move/purge memory, the MacOS is not necessarily
  1308. re-entrant in this area(or almost any area)...In other words, for all
  1309. you know, someone else was calling PostEvent whem the timer went off
  1310. and was right in the middle of posting an event when you call PostEvent!
  1311.  
  1312. This _could_ be really bad...I'd go for the flag/post scheme, where you
  1313. flag a variable and then call PostEvent from within your main event loop...
  1314.  
  1315. Ben Diamand
  1316. bdiamand@netcom.com
  1317.  
  1318.  
  1319. +++++++++++++++++++++++++++
  1320.  
  1321. >From bdiamand@netcom.com (Ben Diamand)
  1322. Date: Wed, 16 Nov 1994 04:04:16 GMT
  1323. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1324.  
  1325. Joakim Grebeno (euajgo@eua.ericsson.se) wrote:
  1326. : Hi!
  1327. : Would it actually be possible to do a PostEvent() from a task
  1328. : (interrupt) triggered by the TimeManager, or is it forbidden?
  1329.  
  1330. : I would like to:
  1331.  
  1332. : 1. Setup an action to be executed at a later stage i.e. using
  1333. :    InsTime() passing it a pointer to a function called A.
  1334.  
  1335. : 2. When the timed action is due to be executed it passes the
  1336. :    pointer to A to the main event loop using PostEvent() ['app1Evt'].
  1337.  
  1338. : 3. The main event loop receives the event 'app1Evt' and calls
  1339. :    function A contained in the event.
  1340.  
  1341. : Would this actually be possible?
  1342.  
  1343. While PostEvent doesn't move/purge memory, the MacOS is not necessarily
  1344. re-entrant in this area(or almost any area)...In other words, for all
  1345. you know, someone else was calling PostEvent whem the timer went off
  1346. and was right in the middle of posting an event when you call PostEvent!
  1347.  
  1348. This _could_ be really bad...I'd go for the flag/post scheme, where you
  1349. flag a variable and then call PostEvent from within your main event loop...
  1350.  
  1351. Ben Diamand
  1352. bdiamand@netcom.com
  1353.  
  1354.  
  1355. +++++++++++++++++++++++++++
  1356.  
  1357. >From greg@cosc.canterbury.ac.nz (Greg Ewing)
  1358. Date: 17 Nov 1994 01:13:51 GMT
  1359. Organization: University of Canterbury, Christchurch, New Zealand
  1360.  
  1361.  
  1362. In article <bdiamandCzCDz5.4HB@netcom.com>, bdiamand@netcom.com (Ben Diamand) writes:
  1363. |> for all
  1364. |> you know, someone else was calling PostEvent whem the timer went off
  1365. |> and was right in the middle of posting an event when you call PostEvent!
  1366.  
  1367. It must surely be possible to post events at interrupt
  1368. time - else what do the mouse and keyboard interrupt
  1369. handlers do?
  1370.  
  1371. I suspect that PostEvent disables interrupts while it is
  1372. manipulating the event queue, in which case it would be
  1373. safe to call it at interrupt time.
  1374.  
  1375. But this is only a *guess* - attempt it at your own
  1376. risk!
  1377.  
  1378. |> Ben Diamand
  1379. |> bdiamand@netcom.com
  1380.  
  1381. Greg Ewing, Computer Science Dept, +--------------------------------------+
  1382. University of Canterbury,       | A citizen of NewZealandCorp, a      |
  1383. Christchurch, New Zealand       | wholly-owned subsidiary of Japan Inc.|
  1384. greg@cosc.canterbury.ac.nz       +--------------------------------------+
  1385.  
  1386. +++++++++++++++++++++++++++
  1387.  
  1388. >From pchang@Xenon.Stanford.EDU (The Weasel)
  1389. Date: 17 Nov 1994 19:46:35 GMT
  1390. Organization: Computer Science Department, Stanford University.
  1391.  
  1392. In article <3aeaof$brg@cantua.canterbury.ac.nz>,
  1393. Greg Ewing <greg@cosc.canterbury.ac.nz> wrote:
  1394. >In article <bdiamandCzCDz5.4HB@netcom.com>, bdiamand@netcom.com (Ben Diamand) writes:
  1395. >|> for all
  1396. >|> you know, someone else was calling PostEvent whem the timer went off
  1397. >|> and was right in the middle of posting an event when you call PostEvent!
  1398. >
  1399. >It must surely be possible to post events at interrupt
  1400. >time - else what do the mouse and keyboard interrupt
  1401. >handlers do?
  1402.  
  1403. It is possible to do. Check out PPostEvent. What you get back is the
  1404. eventqueue element, dequeue and enqueue turn off interrupts when
  1405. playing with the queues. I'm pretty sure that PostEvent is just doing
  1406. the same thing.
  1407.  
  1408. However, consider what event queue you are going to be slamming this
  1409. event into. I sort of missed the start of this discussion so I'm not
  1410. sure why you are putting the events in the queue, but you really need
  1411. to check to make sure which app is frontmost at the time as it is that
  1412. apps eventqueue that is going to be mucked with.
  1413.  
  1414. Peter
  1415.  
  1416.  
  1417.  
  1418.  
  1419. +++++++++++++++++++++++++++
  1420.  
  1421. >From gspnx@di.unito.it (Fabrizio Oddone)
  1422. Date: Thu, 17 Nov 1994 15:42:41 +0100
  1423. Organization: Politecnico di Torino - Italy
  1424.  
  1425. In article <bdiamandCzCDz5.4HB@netcom.com>, bdiamand@netcom.com (Ben
  1426. Diamand) wrote:
  1427.  
  1428. > Joakim Grebeno (euajgo@eua.ericsson.se) wrote:
  1429. > : I would like to:
  1430. > : 1. Setup an action to be executed at a later stage i.e. using
  1431. > :    InsTime() passing it a pointer to a function called A.
  1432. > : 2. When the timed action is due to be executed it passes the
  1433. > :    pointer to A to the main event loop using PostEvent() ['app1Evt'].
  1434. > : 3. The main event loop receives the event 'app1Evt' and calls
  1435. > :    function A contained in the event.
  1436.  
  1437. Also, PostEvent() posts the event to the frontmost application, not
  1438. necessarily to your app, because there is a single event queue for all the
  1439. running apps.
  1440.  
  1441. So forget the appXEvt stuff and take a look at the Notification Manager...
  1442.  
  1443. -- 
  1444. Fabrizio Oddone
  1445. gspnx@di.unito.it
  1446.  
  1447. ---------------------------
  1448.  
  1449. >From Travis Peckham <travis@mirna.together.uvm.edu>
  1450. Subject: OSACompile and OSAExecute
  1451. Date: Thu, 17 Nov 1994 17:01:45 GMT
  1452. Organization: EMBA Computer Facility, University of Vermont
  1453.  
  1454. Hi All,
  1455.  
  1456. I was reading the comp.sys.mac.programmer FAQ (trying to get up to
  1457. speed on AppleEvents and AppleScript) 
  1458.  
  1459. I found this:
  1460.  
  1461. >5.2) Q:Can I compile and run scripts from my application?
  1462.  
  1463. >A: Yes, this is very simple. There are toolbox calls for reading
  1464. >scripts, compiling scripts and executing scripts. (OSACompile,
  1465. >OSAExecute)...
  1466.  
  1467. Does anyone know of some example source code which uses these calls 
  1468. to compile and execute an AppleScript? I'd be greatful.
  1469.  
  1470. Thanks!
  1471.  
  1472. Travis
  1473.  
  1474. +++++++++++++++++++++++++++
  1475.  
  1476. >From jeremy@dewey.soe.berkeley.edu (Jeremy Roschelle)
  1477. Date: Fri, 18 Nov 1994 09:42:05 -0800
  1478. Organization: SimCalc Project
  1479.  
  1480. In article <1994Nov17.170145.5835@emba.uvm.edu>, Travis Peckham
  1481. <travis@mirna.together.uvm.edu> wrote:
  1482.  
  1483. > Does anyone know of some example source code which uses these calls 
  1484. > to compile and execute an AppleScript? I'd be greatful.
  1485.  
  1486. here are two snippets (CodeWarrior C++) that should get you started:
  1487.  
  1488. OSErr 
  1489. SCScriptEditor::CompileScript()
  1490. {
  1491.    OSErr err;
  1492.    AEDesc   scriptText = {typeChar,nil};
  1493.    
  1494.    // get the text we want to compile
  1495.    scriptText.dataHandle = mTextEdit->GetTextHandle();
  1496.    err = ::OSACompile(GetScriptingComponent(),
  1497.                   &scriptText,
  1498.                   kOSAModeNull,
  1499.                   &mScriptID);
  1500.    mCompiledOK = (err == noErr);
  1501.    return err;
  1502. }
  1503.  
  1504. // this executes a script that was previously loaded (with the resulting ID)
  1505. void
  1506. ExecuteScript(ComponentInstance inScriptingComponent, OSAID inScriptID)
  1507. {
  1508.    OSAID       resultID;
  1509.    
  1510.   
  1511. OSAExecute(inScriptingComponent,inScriptID,kOSANullScript,kOSAModeNull,&resultID);
  1512.    OSADispose(inScriptingComponent,resultID);
  1513. }
  1514.  
  1515. The first snippet stores the script ID in the member variable mScriptID.
  1516. You would pass this ID to the Execute function.
  1517.  
  1518. // this will get you a scripting component:
  1519.  
  1520.    scriptingComponent = OpenDefaultComponent(kOSAComponentType,'scpt');
  1521.  
  1522. good luck,
  1523.  
  1524.  Jeremy Roschelle
  1525. [-------*--------] SimCalc Project
  1526. [------*-*-------] 4104 24th Street #344
  1527. [-------*--------] San Francisco CA 94114
  1528.  
  1529. +++++++++++++++++++++++++++
  1530.  
  1531. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  1532. Date: Fri, 18 Nov 1994 22:02:16 GMT
  1533. Organization: Apple Computer
  1534.  
  1535. Travis Peckham, travis@mirna.together.uvm.edu writes:
  1536. > Does anyone know of some example source code which uses these calls 
  1537. > to compile and execute an AppleScript? I'd be greatful.
  1538.  
  1539. There's a good article by Paul Smith in a recent issue of 'develop' (17?)
  1540. that illustrates this and much more. I don't know the exact issue number
  1541. offhand, but each one includes all the back issues on CD-ROM so you can find
  1542. it if you get the latest issue.
  1543.  
  1544. --Jens Alfke                           jens_alfke@powertalk.apple.com
  1545.                    "A man, a plan, a yam, a can of Spam ... Bananama!"
  1546.  
  1547. ---------------------------
  1548.  
  1549. >From ttyab@vaal.cpr.upenn.edu ()
  1550. Subject: PBCatSearch finder flags?
  1551. Date: 8 Nov 1994 21:12:16 GMT
  1552. Organization: University of Pennsylvania
  1553.  
  1554. Hi,
  1555.     I am trying to use PBCatSearch to search for files
  1556. and EXCLUDE alias files.  The search is already working with
  1557. the ioNamePtr and ioFlAttrib flags and I would like to add
  1558. whatever it takes to make the search exclude aliases.
  1559.  
  1560.     If a file is an alias, then ioFlFndrInfo.fdFlags will
  1561. have bit 15 set (0x8000).  Ok, well, in the CInfoPBRec search1
  1562. do I set ioFlFndrInfo.fdFlags = 0x0FFF??? (I don't care what the
  1563. other 14 bits are) and then set search2 to 0xF000?
  1564.  
  1565.     (Search2 is "the mask").  Basically I don't know how
  1566. to set the target and mask to include files with bit 15 == 0.
  1567. Can some kind soul offer a solution?  
  1568.  
  1569. THanks!
  1570. .
  1571.  
  1572.  
  1573. +++++++++++++++++++++++++++
  1574.  
  1575. >From jumplong@aol.com (Jump Long)
  1576. Date: 17 Nov 1994 03:10:07 -0500
  1577. Organization: America Online, Inc. (1-800-827-6364)
  1578.  
  1579. In article <39opjg$bfm@netnews.upenn.edu>, ttyab@vaal.cpr.upenn.edu ()
  1580. writes:
  1581.  
  1582. >Basically I don't know how to set the target and mask to include files
  1583. >with bit 15 == 0. Can some kind soul offer a solution?
  1584.  
  1585. This will do it for you.
  1586.  
  1587. /* find files with alias bit clear */
  1588. searchInfo1.hFileInfo.ioFlFndrInfo.fdFlags = 0x0000; /* match when alias
  1589. bit is clear */
  1590. searchInfo2.hFileInfo.ioFlFndrInfo.fdFlags = 0x8000; /* we're interested
  1591. only in the alias bit */
  1592.  
  1593. Make sure you clear out the rest of the finder info record in both
  1594. searchInfo1 and searchInfo2, and set the fsSBFlFndrInfo search bit.
  1595.  
  1596. - Jim Luther
  1597.  
  1598.  
  1599. ---------------------------
  1600.  
  1601. >From gg110@cus.cam.ac.uk (G. Gavazzi)
  1602. Subject: Q: SICompletionUPP
  1603. Date: 16 Nov 1994 01:30:09 GMT
  1604. Organization: University of Cambridge, England
  1605.  
  1606. hi,
  1607. I am trying to make an asynchronous sound recording (to memory)
  1608. and I cannot figure out how to pass the address of my completionRoutine
  1609. (and interruptRoutine as well). My program keeps on crashing when
  1610. it calls SPBRecord(myinParamPtr,TRUE) since I put in myinParamPtr
  1611. the routines addresses.
  1612. I use:
  1613. SICompletionUPP                mycompletionRoutine(SPBPtr);
  1614. SIInterruptUPP                myinterruptRoutine(void);    
  1615. main(){
  1616. SICompletionUPP                mycompletionRoutine(SPBPtr);
  1617. SIInterruptUPP                myinterruptRoutine(void);       
  1618. ...
  1619. myinParam.completionRoutine = (SICompletionUPP)mycompletionRoutine;
  1620. myinParam.interruptRoutine = (SIInterruptUPP)myinterruptRoutine;
  1621.  
  1622. }
  1623. SICompletionUPP    mycompletionRoutine(SPBPtr inParamPtr)
  1624. {
  1625. operations on a buffer whose pointer is passed in myinParamPtr->userLong
  1626. no return value
  1627. }
  1628. SIInterruptUPP                myinterruptRoutine(void){}
  1629. I don't need to do anything when the input device is full, I could indeed
  1630. put myinParam.interruptRoutine = 0; above.
  1631.  
  1632. If I put both routines fields in myinParam = 0 my program does not
  1633. crash, it simply does not know when it's buffer is full of data.
  1634. Can anybody point me to the (C please) solution? (yes, I am going
  1635. to buy NIM on CD if it is affordable).
  1636. Thank you,
  1637. Giuliano Gavazzi
  1638.  
  1639. +++++++++++++++++++++++++++
  1640.  
  1641. >From chris-b@cs.auckland.ac.nz (Chris Burns)
  1642. Date: Thu, 17 Nov 1994 00:40:45 +1200
  1643. Organization: AucklandUniversity:ComputerScience:HMU
  1644.  
  1645. In article <3abnb1$83j@lyra.csx.cam.ac.uk>, gg110@cus.cam.ac.uk (G.
  1646. Gavazzi) wrote:
  1647.  
  1648. > I am trying to make an asynchronous sound recording (to memory)
  1649. > and I cannot figure out how to pass the address of my completionRoutine
  1650. > (and interruptRoutine as well). My program keeps on crashing when
  1651. > it calls SPBRecord(myinParamPtr,TRUE) since I put in myinParamPtr
  1652. > the routines addresses.
  1653. > I use:
  1654. > SICompletionUPP                         mycompletionRoutine(SPBPtr);
  1655. > SIInterruptUPP                          myinterruptRoutine(void);       
  1656. > main(){
  1657. > SICompletionUPP                         mycompletionRoutine(SPBPtr);
  1658. > SIInterruptUPP                          myinterruptRoutine(void);       
  1659. > ...
  1660. > myinParam.completionRoutine = (SICompletionUPP)mycompletionRoutine;
  1661. > myinParam.interruptRoutine = (SIInterruptUPP)myinterruptRoutine;
  1662. > }
  1663. > SICompletionUPP mycompletionRoutine(SPBPtr inParamPtr)
  1664. > {
  1665. > operations on a buffer whose pointer is passed in myinParamPtr->userLong
  1666. > no return value
  1667. > }
  1668. > SIInterruptUPP                          myinterruptRoutine(void){}
  1669. > I don't need to do anything when the input device is full, I could indeed
  1670. > put myinParam.interruptRoutine = 0; above.
  1671. > If I put both routines fields in myinParam = 0 my program does not
  1672. > crash, it simply does not know when it's buffer is full of data.
  1673.  
  1674.  
  1675.  
  1676.  
  1677. Here's some code I whipped up the other day to do almost exactly this:
  1678. The    #pragma parameter    bit was necessary to tell the 68K compiler
  1679. where the parameters are stashed on entry in 68K mode.
  1680.  
  1681. ///////////////////////////////////////////////////////////////////////////////
  1682. // Chris Burns 1994
  1683. ///////////////////////////////////////////////////////////////////////////////
  1684.  
  1685. #include <SoundInput.h>
  1686.  
  1687. static Boolean FailOSErr(OSErr ErrNum,Str255 ErrMsgStr);
  1688. static pascal void MyInterruptProc (SPBPtr PB,Ptr DataBuffer,short
  1689. PeakAmplitude,long SampleSize);
  1690.  
  1691. ///////////////////////////////////////////////////////////////////////////////
  1692.  
  1693. static Boolean FailOSErr(OSErr ErrNum,Str255 ErrMsgStr)
  1694. {
  1695.     if (ErrNum != noErr)
  1696.     {
  1697.     Str255          ErrStr;
  1698.     short           ErrMsgBytes;
  1699.     short           Extra;
  1700.  
  1701.         NumToString(ErrNum,ErrStr);
  1702.  
  1703.         ErrMsgBytes = ErrMsgStr[0];
  1704.         Extra = 0;
  1705.         if ((ErrMsgBytes + 1 + ErrStr[0] + 1) > 255)
  1706.         {
  1707.             ErrMsgBytes = 255 - (2 + ErrStr[0] + 1);
  1708.             ErrStr[1 + ErrStr[0] + 1] = 'ä';
  1709.             Extra = 1;
  1710.         }
  1711.  
  1712.         BlockMove(&ErrStr[1],&ErrStr[1 + ErrMsgBytes + Extra + 1],ErrStr[0]);
  1713.         BlockMove(&ErrMsgStr[1],&ErrStr[1],ErrMsgBytes);
  1714.  
  1715.         ErrStr[ErrMsgBytes + 1 + Extra] = '[';
  1716.         ErrStr[ErrMsgBytes + Extra + 1 + ErrStr[0] + 1] = ']';
  1717.         ErrStr[0] = ErrMsgBytes + Extra + 1 + ErrStr[0] + 1;
  1718.  
  1719.         DebugStr(ErrStr);
  1720.         return(true);
  1721.     }
  1722.     return(false);
  1723. }
  1724.  
  1725. ///////////////////////////////////////////////////////////////////////////////
  1726.  
  1727. #if !USESROUTINEDESCRIPTORS
  1728. #pragma parameter MyInterruptProc(__A0,__A1,__D0,__D1)
  1729. #endif
  1730.  
  1731. static pascal void MyInterruptProc (SPBPtr PB,Ptr DataBuffer,short
  1732. PeakAmplitude,long SampleSize)
  1733. {
  1734. #if !USESROUTINEDESCRIPTORS
  1735. long    SavedA5 = SetA5((*PB).userLong);
  1736. #endif
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743. #if !USESROUTINEDESCRIPTORS
  1744.     SetA5(SavedA5);
  1745. #endif
  1746. }
  1747.  
  1748. ///////////////////////////////////////////////////////////////////////////////
  1749.  
  1750. void main (void)
  1751. {
  1752. OSErr               Err;
  1753. long                SIRefNum;
  1754. UniversalProcPtr    MyInterruptProcUPP = NewSIInterruptProc(MyInterruptProc);
  1755. SPB                 PB;
  1756. Boolean             Recording;
  1757.  
  1758.     Err = SPBOpenDevice("\p",siWritePermission,&SIRefNum);
  1759.     if (FailOSErr(Err,"\p FAILED"))
  1760.     {
  1761.     }
  1762.  
  1763. // Set up recording parameters (rate, sample size, stereo etc) here
  1764.  
  1765.     PB.inRefNum = SIRefNum;
  1766.     PB.bufferPtr = nil;
  1767.     PB.completionRoutine = nil;
  1768.     PB.interruptRoutine = MyInterruptProcUPP;
  1769.  
  1770. #if !USESROUTINEDESCRIPTORS
  1771.     PB.userLong = SetCurrentA5();
  1772. #endif
  1773.  
  1774.     Err = SPBRecord((SPBPtr)&PB,true);
  1775.     if (FailOSErr(Err,"\p FAILED"))
  1776.     {
  1777.     }
  1778.  
  1779.     Recording = true;
  1780.  
  1781.     while (Recording)
  1782.     {
  1783.         Recording = !Button();
  1784.     }
  1785.  
  1786.     Err = SPBStopRecording(SIRefNum);
  1787.     if (FailOSErr(Err,"\p FAILED"))
  1788.     {
  1789.     }
  1790.  
  1791.     Err = SPBCloseDevice(SIRefNum);
  1792.     if (FailOSErr(Err,"\p FAILED"))
  1793.     {
  1794.     }
  1795.  
  1796. #if USESROUTINEDESCRIPTORS
  1797.     DisposeRoutineDescriptor(MyInterruptProcUPP);
  1798. #endif
  1799. }
  1800.  
  1801. ///////////////////////////////////////////////////////////////////////////////
  1802.  
  1803. Chris B
  1804. - ---------------------------------------------------------------------
  1805. NewZealand:AucklandUniversity:ComputerScience:HyperMediaUnit:ChrisBurns
  1806. Internet: chris-b@cs.auckland.ac.nz
  1807. Phone:    +64 9 373-7599 x6194
  1808. Fax:      +64 9 373-7453                         Async, therefore I am.
  1809. - ---------------------------------------------------------------------
  1810.  
  1811. ---------------------------
  1812.  
  1813. End of C.S.M.P. Digest
  1814. **********************
  1815.  
  1816.  
  1817.