home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Information / CSMP Digest / volume 3 / csmp-digest-v3-071 < prev    next >
Encoding:
Text File  |  1995-06-07  |  44.9 KB  |  1,290 lines  |  [TEXT/R*ch]

  1. Received-Date: Mon, 28 Nov 1994 18:41:32 +0100
  2. From: pottier@clipper.ens.fr (Francois Pottier)
  3. Subject: csmp-digest-v3-071
  4. To: csmp-digest@ens.fr
  5. Date: Mon, 28 Nov 1994 18:41:24 +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: 77
  13.  
  14. C.S.M.P. Digest             Mon, 28 Nov 94       Volume 3 : Issue 71
  15.  
  16. Today's Topics:
  17.  
  18.         (PPC) MDEF's in application code
  19.         Getting The PSN or Sig of AE Client
  20.         Is THINK Pascal dead?
  21.         Newbie Q:Why no DisposeHandle-ReleaseResource call?
  22.         Prograph 2.5
  23.         [Q] Programming with the QuickTime toolkit
  24.  
  25.  
  26.  
  27. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  28. (pottier@clipper.ens.fr).
  29.  
  30. The digest is a collection of article threads from the internet newsgroup
  31. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  32. regularly and want an archive of the discussions.  If you don't know what a
  33. newsgroup is, you probably don't have access to it.  Ask your systems
  34. administrator(s) for details.  If you don't have access to news, you may
  35. still be able to post messages to the group by using a mail server like
  36. anon.penet.fi (mail help@anon.penet.fi for more information).
  37.  
  38. Each issue of the digest contains one or more sets of articles (called
  39. threads), with each set corresponding to a 'discussion' of a particular
  40. subject.  The articles are not edited; all articles included in this digest
  41. are in their original posted form (as received by our news server at
  42. nef.ens.fr).  Article threads are not added to the digest until the last
  43. article added to the thread is at least two weeks old (this is to ensure that
  44. the thread is dead before adding it to the digest).  Article threads that
  45. consist of only one message are generally not included in the digest.
  46.  
  47. The digest is officially distributed by two means, by email and ftp.
  48.  
  49. If you want to receive the digest by mail, send email to listserv@ens.fr
  50. with no subject and one of the following commands as body:
  51.     help                        Sends you a summary of commands
  52.     subscribe csmp-digest Your Name    Adds you to the mailing list
  53.     signoff csmp-digest            Removes you from the list
  54. Once you have subscribed, you will automatically receive each new
  55. issue as it is created.
  56.  
  57. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  58. Questions related to the ftp site should be directed to
  59. scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
  60. digest are available there.
  61.  
  62. Also, the digests are available to WAIS users.  To search back issues
  63. with WAIS, use comp.sys.mac.programmer.src. With Mosaic, use
  64. http://www.wais.com/wais-dbs/comp.sys.mac.programmer.html.
  65.  
  66.  
  67. -------------------------------------------------------
  68.  
  69. >From tcarsten@cayman.jpmorgan.com (Tom Carstensen)
  70. Subject: (PPC) MDEF's in application code
  71. Date: 25 Oct 1994 16:25:54 GMT
  72. Organization: J.P. Morgan & Co
  73.  
  74.  
  75. Before PPC, I would load a stub 'MDEF' and set the proc ptr:
  76.  
  77. typedef struct GenericMDEF {
  78.     short        JMPInstruction;
  79.     void        *defProc;
  80. } GenericMDEF;
  81.  
  82.    mdefHdl = GetResource('MDEF', 200);        /* sub def */
  83.    
  84.     (**((GenericMDEF **) mdefHdl)).defProc = myMdefProc;
  85.  
  86.  
  87. NOW, with PPC, I'm doing:
  88.  
  89.     (**((GenericMDEF **) mdefHdl)).defProc = NewMenuDefProc(myMdefProc);
  90.  
  91. which, with code warrior, creates a new routine descriptor, and sets it up
  92. appropriately.
  93.  
  94. This does not work.  I've read IM PowerPC System Software - but it's 
  95. somewhat confusing.  If I'm defining an accelerated resource, than I need
  96. a routine descriptor that tells what kind of code is ahead.  I thought
  97. the above should work, assuming the menu manager uses CallUniversalProc
  98. to call the menu definition procedure.
  99.  
  100. BTW - I'm using Code warrior in the above example.
  101.  
  102. Thanks for any hints.
  103.  
  104. Tom Carstensen
  105. --
  106. --                    ___
  107. Thomas Carstensen          //__/  60 Wall Street  17th Floor
  108.   tcarsten@jpmorgan.com      /__//      New York, NY  10260
  109.   tomc@digex.access.net      Morgan     212.648.4584
  110.  
  111. +++++++++++++++++++++++++++
  112.  
  113. >From d88-bli@xbyse.nada.kth.se (Bo Lindbergh)
  114. Date: 31 Oct 1994 16:31:38 GMT
  115. Organization: Royal Institute of Technology, Stockholm, Sweden
  116.  
  117. In article <TCARSTEN.94Oct25122554@cayman.jpmorgan.com> tcarsten@cayman.jpmorgan.com (Tom Carstensen) writes:
  118.  
  119. [mostly correct example of stub MDEF hacking deleted]
  120.  
  121. Try bracketing the struct definition with alignment pragmas:
  122.  
  123.     #if defined(powerc) || defined (__powerc)
  124.     #pragma options align=mac68k
  125.     #endif
  126.  
  127.     typedef struct GenericMDEF {
  128.         short       JMPInstruction;
  129.         void        *defProc;
  130.     } GenericMDEF;
  131.  
  132.     #if defined(powerc) || defined(__powerc)
  133.     #pragma options align=reset
  134.     #endif
  135.  
  136. Without them, you'll get two bytes of padding between the short and the
  137. void *.
  138.  
  139.  
  140. /Bo Lindbergh
  141.  
  142. +++++++++++++++++++++++++++
  143.  
  144. >From Graham@impro.demon.co.uk (Graham)
  145. Date: Wed, 9 Nov 1994 17:02:12 GMT
  146. Organization: N/A
  147.  
  148. I use the following routines to do this- on 68K macs it defaults to the
  149. old way of creating a stub for the jump, on PowerMacs it creates a
  150. routine dscriptor, so the same code works in all cases. try it.
  151.  
  152. #include    "MixedMode.h"
  153.  
  154. typedef struct
  155. {
  156.    short   Jmp;            // jmp instruction
  157.    void*   Routine;        // address to jump to
  158. }
  159. JmpInstructionTemplate;
  160.  
  161.  
  162. Handle    GetUniversalFunctionHandle(ProcPtr functionAddress,ProcInfoType
  163. pInfo);
  164. void     PatchJmpInstruction(void* patchAddress, void* jumpAddress);
  165.  
  166.  
  167.  
  168. Handle    GetUniversalFunctionHandle(ProcPtr functionAddress,ProcInfoType
  169. pInfo)
  170. {
  171.     Handle                pHNullProc = NULL;
  172.     ISAType                isa;
  173.     UniversalProcPtr     axDEFUPP;
  174.     
  175.     isa = GetCurrentISA();
  176.     
  177.     if (isa == kPowerPCISA)
  178.     {
  179.        pHNullProc = NewHandle(sizeof(RoutineDescriptor));
  180.        axDEFUPP = NewRoutineDescriptor(functionAddress,pInfo,isa);
  181.        BlockMove(axDEFUPP, *pHNullProc, sizeof(RoutineDescriptor));
  182.        DisposeRoutineDescriptor(axDEFUPP);
  183.     }
  184.     else
  185.     {
  186.        pHNullProc = NewHandle(sizeof(JmpInstructionTemplate));
  187.        PatchJmpInstruction(*pHNullProc, (void*)functionAddress);
  188.     }
  189.     return(pHNullProc);
  190. }
  191.  
  192.  
  193. void PatchJmpInstruction(void* patchAddress, void* jumpAddress)
  194. {
  195.    JmpInstructionTemplate* aJmpInstructionPtr;
  196.    
  197.    aJmpInstructionPtr = (JmpInstructionTemplate *) patchAddress;
  198.    aJmpInstructionPtr->Jmp = 0x4EF9;
  199.    aJmpInstructionPtr->Routine = jumpAddress;
  200. }
  201.  
  202.  
  203. You have to pass the proc info type for the routine, which youll have
  204. to look up in the universal headers, and the proc ptr to your MDEF
  205. function, it returns a handle which you simply stuff into the relevant
  206. defProc field.
  207. Apple DTS gave me the bones for this, so it even has the "official"
  208. stamp of approval!
  209.  
  210. ************************************************************************
  211. *
  212. MHROTD, Graham.  (Sorry, I haven't got time to think of
  213.                                        a witty signature)
  214.  
  215. +++++++++++++++++++++++++++
  216.  
  217. >From rang@winternet.com (Anton Rang)
  218. Date: 10 Nov 1994 14:33:59 GMT
  219. Organization: Trillium Research, Inc.
  220.  
  221. In article <Cz0FBo.FvL@demon.co.uk> Graham@impro.demon.co.uk (Graham) writes:
  222. >I use the following routines to do this- on 68K macs it defaults to the
  223. >old way of creating a stub for the jump, [...]
  224.  
  225.   Don't forget the posting last month from someone who had created a
  226. six-byte handle to hold their 'JMP $xxx' instruction and found that
  227. when the handle was moved by the memory manager, the i-cache wasn't
  228. flushed 'cause the handle was too small.  :)
  229. --
  230. Anton Rang (rang@winternet.com)
  231.  
  232. +++++++++++++++++++++++++++
  233.  
  234. >From Bruce@hoult.actrix.gen.nz (Bruce Hoult)
  235. Date: Fri, 11 Nov 1994 05:15:43 +1200 (NZST)
  236. Organization: (none)
  237.  
  238. rang@winternet.com (Anton Rang) writes:
  239. > In article <Cz0FBo.FvL@demon.co.uk> Graham@impro.demon.co.uk (Graham) writes:
  240. > >I use the following routines to do this- on 68K macs it defaults to the
  241. > >old way of creating a stub for the jump, [...]
  242. >   Don't forget the posting last month from someone who had created a
  243. > six-byte handle to hold their 'JMP $xxx' instruction and found that
  244. > when the handle was moved by the memory manager, the i-cache wasn't
  245. > flushed 'cause the handle was too small.  :)
  246.  
  247. I missed that one.
  248.  
  249. But I've never understood why people use the "six-byte resource" trick
  250. when it's so easy to use a "ten-byte resource" trick that is I-cache
  251. safe.
  252.  
  253. -- Bruce
  254.  
  255. ---------------------------
  256.  
  257. >From Jonathan Gary <jgary@ssd.kodak.com>
  258. Subject: Getting The PSN or Sig of AE Client
  259. Date: Tue, 8 Nov 1994 19:59:50 GMT
  260. Organization: Eastman Kodak
  261.  
  262. I'm trying to get the the PSN of the process that sends me an AE. I can
  263. get the
  264. address from the event, but how do I get at the PSN?
  265.  
  266. +++++++++++++++++++++++++++
  267.  
  268. >From wysocki@netcom.com (Chris Wysocki)
  269. Date: Fri, 11 Nov 1994 06:52:40 GMT
  270. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  271.  
  272. In article <Cyysvr.2yK@newsserver.pixel.kodak.com>,
  273. Jonathan Gary  <jgary@ssd.kodak.com> wrote:
  274.  
  275. >I'm trying to get the the PSN of the process that sends me an AE. I can
  276. >get the address from the event, but how do I get at the PSN?
  277.  
  278. The following routine should work:
  279.  
  280. // ----------------------------------------------------------------------
  281. // CAppleEvent::GetProcessSerialNumber
  282. // ----------------------------------------------------------------------
  283.  
  284. void CAppleEvent::GetProcessSerialNumber(ProcessSerialNumber& thePSN) const
  285. {
  286.     DescType actualType;
  287.     Size actualSize;
  288.     TargetID theTargetID;
  289.     
  290.     FailOSErr(AEGetAttributePtr(&fMessage, keyAddressAttr, typeTargetID,
  291.               &actualType, &theTargetID, sizeof(theTargetID), &actualSize));
  292.     FailOSErr(GetProcessSerialNumberFromPortName(&theTargetID.name, &thePSN));
  293. }
  294.  
  295. I believe that the sending process needs to be running on the same
  296. machine as the target process for this to work, since PSNs are only
  297. unique to a particular machine.
  298.  
  299. Chris.
  300.  
  301.  
  302.  
  303. ---------------------------
  304.  
  305. >From bernier@dialup.francenet.fr (Jean-Yves Bernier)
  306. Subject: Is THINK Pascal dead?
  307. Date: Fri, 04 Nov 1994 11:14:55 +0100
  308. Organization: SPECTRA Soft
  309.  
  310.  
  311. Excuse-me if the topic has already been discussed here (I am a newcomer)
  312. but I have see no such thing in the 100 last articles, and I could not
  313. figure a more suitable group.
  314.  
  315. I am one of the many THINK Pascal users left in the dark by Symantec, after
  316. the PowerPC. I have thousand of lines of Pascal to port to the PowerPC and
  317. I don't want to loose the advantages of THINK Pascal (the wonderful
  318. source-level debugger, among others).
  319.  
  320. What is the official status of THINK Pascal? Will ever exist a PowerPC
  321. version? Is it dead? I am a registered user, but I receive absolutely no
  322. information from Symantec. Have they e-mail support?
  323.  
  324. Thanks.
  325.  
  326.  
  327.  
  328. - -------------------------
  329. Jean-Yves Bernier - SPECTRA
  330. bernier@dialup.francenet.fr
  331. - -------------------------
  332.  
  333.  
  334. +++++++++++++++++++++++++++
  335.  
  336. >From nick+@pitt.edu ( nick.c )
  337. Date: Fri, 04 Nov 1994 10:49:30 -0500
  338. Organization: The Pitt, Chemistry
  339.  
  340.  
  341.    Yes, very dead.  I would not expect any udates or new versions.
  342.      That said a lot of folks still use it.  It should be possible to
  343.      port your code to CodeWarrrior Pascal (one of the compilers 
  344.      included with the CodeWarrior Gold or Bronze CD).  The Gold
  345.      version runs native (fat - I think) and compiles for PPC.
  346.  
  347.  
  348.  Internet: nick+@pitt.edu            _/   _/  _/  _/_/_/   _/   _/  
  349.    eWorld: nick                     _/_/ _/  _/  _/   _/  _/_/_/ 
  350.       CIS: 71232,766               _/ _/_/  _/  _/       _/ _/    
  351.      http://www.pitt.edu/~nick/   _/   _/  _/   _/_/_/  _/   _/     
  352.                     
  353.  
  354. +++++++++++++++++++++++++++
  355.  
  356. >From lbotez@picard.cs.wisc.edu (Lynda Botez)
  357. Date: 6 Nov 1994 17:36:45 GMT
  358. Organization: U of Wisconsin CS Dept
  359.  
  360. Er, Think Pascal isn't really dead, it's just comatose.
  361.  
  362. If you need to convert stuff over to the powerpc, though, I would suggest
  363. you look into CodeWarrior. They actually have a pascal powerpc compiler
  364. (its in beta, but I would imagine it works pretty good)... and I doubt
  365. Symantec will bother with Think Pascal.  
  366.  
  367. Also, I think most of the programmers that developed Think Pascal are now
  368. working for Metrowerks (the company that owns CodeWarrior); so you can
  369. imagine that Think Pascal is not long for this world..
  370.  
  371.  
  372. +++++++++++++++++++++++++++
  373.  
  374. >From johnmce@world.std.com (John McEnerney)
  375. Date: Sun, 6 Nov 1994 19:11:16 GMT
  376. Organization: The World Public Access UNIX, Brookline, MA
  377.  
  378. lbotez@picard.cs.wisc.edu (Lynda Botez) writes:
  379.  
  380. >Also, I think most of the programmers that developed Think Pascal are now
  381. >working for Metrowerks (the company that owns CodeWarrior); so you can
  382. >imagine that Think Pascal is not long for this world..
  383.  
  384. For anyone who's interested, the programmers who developed THINK Pascal are:
  385.  
  386. Me (at Metrowerks these days)
  387. David Neal (director of Symantec's Mac language group)
  388. Rich Siegel (of Bare Bones software fame)
  389. Pete Maruhnic (author of CA's Realizer for Windows)
  390.  
  391. So only one of us ended up at Metrowerks. Still, the product is pretty 
  392. much dead wrt PowerPC, as much my fault as anyone else's: a lot of the 
  393. code was written in assembly language, the context-switch mechanism would 
  394. probably not survive a port to the PPC, etc. It is rumored that Symantec 
  395. still has plans in the Pascal arena (but as you might imagine they don't 
  396. tell me that sort of thing anymore)
  397.  
  398. -- John McEnerney, Metrowerks PowerPC Product Architect
  399.  
  400.  
  401. +++++++++++++++++++++++++++
  402.  
  403. >From RobTerrell@vmedia.com (Rob Terrell)
  404. Date: 6 Nov 1994 21:26:52 GMT
  405. Organization: Jecta Development Corp.
  406.  
  407. John McEnerney said:
  408. > So only one of us ended up at Metrowerks. Still, the product is pretty
  409. > much dead wrt PowerPC, as much my fault as anyone else's: a lot of the
  410. > code was written in assembly language, the context-switch mechanism
  411. > would probably not survive a port to the PPC, etc. It is rumored that
  412. > Symantec still has plans in the Pascal arena (but as you might imagine
  413. > they don't tell me that sort of thing anymore)
  414.  
  415. Yeah, there was a rumor in MacWeek regarding this. I doubt it. The
  416. Symantec folks were real arrogant on the topic of the death of Pascal
  417. at the WWDC.
  418.  
  419. So, John, what's happening with Metrowerks' Pascal? I would totally
  420. abandon Think Pascal if CW supported an Object Pascal.
  421.  
  422.  
  423. Rob
  424.  
  425. +++++++++++++++++++++++++++
  426.  
  427. >From siegel@netcom.com (Rich Siegel)
  428. Date: Mon, 7 Nov 1994 17:57:38 GMT
  429. Organization: Bare Bones Software
  430.  
  431. In article <39j47d$gfq@spool.cs.wisc.edu> lbotez@picard.cs.wisc.edu (Lynda Botez) writes:
  432. >
  433. >Also, I think most of the programmers that developed Think Pascal are now
  434. >working for Metrowerks (the company that owns CodeWarrior); so you can
  435. >imagine that Think Pascal is not long for this world..
  436. >
  437.  
  438. That is not true.
  439.  
  440. Of the four people most directly involved in the development of THINK Pascal:
  441.  
  442. - one is at Metrowerks
  443. - one is director of the development tools group at Symantec
  444. - one is off doing something else (I don't recall where)
  445. - one is president and CEO of his own software company
  446.  
  447. When this question was recently posted to Symantec personnel at a
  448. recent BCS MacTechGroup meeting, the response was (basically) that
  449. they plan to work with certain third-party compiler makers to produce
  450. a Pascal solution for Rainbow (their new development environment that
  451. is currently under development).
  452.  
  453. R.
  454. -- 
  455. Rich Siegel % siegel@netcom.com    % President & CEO, Bare Bones Software Inc.
  456. --> For information about BBEdit, finger bbedit@world.std.com <--
  457.  
  458. +++++++++++++++++++++++++++
  459.  
  460. >From peter.lewis@info.curtin.edu.au (Peter N Lewis)
  461. Date: Tue, 08 Nov 1994 11:23:59 +0800
  462. Organization: NCRPDA, Curtin University
  463.  
  464. In article <39jhms$ja@redstone.interpath.net>, RobTerrell@vmedia.com (Rob
  465. Terrell) wrote:
  466.  
  467. >Yeah, there was a rumor in MacWeek regarding this. I doubt it. The
  468. >Symantec folks were real arrogant on the topic of the death of Pascal
  469. >at the WWDC.
  470.  
  471. A Symantec fellow told me that the rumour is crap.  There is no Symantec
  472. plans for a PPC pascal compiler.
  473.  
  474. >So, John, what's happening with Metrowerks' Pascal? I would totally
  475. >abandon Think Pascal if CW supported an Object Pascal.
  476.  
  477. You and me both.  I'm strugling on with THINK Pascal waiting for objects
  478. to show up in MW Pascal.  MW Pascal is scheduled to go 1.0 without objects
  479. in January (CW5), and MW Object Pascal is scheduled for CW6 in May (it
  480. better be there, otherwise Greg will have to face down some heckling at
  481. the WWDC :-).
  482.  
  483. The best you can do to help is to a) make sure MW knows that Object Pascal
  484. is what you need; b) buy MW CW; c) feed any bugs back to the MW bug report
  485. line as precisely as you can.  That's what i've been doing, an Marcel has
  486. been very good at fixing bugs (such that basically every bug I have
  487. reported has been fixed by the next version).
  488.  
  489. Enjoy,
  490.    Peter.
  491. -- 
  492. Peter N Lewis <peter.lewis@info.curtin.edu.au> - Macintosh TCP fingerpainter
  493. FTP my programs from redback.cs.uwa.edu.au:Others/PeterLewis/ or
  494. amug.org:pub/peterlewis/ or nic.switch.ch:software/mac/peterlewis/
  495.  
  496. +++++++++++++++++++++++++++
  497.  
  498. >From ingemar@lysator.liu.se (Ingemar Ragnemalm)
  499. Date: 8 Nov 1994 08:17:05 GMT
  500. Organization: (none)
  501.  
  502. johnmce@world.std.com (John McEnerney) writes:
  503.  
  504. >lbotez@picard.cs.wisc.edu (Lynda Botez) writes:
  505.  
  506. >>Also, I think most of the programmers that developed Think Pascal are now
  507. >>working for Metrowerks (the company that owns CodeWarrior); so you can
  508. >>imagine that Think Pascal is not long for this world..
  509.  
  510. >For anyone who's interested, the programmers who developed THINK Pascal are:
  511.  
  512. >Me (at Metrowerks these days)
  513. >David Neal (director of Symantec's Mac language group)
  514. >Rich Siegel (of Bare Bones software fame)
  515. >Pete Maruhnic (author of CA's Realizer for Windows)
  516.  
  517. >So only one of us ended up at Metrowerks. Still, the product is pretty 
  518. >much dead wrt PowerPC, as much my fault as anyone else's: a lot of the 
  519. >code was written in assembly language, the context-switch mechanism would 
  520. >probably not survive a port to the PPC, etc.
  521.  
  522. MetroWerks Pascal is sort of ok as replacement. It doesn't have Instant,
  523. it's debugger is far from the elegance of Lightsbug, but it works.
  524.  
  525. But I wonder, why wasn't the debugger integrated with the compiler?
  526. No flames, but I really didn't think a Think Pascal decveloper would
  527. let so many Think C flaw through.
  528.  
  529. Why mimick the clumsy Think C when Think Pascal is so much better (language
  530. issues aside). Imagine a system where you step and set breakpoints in the
  531. editor, while the editor and the debugger communicated with Apple Events.
  532. I can't see the problem, as long as we don't demand Instant.
  533.  
  534. >It is rumored that Symantec 
  535. >still has plans in the Pascal arena (but as you might imagine they don't 
  536. >tell me that sort of thing anymore)
  537.  
  538. Long ago, I bought Think C. It took several years before I got any feedback
  539. - probably that was after buying Think Pascal. When Symantec now tries to
  540. convince me that I should get SC++, I bought CodeWarrior instead. Much better
  541. C environment, and a future for my Pascal code.
  542.  
  543. Fortunately, my Think Pascal isn't dead yet. I guess it will stop working
  544. somewhere between 7.5 and 8.0 or so, but not yet.
  545.  
  546. --
  547. - -
  548. Ingemar Ragnemalm, PhD
  549. Image processing, Mac shareware games
  550. E-mail address: ingemar@isy.liu.se or ingemar@lysator.liu.se
  551.  
  552. +++++++++++++++++++++++++++
  553.  
  554. >From palais@binah.cc.brandeis.edu
  555. Date: 12 Nov 1994 19:55:02 GMT
  556. Organization: Brandeis University
  557.  
  558. One should also mention that Language Systems is making a very
  559. credible effort at developing an industrial strength Pascal
  560. compiler. Unlike CodeWarrior, the LS version runs under
  561. MPW, which you may or may not find an advantage. But for those
  562. of us who got hooked on Object Pascal before Apple pulled the
  563. rug out from under us, it is the only way to go, since it does
  564. compile Object Pascal while CodeWarrior does not.
  565.  
  566.    R. Palais
  567.  
  568. ---------------------------
  569.  
  570. >From roxanne@bnr.ca (Roxanne Friesen)
  571. Subject: Newbie Q:Why no DisposeHandle-ReleaseResource call?
  572. Date: Mon, 07 Nov 1994 11:53:32 -0400
  573. Organization: Bell-Northern Research Ltd.
  574.  
  575. I'm trying to get a better *handle* on when handles should be disposed of
  576. and resources released.
  577.  
  578. In the first sample function below, I would have thought that the alias
  579. handle should be disposed of once the resource has been written to the
  580. resource file but this function doesn't do that.  Am I wrong, is this
  581. function wrong, or is it simply not necessary, in this case, to dispose of
  582. the handle? (For the sake of simplifying the samples, assume I'm writing
  583. to my apps own resource fork and not a prefs file of some kind ... or does
  584. that make a difference?)
  585.  
  586. FUNCTION doCreateAlias(fileSpec:FSSpec):OSErr;
  587. VAR
  588.   alisHandle : AliasHandle;
  589.   result : OSErr;
  590.  
  591. BEGIN
  592.   result := NewAlias(NIL, fileSpec, alisHandle);
  593.   IF (alisHandle <> NIL) THEN BEGIN
  594.     AddResource(Handle(alisHandle), rAliasType, 128, 'File Alias');
  595.     result := ResError;
  596.  
  597.     IF (result = NoErr) THEN BEGIN
  598.       WriteResource(Handle(alisHandle));
  599.       result := ResError;
  600.     END;
  601.   END;
  602.  
  603.   doCreateAlias := result;
  604. END; {doCreateAlias}
  605.  
  606.  
  607. In the second sample function below, again, I would have thought that the
  608. resource should be released once I'm finished with it but, again, this
  609. function doesn't do that.  Am I wrong, is this function wrong, or is it
  610. simply not necessary, in this case, to release the resource?
  611.  
  612. FUNCTION setResStr(rsrcType:ResType; rsrcID:INTEGER; content:STR255):OSErr;
  613. VAR   
  614.   rsrcHdl : Handle;
  615.   result  : OSErr;
  616.          
  617. BEGIN
  618.   rsrcHdl := GetResource(rsrcType, rsrcID);
  619.   result := ResError;
  620.          
  621.   IF (rsrcHdl <> NIL) THEN BEGIN
  622.     SetHandleSize(rsrcHdl, LENGTH(content) + 1);          
  623.     BlockMove(@content, rsrcHdl^, LENGTH(content) + 1); 
  624.     ChangedResource(rsrcHdl);
  625.     result := ResError;                                              
  626.  
  627.     IF (result = NoErr) THEN BEGIN
  628.       WriteResource(rsrcHdl);
  629.       result := ResError;
  630.     END;                                       
  631.   END;
  632.   
  633.   setResStr :=
  634. result;                                                                    
  635.  
  636. END; {setResStr}
  637.  
  638.  
  639. Any help, hints, tips, suggestions would be appreciated.
  640. Roxanne.
  641.  
  642. -- 
  643. Roxanne Friesen
  644. Bell-Northern Research Ltd.
  645. roxanne@bnr.ca
  646.  
  647. +++++++++++++++++++++++++++
  648.  
  649. >From jones.794@osu.edu (Matt Jones)
  650. Date: Mon, 07 Nov 1994 19:15:24 +0500
  651. Organization: The Ohio State University
  652.  
  653. In article <roxanne-0711941153320001@47.221.33.54>, roxanne@bnr.ca (Roxanne
  654. Friesen) wrote:
  655.  
  656. > I'm trying to get a better *handle* on when handles should be disposed of
  657. > and resources released.
  658. > In the first sample function below, I would have thought that the alias
  659. > handle should be disposed of once the resource has been written to the
  660. > resource file but this function doesn't do that.  Am I wrong, is this
  661. > function wrong, or is it simply not necessary, in this case, to dispose of
  662. > the handle? (For the sake of simplifying the samples, assume I'm writing
  663. > to my apps own resource fork and not a prefs file of some kind ... or does
  664. > that make a difference?)
  665. > FUNCTION doCreateAlias(fileSpec:FSSpec):OSErr;
  666. > VAR
  667. >   alisHandle : AliasHandle;
  668. >   result : OSErr;
  669. > BEGIN
  670. >   result := NewAlias(NIL, fileSpec, alisHandle);
  671. >   IF (alisHandle <> NIL) THEN BEGIN
  672. >     AddResource(Handle(alisHandle), rAliasType, 128, 'File Alias');
  673. >     result := ResError;
  674. >     IF (result = NoErr) THEN BEGIN
  675. >       WriteResource(Handle(alisHandle));
  676. >       result := ResError;
  677. >     END;
  678. >   END;
  679. >  
  680. >   doCreateAlias := result;
  681. > END; {doCreateAlias}
  682. > In the second sample function below, again, I would have thought that the
  683. > resource should be released once I'm finished with it but, again, this
  684. > function doesn't do that.  Am I wrong, is this function wrong, or is it
  685. > simply not necessary, in this case, to release the resource?
  686. > FUNCTION setResStr(rsrcType:ResType; rsrcID:INTEGER; content:STR255):OSErr;
  687. > VAR   
  688. >   rsrcHdl : Handle;
  689. >   result  : OSErr;
  690. >          
  691. > BEGIN
  692. >   rsrcHdl := GetResource(rsrcType, rsrcID);
  693. >   result := ResError;
  694. >          
  695. >   IF (rsrcHdl <> NIL) THEN BEGIN
  696. >     SetHandleSize(rsrcHdl, LENGTH(content) + 1);          
  697. >     BlockMove(@content, rsrcHdl^, LENGTH(content) + 1); 
  698. >     ChangedResource(rsrcHdl);
  699. >     result := ResError;                                              
  700. >     IF (result = NoErr) THEN BEGIN
  701. >       WriteResource(rsrcHdl);
  702. >       result := ResError;
  703. >     END;                                       
  704. >   END;
  705. >   
  706. >   setResStr :=
  707. > result;                                                                    
  708. > END; {setResStr}
  709. > Any help, hints, tips, suggestions would be appreciated.
  710. > Roxanne.
  711. > -- 
  712. > Roxanne Friesen
  713. > Bell-Northern Research Ltd.
  714. > roxanne@bnr.ca
  715.  
  716. If your compiler is any good, it checks if any of the handles in local
  717. storage are still attached. ( I think ) Otherwise, you would be unable to
  718. find the handles to dispose of them later. However, this is tricky internal
  719. compiler stuff, much like pre-initialized variables. I always explicitly
  720. dispose of handles since the moment you assume your compiler does it for
  721. you, it stops.
  722. - ------------------------------------------------------------------------
  723. | it won't give up it wants me dead | |\  | | |  /| | jones.794          |
  724. | goddamn this noise inside my head | | \ | | | / | |    @ohio-state.edu |
  725. |                   Trent Reznor    | |  \| | |/  | | Stop the Clipper!  |
  726. - ------------------------------------------------------------------------
  727.  
  728. +++++++++++++++++++++++++++
  729.  
  730. >From sigurasg@rhi.hi.is (Sigurdur Asgeirsson)
  731. Date: Tue, 08 Nov 1994 09:49:56 -0100
  732. Organization: University of Iceland
  733.  
  734. In article <roxanne-0711941153320001@47.221.33.54>, roxanne@bnr.ca
  735. (Roxanne Friesen) wrote:
  736.  
  737. [snip]
  738.  
  739. > In the first sample function below, I would have thought that the alias
  740. > handle should be disposed of once the resource has been written to the
  741. > resource file but this function doesn't do that.  Am I wrong, is this
  742. > function wrong, or is it simply not necessary, in this case, to dispose of
  743. > the handle?
  744.  
  745. [snip]
  746.  
  747. > FUNCTION doCreateAlias(fileSpec:FSSpec):OSErr;
  748. > VAR
  749. >   alisHandle : AliasHandle;
  750. >   result : OSErr;
  751. > BEGIN
  752. >   result := NewAlias(NIL, fileSpec, alisHandle);
  753. >   IF (alisHandle <> NIL) THEN BEGIN
  754. >     AddResource(Handle(alisHandle), rAliasType, 128, 'File Alias');
  755. >     result := ResError;
  756. >     IF (result = NoErr) THEN BEGIN
  757. >       WriteResource(Handle(alisHandle));
  758. >       result := ResError;
  759. >     END;
  760. >   END;
  761. >  
  762. >   doCreateAlias := result;
  763. > END; {doCreateAlias}
  764. [second code example snipped for brevity]
  765.  
  766.   There is no need in this case to dispose the handle, unless the
  767. AddResource call fails, in which case the handle should be disposed of
  768. with DisposeHandle (since the handle is not a resource if the call fails -
  769. see below). 
  770.   In general there is no need to dispose of resource handles, because they
  771. are the responsibility of the Resource Manager. Resource handles must
  772. NEVER be disposed of via DisposeHandle, since that confuses the Resource
  773. Manager and you end up with heap corruption. (The Resource Manager does a
  774. DisposeHandle for all loaded resources in a resource file when the
  775. resource file is closed). 
  776.   If you feel the need to dispose of a resource handle when you're done
  777. with it (maybe because you'd like to free the memory that the resource is
  778. using) do it with the ReleaseResource call. It's generally better though
  779. to mark your resources as purgeable and leave it up to the Memory and
  780. Resource Managers to free the memory when needed. Be sure however, to use
  781. LoadResource in this case and mark the resource unpurgeable (or lock it)
  782. if you need to be sure that it doesn't "go away" while you're using it.
  783.  
  784. -- 
  785. Sigurdur Asgeirsson    | "Well you know, C isn't that hard, void (*(*f[])())()
  786. Kambasel 26            | for instance declares f as an array of unspecified
  787. 109 Reykjavik, Iceland | size, of pointers to functions that return pointers to
  788. sigurasg@rhi.hi.is     | functions that return void... I think"
  789.  
  790. +++++++++++++++++++++++++++
  791.  
  792. >From johns@efn.org (John Selhorst)
  793. Date: Tue, 8 Nov 1994 14:43:55 GMT
  794. Organization: hisself
  795.  
  796. In article <jones.794-071194191524@slip1-12.acs.ohio-state.edu>,
  797. jones.794@osu.edu (Matt Jones) wrote:
  798.  
  799. [ stuff from Roxanne deleted ]
  800.  
  801. > If your compiler is any good, it checks if any of the handles in local
  802. > storage are still attached. ( I think ) Otherwise, you would be unable to
  803. > find the handles to dispose of them later. However, this is tricky internal
  804. > compiler stuff, much like pre-initialized variables. I always explicitly
  805. > dispose of handles since the moment you assume your compiler does it for
  806. > you, it stops.
  807.  
  808. Wrong.  This is not fancy compiler stuff.  The handles Roxanne was
  809. referring to belong to the resource manager and the resource manager will
  810. dispose of them when it needs to.
  811.  
  812. Johnny
  813.  
  814. johns@efn.org
  815.  
  816. +++++++++++++++++++++++++++
  817.  
  818. >From Scott.Francis@SuperMac.com (eScott Francisternet alt.bbs.lists alt.bbs.lists.d alt.bbs.majorbbs alt.bbs.metal alt.bbs.pcboard alt.bbs.pcbuucp alt.bbs.renegade alt.bbs.searchlight alt.bbs.unixbbs alt.bbs.unixbbs.uniboard alt.bbs.uupcb alt.bbs.waffle alt.bbs.wildcat alt.beadworld alt.)
  819. Date: Tue, 08 Nov 1994 10:49:31 -0800
  820. Organization: Radius
  821.  
  822. In article <roxanne-0711941153320001@47.221.33.54>, roxanne@bnr.ca
  823. (Roxanne Friesen) wrote:
  824.  
  825. > I'm trying to get a better *handle* on when handles should be disposed of
  826. > and resources released.
  827.  
  828. In both cases the resource handle should be released with
  829. ReleaseResource().  Many programmers have not always done so, particularly
  830. when building apps since the res file will be closed (and all resources
  831. from that file released) when the app quits.  While calling
  832. ReleaseResource() is then not strictly necessary, it is good form, and can
  833. help some types of memory problems.
  834.  
  835. Another dimension to the problem:  If you will be refetching resources
  836. again and again, you might want to make the preloadable, and *not* release
  837. them.  This will keep them in memory and speed up the calls to
  838. GetResource().
  839.  
  840. --Scott
  841.  
  842. +++++++++++++++++++++++++++
  843.  
  844. >From mxmora@unix.sri.com (Matt Mora)
  845. Date: 8 Nov 1994 15:39:07 -0800
  846. Organization: SRI International, Menlo Park, CA
  847.  
  848. In article <roxanne-0711941153320001@47.221.33.54> roxanne@bnr.ca (Roxanne Friesen) writes:
  849. >I'm trying to get a better *handle* on when handles should be disposed of
  850. >and resources released.
  851.  
  852. Simple.  Handle are disposed and Resources are released.
  853.  
  854. >BEGIN
  855. >  result := NewAlias(NIL, fileSpec, alisHandle);
  856. >  IF (alisHandle <> NIL) THEN BEGIN
  857. >    AddResource(Handle(alisHandle), rAliasType, 128, 'File Alias');
  858.  
  859. At this point aliasHandle is no longer a plain ol handle. After you
  860. call Addresource the handle you supply becomes a ResourceHandle.
  861.  
  862. If its a resource handle what are you supposed to do with it? Yep
  863. ReleaseResource. 
  864.  
  865. DON'T CALL DISPOSEHANDLE AFTER YOU CALLED ADDRESOURCE ON THAT HANDLE.
  866.  
  867. >
  868. >In the second sample function below, again, I would have thought that the
  869. >resource should be released once I'm finished with it but, again, this
  870. >function doesn't do that.  Am I wrong, is this function wrong, or is it
  871. >simply not necessary, in this case, to release the resource?
  872.  
  873.  
  874. In the example that was shown, you don't have to call release resource
  875. if you might use that resource again. If you don't want it around
  876. go ahead and call release resource.
  877.  
  878. If the resource file is closed, the Resource handles will be released.
  879.  
  880. Xavier
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892. -- 
  893. ___________________________________________________________
  894. Matthew Xavier Mora                       Matt_Mora@sri.com
  895. SRI International                       mxmora@unix.sri.com
  896. 333 Ravenswood Ave                    Menlo Park, CA. 94025
  897.  
  898. +++++++++++++++++++++++++++
  899.  
  900. >From mxmora@unix.sri.com (Matt Mora)
  901. Date: 8 Nov 1994 15:40:13 -0800
  902. Organization: SRI International, Menlo Park, CA
  903.  
  904. In article <jones.794-071194191524@slip1-12.acs.ohio-state.edu> jones.794@osu.edu (Matt Jones) writes:
  905.  
  906. >If your compiler is any good, it checks if any of the handles in local
  907. >storage are still attached. ( I think ) Otherwise, you would be unable to
  908. >find the handles to dispose of them later. However, this is tricky internal
  909. >compiler stuff, much like pre-initialized variables. I always explicitly
  910. >dispose of handles since the moment you assume your compiler does it for
  911. >you, it stops.
  912.  
  913.  
  914. Huh?
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922. Xavier
  923.  
  924. -- 
  925. ___________________________________________________________
  926. Matthew Xavier Mora                       Matt_Mora@sri.com
  927. SRI International                       mxmora@unix.sri.com
  928. 333 Ravenswood Ave                    Menlo Park, CA. 94025
  929.  
  930. +++++++++++++++++++++++++++
  931.  
  932. >From peter.lewis@info.curtin.edu.au (Peter N Lewis)
  933. Date: Wed, 09 Nov 1994 11:27:40 +0800
  934. Organization: NCRPDA, Curtin University
  935.  
  936. In article <roxanne-0711941153320001@47.221.33.54>, roxanne@bnr.ca
  937. (Roxanne Friesen) wrote:
  938.  
  939. >In the first sample function below, I would have thought that the alias
  940. >handle should be disposed of once the resource has been written to the
  941. >resource file but this function doesn't do that.  Am I wrong, is this
  942. >function wrong, or is it simply not necessary, in this case, to dispose of
  943. >the handle? (For the sake of simplifying the samples, assume I'm writing
  944. >to my apps own resource fork and not a prefs file of some kind ... or does
  945. >that make a difference?)
  946.  
  947. First off, you must never call DisposeHandle on a resource handle, nor
  948. ReleaseResource on a non-resource handle.  Bad THings(tm) will happen. 
  949. There are a pair fo inits (DoubleTrouble and DisposeResource or some such)
  950. that catch bugs like this, available from ftp.apple.com:/mac/dts/ I
  951. believe.
  952.  
  953. Second, when you write a resource to a file, it's not necessayr to release
  954. it afterwards, since it will be automatically released when the resource
  955. file is closed (which tends to be quite soon afterwards anyway).  Also,
  956. you can set the handle to be purged (HPurge) and then it'll be released
  957. when memory is needed, but not until.  Make sure to call GetResource again
  958. to reload the (possibly) purged handle before reusing it.
  959.  
  960. Enjoy,
  961.    Peter.
  962. -- 
  963. Peter N Lewis <peter.lewis@info.curtin.edu.au> - Macintosh TCP fingerpainter
  964.  
  965. ---------------------------
  966.  
  967. >From fallside@rahul.net (David C. Fallside)
  968. Subject: Prograph 2.5
  969. Date: 10 Nov 1994 06:39:19 GMT
  970. Organization: a2i network
  971.  
  972. I recently accepted a $59.95 offer for Prograph 2.5. The promo blurb "Very
  973. High Level Pictorial Object-Oriented Programming Environment" seems to be
  974. accurate, and having worked my way through half of the tutorials, it seems
  975. that it should be possible to develop complex applications. But I'm not a
  976. professional programmer, and haven't found anyone else who has ever heard
  977. of Prograph. Any comments from Netland? Thank you.
  978. David
  979.  
  980. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  981. I'd rather be on the river ....
  982. K1/4, SQRT/3
  983. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  984.  
  985. +++++++++++++++++++++++++++
  986.  
  987. >From nick+@pitt.edu ( nick.c )
  988. Date: Thu, 10 Nov 1994 11:42:38 -0500
  989. Organization: The Pitt, Chemistry
  990.  
  991. In article <fallside-0911942243270001@382.rahul.net>, fallside@rahul.net
  992. (David C. Fallside) wrote:
  993.  
  994. > I recently accepted a $59.95 offer for Prograph 2.5. The promo blurb "Very
  995. > High Level Pictorial Object-Oriented Programming Environment" seems to be
  996. > accurate, and having worked my way through half of the tutorials, it seems
  997. > that it should be possible to develop complex applications. But I'm not a
  998. > professional programmer, and haven't found anyone else who has ever heard
  999. > of Prograph. Any comments from Netland? Thank you.
  1000.  
  1001.  
  1002.    Prograph was my first environment (not counting hypercard), and
  1003.       I consider that a mistake.  Don't get me wrong - prograph is
  1004.       both a great concept and a great engineering feet.  I still
  1005.       argue that inconic input will be the way we'll all code 10 years
  1006.       from now (or sooner).  However, prograph is a dual mode environment,
  1007.       it allows you to program at a low level, but defaults to a high
  1008.       level environment by use of it's integrated class library.
  1009.       As a result, and with the added factor there is very little
  1010.       sample code or literature, it's hard to tell where the library
  1011.       ends and the toolbox begins.  You can generate nice (albeit
  1012.       large and slow) apps with 2.5.2 - nicer ones with CPX - but
  1013.       you won't learn anything about Mac programming with it.
  1014.  
  1015.    To learn how to program the Mac you'll need to learn a classical
  1016.       low level language (Pascal or C would be best), and when you do
  1017.       you'll find you can generate much smaller, faster binaries and
  1018.       have access to a wealth of established library code and example
  1019.       code from all over the world.  My guess is most "professional"
  1020.       programmers, don't want to give up those advantages.
  1021.  
  1022.    Prograph was marketed as a non-programmers programming language, and
  1023.       I think that's still true.  However, as I said above, it does
  1024.       allow low level coding, is very powerfull, and has the best
  1025.       interface and debugger I've ever seen.  It's a glimpse of the
  1026.       future of programming, and worth knowing, just remeber you 
  1027.       get paid in the present.
  1028.  
  1029.  
  1030.  Internet: nick+@pitt.edu            _/   _/  _/  _/_/_/   _/   _/  
  1031.    eWorld: nick                     _/_/ _/  _/  _/   _/  _/_/_/ 
  1032.       CIS: 71232,766               _/ _/_/  _/  _/       _/ _/    
  1033.      http://www.pitt.edu/~nick/   _/   _/  _/   _/_/_/  _/   _/     
  1034.                     
  1035.  
  1036. +++++++++++++++++++++++++++
  1037.  
  1038. >From pjensen@netcom.com (Peter Jensen)
  1039. Date: Thu, 10 Nov 1994 16:53:40 GMT
  1040. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1041.  
  1042. fallside@rahul.net (David C. Fallside) writes:
  1043.  
  1044. >I recently accepted a $59.95 offer for Prograph 2.5. The promo blurb "Very
  1045. >High Level Pictorial Object-Oriented Programming Environment" seems to be
  1046. >accurate, and having worked my way through half of the tutorials, it seems
  1047. >that it should be possible to develop complex applications. But I'm not a
  1048. >professional programmer, and haven't found anyone else who has ever heard
  1049. >of Prograph. Any comments from Netland? Thank you.
  1050. >David
  1051.  
  1052. Prograph 2.5 is the predecessor of Prograph CPX 1.x, which is the 
  1053. Prograph development environment with all the bells and whistles.  $60 is 
  1054. a great price for 2.5 which has the full language implementation found in 
  1055. CPX.  CPX has a rich class library a'la TCL/MacApp and a user-modifiable 
  1056. GUI Builder.  
  1057.  
  1058. I use Prograph full-time to develop complex commercial applications.  
  1059. There are some very intriguing apps with high-volume potential being 
  1060. developed in Prograph right now.  Prograph has arguably one of the best 
  1061. debuggers ever implemented (in the interpretive mode).  There is an 
  1062. optimizing compiler that generates stand-alone apps.  The code isn't as 
  1063. fast or tight as C/C++ but you get RTTI, garbage collection, automatic 
  1064. deref of handles/pointers, cool list management stuff, and of course, a 
  1065. gorgreous visual syntax that prevents syntax errors via constrained input.
  1066.  
  1067. Visual Programming is for real; and Prograph is the most "real" of the new
  1068. generation.  It's one of the things that makes the Mac a special
  1069. development platform.  Sometime next year there will be a Windows Prograph
  1070. and the framework will become cross-platform.  Plus they're developing
  1071. DAL/SQL database tools that will allow you to do everything you can do in
  1072. Omnis/4D but drop into Prograph if you want real programming power.  For
  1073. compute-bound operations it's fairly straightforward to import external
  1074. primitives written in C if you feel the need for speed.  In normal usage,
  1075. you can't tell whether well-crafted apps were written in Prograph or C++ 
  1076. (well, maybe you can, since they're delivered earlier!). 
  1077.  
  1078. I'm very happy with Prograph.  net.persons interested in Prograph can join
  1079. the commotion over on comp.lang.prograph.  Also, Kurt Schmucker of Apple's
  1080. ATG has written an extensive review of CPX in November's MacTech.  Look
  1081. for more Prograph articles in coming issues. 
  1082.  
  1083. Peter Jensen                                  pjensen@netcom.com
  1084. Pepper Tree Design, Inc.                      Santa Clara, CA
  1085.    "Software crafted from the choicest of electrons" (tm)
  1086.  
  1087. +++++++++++++++++++++++++++
  1088.  
  1089. >From howardb@enlil.premenos.com (Howard Berkey)
  1090. Date: 10 Nov 1994 17:03:19 GMT
  1091. Organization: Premenos Corp
  1092.  
  1093. In article <fallside-0911942243270001@382.rahul.net>,
  1094. David C. Fallside <fallside@rahul.net> wrote:
  1095. >I recently accepted a $59.95 offer for Prograph 2.5. The promo blurb "Very
  1096. >High Level Pictorial Object-Oriented Programming Environment" seems to be
  1097. >accurate, and having worked my way through half of the tutorials, it seems
  1098. >that it should be possible to develop complex applications. But I'm not a
  1099. >professional programmer, and haven't found anyone else who has ever heard
  1100. >of Prograph. Any comments from Netland? Thank you.
  1101. >David
  1102. >
  1103.  
  1104.  
  1105.  
  1106.  
  1107. I've never used it myself but it gets a lot of praise from those who
  1108. have.  
  1109.  
  1110. You might want to check out comp.lang.prograph... I'm sure you'll get
  1111. a lot of info there.
  1112.  
  1113. -H-
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124. ---------------------------
  1125.  
  1126. >From ladan@cs.umd.edu (Ladan Gharai)
  1127. Subject: [Q] Programming with the QuickTime toolkit
  1128. Date: 2 Nov 1994 18:52:59 -0500
  1129. Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
  1130.  
  1131.  
  1132. Hi everyone
  1133.  
  1134. I am new to the QuickTime and am trying to understand how it works. I have
  1135. a bunch of questions and would appreciate any answers. I need to write a player
  1136. with very specific functionality. Going through the Inside the Mac: Quicktime
  1137. I have the following questions:
  1138.  
  1139. 1. A sample is defined as "A single element of a sequence of time-ordered
  1140.    data" does this mean that for a vedio a sample would be a frame?
  1141.  
  1142. 2. What function calls should I use to be able to access a single frame? In the
  1143.    Inside the Mac it says that a programmer can access every frame. How?
  1144.  
  1145. 3. Where does QuickTime store information about the frame rates (fps) of a movie? 
  1146.    For example the frame rate that a movie was created with? 
  1147.  
  1148. 4. Is there a realtionship between frame rate (fps) and playback rate?  
  1149.  
  1150. 5. When QuickTime does not have enough time to display all the frames of a
  1151.    movie, it starts dropping frames. Is there a pattern to this frame dropping?
  1152.    For example does it drop everyother frame, or the third in every 3 frames? 
  1153.    How does it decide which frames to drop?
  1154.  
  1155.  
  1156.  
  1157. thanx
  1158. Ladan
  1159.  
  1160. +++++++++++++++++++++++++++
  1161.  
  1162. >From rich@cs.umd.edu (Richard Gerber)
  1163. Date: 2 Nov 1994 19:44:03 -0500
  1164. Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
  1165.  
  1166. I am interested too.  But specifically: from within a quicktime player is there
  1167. any way to dynamically determine -- as the movie is playing -- which particular 
  1168. frames are being dropped.  
  1169.  
  1170. If not, what's the lowest level of granularity I can get to?
  1171.  
  1172. rich
  1173.  
  1174. - ----------
  1175.  
  1176. Richard Gerber
  1177. Assistant Professor
  1178.     
  1179. Department of Computer Science
  1180. University of Maryland
  1181. College Park, MD  20742 USA
  1182.  
  1183. Email:   rich@cs.umd.edu
  1184. Tel:     (301) 405-2710
  1185. FAX:     (301) 405-6707
  1186.  
  1187.  
  1188.  
  1189. +++++++++++++++++++++++++++
  1190.  
  1191. >From ivan_cavero_belaunde@avid.com (Ivan Cavero Belaunde)
  1192. Date: 8 Nov 1994 00:00:42 GMT
  1193. Organization: Avid Technology, Inc.
  1194.  
  1195. In article <3998qv$7id@mingus.cs.umd.edu>, ladan@cs.umd.edu (Ladan Gharai)
  1196. wrote:
  1197. > Hi everyone
  1198. > I am new to the QuickTime and am trying to understand how it works. I have
  1199. > a bunch of questions and would appreciate any answers. I need to write a
  1200. player
  1201. > with very specific functionality. Going through the Inside the Mac: Quicktime
  1202. > I have the following questions:
  1203. > 1. A sample is defined as "A single element of a sequence of time-ordered
  1204. >    data" does this mean that for a vedio a sample would be a frame?
  1205.  
  1206. Yup.
  1207.  
  1208. > 2. What function calls should I use to be able to access a single frame?
  1209. In the
  1210. >    Inside the Mac it says that a programmer can access every frame. How?
  1211.  
  1212. If I want the sample at time 10 on the first track:
  1213.    theTrack = GetMovieIndTrack(theMovie, 1);
  1214.    theMedia = GetTrackMedia(theTrack);
  1215.    mediaTime = TrackTimeToMediaTime(theTrack, 10);
  1216.    if (mediaTime != -1) {
  1217.       err = GetMediaSample(theMedia, sampleDataHandle, 0, &sampleDataSize,
  1218.             mediaTime, nil, nil, sampleDescriptionHandle, nil, 1, nil,
  1219.             &sampleFlags);
  1220.  
  1221. > 3. Where does QuickTime store information about the frame rates (fps) of
  1222. a movie? 
  1223. >    For example the frame rate that a movie was created with? 
  1224.  
  1225. It doesn't since the frame rate can vary over time throughout the movie.
  1226. You can estimate it by walking each track by track edits via
  1227. GetTrackNextInterestingTime and then figuring out the frame rate for each
  1228. edit by looking at the edit rate for each edit as well as the durations of
  1229. the samples spanned by the edit.
  1230.  
  1231. > 4. Is there a realtionship between frame rate (fps) and playback rate?  
  1232.  
  1233. I'm not sure what you mean here. The QuickTime movie will never play at a
  1234. better rate than its original stored rate - additionally, it is eminently
  1235. possible to create a movie with too high a stored frame rate that will not
  1236. play properly and will drop frames.
  1237.  
  1238. > 5. When QuickTime does not have enough time to display all the frames of a
  1239. >    movie, it starts dropping frames. Is there a pattern to this frame
  1240. dropping?
  1241. >    For example does it drop everyother frame, or the third in every 3 frames? 
  1242. >    How does it decide which frames to drop?
  1243.  
  1244. A movie has a "running clock" that tells it what "time" it is within the
  1245. movie. When falling behind, QT will drop as many frames as necessary to
  1246. catch up the frame being displayed with its running clock. The results are
  1247. dependent on boatloads of factors, such as the horsepower of your machine,
  1248. the bandwidth of your storage device, the seek speed of your storage
  1249. device, the compression scheme used, the frame-differencing
  1250. characteristics of the movie, and where within the movie the "playback
  1251. head" is. There's no simple answer, sorry.
  1252.  
  1253. Hope this helps. Followups redirected to comp.sys.mac.programmer.
  1254.  
  1255. -Ivan
  1256. - --
  1257. Ivan Cavero Belaunde (ivan_cavero_belaunde@avid.com)
  1258. Avid VideoShop Lead
  1259. Avid Technology, Inc.
  1260. Disclaimer:  All views expressed are entirely my own and do not
  1261. reflect  the opinions of Avid Technology, Inc.
  1262.  
  1263. ---------------------------
  1264.  
  1265. End of C.S.M.P. Digest
  1266. **********************
  1267.  
  1268.  
  1269.