home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1996-02-09 | 140.2 KB | 3,799 lines | [ TEXT/R*ch]
C.S.M.P. Digest Thu, 08 Feb 96 Volume 3 : Issue 135 Today's Topics: Command-Shift-Keys CustomPutFile Puzzle? Detecting QuickTime PowerPlug How can you use 68K MPW .o file in PPC apps? How do I create many menus from one MENU resource? MacApp newbie questions Matching struct definitions to TMPL resources Menu Manager limitations? Programming a PinnBall Q: When to call ReleaseResource? Quickdraw 3D intro?? Starting MacTCP on startup VBL Afterlife Why would dragging in a thumb crash? [ANNOUNCE] BSP Tree Demo Application v1.3 [Q] PowerPC VBLs? _Jackson Trap detecting CD-ROM The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier (pottier@clipper.ens.fr). The digest is a collection of article threads from the internet newsgroups comp.sys.mac.programmer.help, csmp.tools, csmp.misc and csmp.games. It is designed for people who read news semi-regularly and want an archive of the discussions. If you don't know what a newsgroup is, you probably don't have access to it. Ask your systems administrator(s) for details. If you don't have access to news, you may still be able to post messages to the group by using a mail server like anon.penet.fi (mail help@anon.penet.fi for more information). Each issue of the digest contains one or more sets of articles (called threads), with each set corresponding to a 'discussion' of a particular subject. The articles are not edited; all articles included in this digest are in their original posted form (as received by our news server at nef.ens.fr). Article threads are not added to the digest until the last article added to the thread is at least two weeks old (this is to ensure that the thread is dead before adding it to the digest). Article threads that consist of only one message are generally not included in the digest. The digest is officially distributed by two means, by email and ftp. If you want to receive the digest by mail, send email to listserv@ens.fr with no subject and one of the following commands as body: help Sends you a summary of commands subscribe csmp-digest Your Name Adds you to the mailing list signoff csmp-digest Removes you from the list Once you have subscribed, you will automatically receive each new issue as it is created. The official ftp info is ftp://ftp.dartmouth.edu/pub/csmp-digest. Questions related to the ftp site should be directed to scott.silver@dartmouth.edu. ------------------------------------------------------- >From timmyd@netcom.com (Tim DeBenedictis) Subject: Command-Shift-Keys Date: Sat, 13 Jan 1996 21:24:27 GMT Organization: NETCOM On-line Communication Services (408 261-4700 guest) This is actually in response to me earlier "Why won't my command-keys work?" question; many thanks to all of you who answered. I now understand the problem, and I have an idea for a solution. Essentially, here's the idea: 1) When the "command" key is down, and I get a key-down event, I can manually check to see if the shift key is down by using GetKeys. 2) If the shift key is not down, I just pass the character code from the KeyDown event to MenuKey, and everything works the way it does currently, no problem. 3) If the shift key -is- down, I need to convert the key code ffrom the KeyDown event to a character code, given that the shift key is now also down. The only missing piece is that I need to know how to do this. I am assuming that there's some built-in toolbox trap which does this, or some other relaible method. Any ideas? Thanks again, -Tim DeBenedictis +++++++++++++++++++++++++++ >From dnebing@epix.net (Dave Nebinger) Date: Mon, 15 Jan 1996 14:49:28 -0500 Organization: KHP Services, Inc In article <timmydDL524r.5p2@netcom.com>, timmyd@netcom.com (Tim DeBenedictis) wrote: > This is actually in response to me earlier "Why won't my command-keys > work?" question; many thanks to all of you who answered. I now > understand the problem, and I have an idea for a solution. Essentially, > here's the idea: > > 1) When the "command" key is down, and I get a key-down event, I can > manually check to see if the shift key is down by using GetKeys. And would this really work? If the delay is too long from the point when the key command is issued and when it is received, the shift key may not be down. Start a processor intensive task in the background and initiate an event in the foreground. By the time the app gets the event you could be off filling your coffee cup. Simply put, when your app receives and processes the event is completely independent from the state of the keyboard. That's the nature of event processing and the multiprocessing system. Dave. ========================================================== Dave Nebinger dnebing@epix.net The Alt.Sources.Mac Archivist <http://www.AmbrosiaSW.com/alt.sources.mac/> <ftp://ftp.AmbrosiaSW.com/pub/alt.sources.mac/> +++++++++++++++++++++++++++ >From pcastine@prz.tu-berlin.de (Peter Castine) Date: Tue, 16 Jan 1996 14:07:55 +0100 Organization: Process Control Center, TU Berlin In article <timmydDL524r.5p2@netcom.com>, timmyd@netcom.com (Tim DeBenedictis) wrote: > This is actually in response to me earlier "Why won't my command-keys > work?" question; many thanks to all of you who answered. I now > understand the problem, and I have an idea for a solution. Essentially, > here's the idea: > > 1) When the "command" key is down, and I get a key-down event, I can > manually check to see if the shift key is down by using GetKeys. A better bet is to take a look at the modifiers flags in the Event Record. A finite amount of time has passed between when the Command-Key event was posted and when you call _GetKeys; things may have changed in that time. I may have misdirected Tim in a former post I sent. The actual culprit in the Command-Shift business is the _KeyTrans trap, which translates virtual key codes into ASCII and ignores the Shift flag when the Command flag is set. The modifier flags in the Event Record ought to correctly represent what the user pressed. > 3) If the shift key -is- down, I need to convert the key code ffrom the > KeyDown event to a character code, given that the shift key is now also > down. The only missing piece is that I need to know how to do this. _KeyTrans is the trap to use. This was nicely documented in the old TechNote ``International Cancelling,'' including more than sufficient source code. The information has been folded into the new _Inside Macintosh: Text_, Appendix C (pp. C-23 ff.). Hope this helps, Peter - -------------- http://www.prz.tu-berlin.de/~pcastine/Music -------------- Dr. Peter Castine | Grosze Potentaten und Regenten haben die pcastine@prz.tu-berlin.de | Pflicht, sich um die freien Kuenste zu Process Control Center | kuemmern. Zwar haben Privatleute Lust an der Technical University Berlin | Musik und lieben sie, aber koennen sie nicht | finanzieren. -- Martin Luther +++++++++++++++++++++++++++ >From d88-bli@xbyse.nada.kth.se (Bo Lindbergh) Date: 18 Jan 1996 02:35:31 GMT Organization: Royal Institute of Technology, Stockholm, Sweden In article <pcastine-1601961407550001@maggie.prz.tu-berlin.de> pcastine@prz.tu-berlin.de (Peter Castine) writes: ) ) I may have misdirected Tim in a former post I sent. The actual culprit in ) the Command-Shift business is the _KeyTrans trap, which translates virtual ) key codes into ASCII and ignores the Shift flag when the Command flag is ) set. You're still wrong; KeyTranslate only follows orders. The actual culprit is the KCHR resource. /Bo Lindbergh +++++++++++++++++++++++++++ >From Brown Edward W -BSc Mod Comp <cme92024> Date: 16 Jan 96 14:58:21 GMT Organization: (none) You can tell if the shift key is pressed from the modifiers field of the event record. I believe you have to decode the key into a menu option yourself. Ed. +++++++++++++++++++++++++++ >From CatGuy@lamg.com (Milo Shiff) Date: 20 Jan 1996 04:25:29 GMT Organization: Los Angeles Macintosh Group BBS In article <timmydDL524r.5p2@netcom.com>, timmyd@netcom.com (Tim DeBenedictis) wrote: > This is actually in response to me earlier "Why won't my command-keys > work?" question; many thanks to all of you who answered. I now > understand the problem, and I have an idea for a solution. Essentially, > here's the idea: > > 1) When the "command" key is down, and I get a key-down event, I can > manually check to see if the shift key is down by using GetKeys. I use shift and option keys for special modifiers to the command key combinations in several of my programs. At offset $E (decimal 18) of the event record you will find the modifier flags. Bit 11 is the option key, bit 9 is the shift key, and bit 8 is the command key. Simply run a test on what combinations of modifier keys are being held down and then dispatch accordingly. By the way, I do NOT recommend using _MenuKey to evaluate command keys. You gain a lot of flexibility by keeping your own table. In addition to being able to maintain command key combinations that don't appear in your menus, you can more easily implement a user defined mapping of command key functions. - via BulkRate 2.1 --------------------------- >From Roger.W.Brown@hanover.valley.net (Roger Brown) Subject: CustomPutFile Puzzle? Date: 20 Jan 1996 16:30:25 GMT Organization: Moonlight Software I want to make what appeared to be a simple extension to CustomPutFile but I can't figure out how to do it. When the user clicks the "Save" button and the file name matches an existing file, I want to add an "Append" option to the "Cancel" and "Replace" buttons that appear in the standard "Replace" dialog. Here are two things that I tried and the problems that resulted: 1. I tried a custom dialog hook and a custom dialog to use instead of the "Replace" dialog. This worked fine by adding a different "Replace" dialog with the same id as the System one in my program. My version has an Append button and the dialog hook proc detects hits in that button. The problem is that all other uses of SFPutFile variants in the program use the "append-capable" replace dialog in my program when appending makes no sense in their contexts. Is there a clean way to tell or trick CustomPutFile to use my replace dialog only in one case? I don't want to have to rewrite the resource map to fiddle with resource ID's every time this procedure is accessed. 2. A much more involved approach is to use a Modal Dialog filter that detects clicks on the Open/Save button and then does all the business of seeing if the file name is already used. I think I can get the information I want from the sfReply record if I access it through the myDataPtr parameter. The problem here is that, contrary to what Inside Mac says, the modal dialog filter gets events AFTER they are already processed and does not get notification of the Open/Save button being pushed at all! Does anyone have any better ideas? Or tell me what I am missing here? Thanks - ------------------------------------------------------------------ Roger Brown roger.brown@valley.net Moonlight Software West Lebanon, NH, USA +++++++++++++++++++++++++++ >From "Andrew C. Plotkin" <erkyrath+@CMU.EDU> Date: Sat, 20 Jan 1996 14:02:41 -0500 Organization: Carnegie Mellon, Pittsburgh, PA Roger.W.Brown@hanover.valley.net (Roger Brown) writes: > I want to make what appeared to be a simple extension to CustomPutFile > but I can't figure out how to do it. When the user clicks the "Save" > button and the file name matches an existing file, I want to add an > "Append" option to the "Cancel" and "Replace" buttons that appear in > the standard "Replace" dialog. > > Here are two things that I tried and the problems that resulted: > > 1. I tried a custom dialog hook and a custom dialog to use instead of > the "Replace" dialog. This worked fine by adding a different "Replace" > dialog with the same id as the System one in my program. My version has > an Append button and the dialog hook proc detects hits in that button. > > The problem is that all other uses of SFPutFile variants in the program > use the "append-capable" replace dialog in my program when appending > makes no sense in their contexts. Is there a clean way to tell or trick > CustomPutFile to use my replace dialog only in one case? I don't want > to have to rewrite the resource map to fiddle with resource ID's every > time this procedure is accessed. Rewrite the resource map? Not sure what you mean. CustomPutFile has a dialogid argument. That's what you use to specify a dialog resource. If you put your dialog resource (with the Append button) in as resource 2000, and a normal dialog in as 2001, you can switch back and forth just by supplying 2000 or 2001 in the dialogid argument. Is that what you meant? --Z "And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..." +++++++++++++++++++++++++++ >From stk@berlin.snafu.de (Stefan Kurth) Date: Sun, 21 Jan 1996 00:34:14 +0100 Organization: none Roger Brown <Roger.W.Brown@hanover.valley.net> wrote: > I want to make what appeared to be a simple extension to CustomPutFile > but I can't figure out how to do it. When the user clicks the "Save" > button and the file name matches an existing file, I want to add an > "Append" option to the "Cancel" and "Replace" buttons that appear in > the standard "Replace" dialog. Write a dialogHook function. Upon receiving sfItemOpenButton, check if the file already exists. If it does, put up your custom Replace/Append/Cancel dialog. If the user clicks Cancel, return sfHookNullEvent from the dialogHook. If the user clicks Replace or Append, note this in a global variable, and return sfHookCancelButton. This is important, because otherwise the system would put up its own Replace dialog after yours. So you'll need a global variable to distinguish whether the user clicked cancel in the main dialog, or Replace or Append in your custom dialog. -- Stefan Kurth Berlin, Germany --------------------------- >From mlh@piglet.amscons.com (Mark L. Hessenflow) Subject: Detecting QuickTime PowerPlug Date: 24 Jan 1996 12:08:36 -0800 Organization: Amstadt Consulting Group, San Jose, CA I have some code which creates a preview picture for a file using the QuickTime routines MakePreviewPicture() and AddFilePreview(). I check with gestalt to see if both QuickTime and the image compression tools are available before making the calls. When running on the PowerPC, if QuickTime is installed but 'QuickTime PowerPlug' is not, then the call to AddFilePreview() crashes. In any other case, the code produces the preview if QuickTime is installed, or doesn't if QuickTime is not installed. Here is the code I use: err = Gestalt( gestaltQuickTime, &attributes ); if( err == noErr ) { err = Gestalt( gestaltCompressionMgr, &attributes ); if( err == noErr ) { picHandle = MakePreviewPicture( iconOffscreen ); if( picHandle ) { (void) AddFilePreview( resFile, 'PICT', picHandle ); } } } So is there any way to detect 'QuickTime PowerPlug'? Should I be doing anything to make sure the shared library is loaded into memory? -Mark -- Mark L. Hessenflow mlh@kerygma.com +++++++++++++++++++++++++++ >From sanford@CS.Arizona.EDU (Sanford H. Selznick) Date: 24 Jan 1996 22:45:31 -0700 Organization: University of Arizona CS Department, Tucson AZ Oh... this one... bool QuickTimeIsInstalled(void) { long qtVersion; OSErr anErr; #ifdef powerc long qtFeatures; #endif anErr = Gestalt(gestaltQuickTime, &qtVersion); if (anErr != noErr) return FALSE; // no QT present #ifdef powerc // Test if the library is registered. anErr = Gestalt(gestaltQuickTimeFeatures, &qtFeatures); if ( !( (anErr == noErr) && (qtFeatures & (1 << gestaltPPCQuickTimeLibPresent)) ) ) // not TRUE return FALSE; #endif return TRUE; } I think I got this (or something similar) off a QuickTime Web page over at Apple somewhere. Hope this helps, Sanford +++++++++++++++++++++++++++ >From isis@isis-intl.com (Mike Cohen) Date: Thu, 25 Jan 1996 12:10:11 -0600 Organization: ISIS International In article <4e63k4$s7s@piglet.amscons.com>, mlh@piglet.amscons.com (Mark L. Hessenflow) wrote: >When running on the PowerPC, if QuickTime is installed but 'QuickTime >PowerPlug' is not, then the call to AddFilePreview() crashes. I assume you have QuickTimeLib weak linked. If so, check the address of any functions in it before you call them. You should do something like: if (AddFilePreview != NULL) AddFilePreview(...); else error("QuickTime PowerPlug isn't installed"); If you don't use weak link, your application will refuse to launch completely if it isn't installed. -- Mike Cohen - isis@isis-intl.com Home Page: http://www.isis-intl.com/ Sound is the same for all the world - Youssou N'dour, "Eyes Open" *** Save Mystery Science Theater 3000! Comedy Central has decided to *** cancel it. Call them at (212) 767-8600 and tell them what you think. *** Full details at http://fermi.clas.virginia.edu/~jcp9j/canceled.html --------------------------- >From msmail.hewittj@tsod.lmig.com (Jon Hewitt) Subject: How can you use 68K MPW .o file in PPC apps? Date: Thu, 18 Jan 1996 09:53:19 -0500 Organization: Liberty Mutual Group Hi, I have an API that requires a 68K MPW .o file which has no PPC library counterpart. : * ( I assume that in order to be able to built a PPC app I will have to use the Mixed Mode Manager. But other than that, I'm not sure how to start. Principally my problem is this: How do you include the .o file in the application? It doesn't seem like either Metrowerks or Symantec (I would like to use both) allow you to include .o files in PPC projects. Do I need to build a code resource? If so, how do I call the functions in the API? Does anyone know of sample code I could look at? Thanks for any help you can offer, Jon Hewitt -- msmail.hewittj@tsod.lmig.com My opinions are not necessarily those of my employer. +++++++++++++++++++++++++++ >From Etay_Bogner@mail.stil.scitex.com (Etay Bogner) Date: Sun, 21 Jan 1996 10:24:52 +0200 Organization: Scitex Corp. In article <msmail.hewittj-1801960953190001@hewitt.lmig.com>, msmail.hewittj@tsod.lmig.com (Jon Hewitt) wrote: >> Hi, >> >> I have an API that requires a 68K MPW .o file which has no PPC library >> counterpart. : * ( >> It somewhat depends on how the functions in the .o are compiled and how many of them do you have, but basically build a code resource. You have several options on how to get to the functions inside the .o : 1) build a mixed mode entry per function and return their addresses via a pointer to array of pointers to functions returned from the main of the CR. The client can define it's own functions that will jump to those pointers or do a PPC asm hack where you install those pointers in the RTOC ( my prefered way :-), but a more complex one. you'll have to create a shared library that will contain entries for those functions, and than replace in the TOC those fake entries with those is the 68K CR. This ensures that no code change is required, and one can easily switch to a native version of this library when it becomes available without changing the client, just replacing the shared library ) 2) build one mixed mode entry for the CR's main, and dispatch yourself. This will work for register dispatched code. Take a look at one of MPW's examples : ...:MPW:Examples:PPCExamples:CExamples:PPC-68K: -- -- Etay Bogner, -- Etay_Bogner@mail.stil.scitex.com, -- Scitex Corp. -- Israel. --------------------------- >From davef@mbl.edu (Dave Fernandes) Subject: How do I create many menus from one MENU resource? Date: Fri, 19 Jan 1996 16:35:25 -0500 Organization: Marine Biological Laboratory My problem is that I have a document window with a popup menu that is filled in dynamically depending on the contents of the document. If I want to open more than one document, the popup menus in different document windows might have different contents. Do I need to have a seperate MENU resource for each document I want to open? Or is there a way to create independent menus from one resource? I'm doing this within PowerPlant, though I don't think that matters. -- Dave Fernandes Postdoctoral Research Associate The Ecosystems Center Marine Biological Laboratory +++++++++++++++++++++++++++ >From cpopetz@metrowerks.com (Clinton Popetz) Date: 20 Jan 1996 00:51:11 GMT Organization: Metrowerks Inc. In article <davef-1901961635250001@128.128.173.90>, davef@mbl.edu (Dave Fernandes) wrote: >My problem is that I have a document window with a popup menu that is >filled in dynamically depending on the contents of the document. If I >want to open more than one document, the popup menus in different document >windows might have different contents. Do I need to have a seperate MENU >resource for each document I want to open? Or is there a way to create >independent menus from one resource? > >I'm doing this within PowerPlant, though I don't think that matters. This is the bane of popup menus. The problem is that LStdPopupMenu (and in fact most popup menu implementations since System 7) use the CDEF which the system provides for Popups. It keeps you from having to do things like dynamically resize the frame, draw the drop shadow, etc. by hand. The problem is that it expects a MENU resource number in the NewControl call. And if you have two popups loaded from the same resource, they will effect each other when items are added/removed. There are two ways people attempt to solve this. Many programs just keep a ton of empty MENU resources around, and hope they don't run out. This only delays problems in most cases. (NCSA Mosaic kept 50 popups around. But one day, someone hit a page where there were 51 forms, and WHAMMO) There is another possibility that works for me, although no one has verified that it is OK by the System. I subclass LStdPopupMenu to make a CPopupWithDummy. And I override FinishCreateSelf in the following way: void CPopupWithDummy::FinishCreateSelf() { //here be dragons MenuHandle newHandle = ::NewMenu(sMenuID++,"\p"); ::InsertMenu(newHandle,-1); PopupPrivateDataHandle dataH = (PopupPrivateDataHandle) (**GetMacControl()).contrlData; (*dataH)->mHandle = newHandle; (*dataH)->mID = mMenuID; } So I fool the CDEF into using a new MenuHandle. sMenuID is a static that counts up, so that I don't use the same ID twice. Eventually this will turn over, and things will be bad. But this WORKS, and I haven't gotten it to crash. When the control is destroyed, the MacOS CDEF will not call ReleaseResource on the Menu, because it doesn't know how many times you are using it. The other alternative is to do it the old System 6 way, where you use your own CDEF and take care of everything by hand. This is not fun... -Clint -- /** * Clinton Popetz * cpopetz@metrowerks.com * Arnold's Coffee Boy */ +++++++++++++++++++++++++++ >From jbruyndonckx@waveresearch.com (Jan Bruyndonckx) Date: Mon, 22 Jan 1996 09:27:15 +0100 Organization: Cratylus Corp In article <davef-1901961635250001@128.128.173.90>, davef@mbl.edu (Dave Fernandes) wrote: > My problem is that I have a document window with a popup menu that is > filled in dynamically depending on the contents of the document. If I > want to open more than one document, the popup menus in different document > windows might have different contents. Do I need to have a seperate MENU > resource for each document I want to open? Or is there a way to create > independent menus from one resource? > > I'm doing this within PowerPlant, though I don't think that matters. You can have several PP windows referencing the same popup menu, if the menu contents stay the same. In my program, the popup menu is hierarchical, and its contents are built on the fly. I use the NewMenu toolbox call for this, and I had to use a different menuID for each one. Jan \|/ (o o) ________________________________oOo__(_)__oOo_________________________________ | Jan Bruyndonckx | | e-mail: jbruyndonckx@waveresearch.com | | ALink: WAVE.BEL "Small problems have deep roots." | l____________________________________________________________________________l --------------------------- >From Andy.Bettis@isltd.insignia.com (Andy Bettis) Subject: MacApp newbie questions Date: Mon, 22 Jan 1996 12:19:23 GMT Organization: Insignia Solutions I'm new to MacApp and am trying to learn it by the home study method, however I'm hitting a few problems early on and I'd be grateful for some expert advice. First off, after building my app it refuses to run, claiming that the required resources are not present. Is there a way of finding out what is missing? I've compared by generated resource fork with some of the working examples without spotting any obvious difficulties. When constructing views with ViewEdit I can't add pop-up menus without a corresponding MENU resource in addition to the CMNU (it crashes horribly). And do I need to add pop-up menus to the hierarchic MBAR resource? Can I directly change the fNumRows field in a TGridView subclass or do I need to insert the number of rows I need one at a time? And how is a double-click selection passed to the app? Finally, can anyone suggest a good 'how to' book? I'm OK on the C++ side of things, and I have the Apple programmer's guide and tutorial manuals. Thanks in advance, and could you mail any replies as I'm not a regular in this group. Oh, by the way, I'm using CodeWarrior rather than MPW. Rev. Andy +++++++++++++++++++++++++++ >From trygve@kagi.com (Trygve Isaacson) Date: Tue, 23 Jan 1996 06:53:57 GMT Organization: Freak Accident Music In article <Andy.Bettis-2201961222550001@abettis-mac.isltd.insignia.com>, Andy.Bettis@isltd.insignia.com (Andy Bettis) wrote: > I'm new to MacApp and am trying to learn it by the home study method, > however I'm hitting a few problems early on and I'd be grateful for some > expert advice. > > First off, after building my app it refuses to run, claiming that the > required resources are not present. Is there a way of finding out what is > missing? I've compared by generated resource fork with some of the working > examples without spotting any obvious difficulties. This is commonly encountered by not including or initializing some of the MacApp managers needed at startup. Usually it's the UDialog unit or its resources. So first, make sure you make these calls (you may not need them all, but this basically covers it) in your main before you create and run the application object: InitUMacApp(8); InitUPrinting(); InitUTEView(); InitUDialog(); InitUMailer(); #if qDrag if (HasDragManager()) InitUDragManager(); #endif InitUGridView(); InitUSynchScroller(); InitUFloatWindow(); Second, make sure you include the necessary resources by putting the following lines in your main .r file (again, you may be able to omit some of these, but start with them all to be sure): #if qDebug include "Debug.rsrc" not 'ckid'; #endif include "MacApp.rsrc" not 'ckid'; include "Printing.rsrc" not 'ckid'; include "Dialog.rsrc" not 'ckid'; include "Defaults.rsrc" 'aete'; include "Defaults.rsrc" 'CLSS'; // Include 68K Code Resources when Rezzing #if !qNoCode include $$Shell("ObjApp")$$Shell("XAppName") 'CODE'; #endif > > When constructing views with ViewEdit I can't add pop-up menus without a > corresponding MENU resource in addition to the CMNU (it crashes horribly). > And do I need to add pop-up menus to the hierarchic MBAR resource? Yes, put your popup CMNU ids in the hierarchical MBAR. You don't need any MENUs, although you can use them where you don't need command number mapping. > Can I directly change the fNumRows field in a TGridView subclass or do I > need to insert the number of rows I need one at a time? And how is a > double-click selection passed to the app? You need to call TGridView methods such as InsRowBefore or InsRowFirst or InsRowLast. These all allow you to insert several rows with one call. You can't just alter fNumRows. You need to handle double-clicks by overriding DoMouseCommand and checking the event's click count. Good luck... ........................................................................... Trygve Isaacson "We secretly replaced this gourmet coffee trygve@kagi.com with Folger's Dilithium Crystals." www.kagi.com/authors/trygve/ ........................................................................... +++++++++++++++++++++++++++ >From Lev Knopov < Lev_Knopov@mail.stil.scitex.com> Date: 23 Jan 1996 07:17:51 GMT Organization: Scitex Corp. Ltd. Andy.Bettis@isltd.insignia.com (Andy Bettis) wrote: >I'm new to MacApp and am trying to learn it by the home study method, >however I'm hitting a few problems early on and I'd be grateful for some >expert advice. > >First off, after building my app it refuses to run, claiming that the >required resources are not present. Is there a way of finding out what is >missing? I've compared by generated resource fork with some of the working >examples without spotting any obvious difficulties. > >When constructing views with ViewEdit I can't add pop-up menus without a >corresponding MENU resource in addition to the CMNU (it crashes horribly). >And do I need to add pop-up menus to the hierarchic MBAR resource? > >Can I directly change the fNumRows field in a TGridView subclass or do I >need to insert the number of rows I need one at a time? And how is a >double-click selection passed to the app? > >Finally, can anyone suggest a good 'how to' book? I'm OK on the C++ side >of things, and I have the Apple programmer's guide and tutorial manuals. > >Thanks in advance, and could you mail any replies as I'm not a regular in >this group. Oh, by the way, I'm using CodeWarrior rather than MPW. > >Rev. Andy Dear Andy, First of all, there is a MacApp dedicated newsgroup : comp.sys.mac.oop.macapp3. Now , your questions : 1. MacApp is very depended on its resources. You need to include in your project MacApp.r,DIalog.r,Debug,r(for Debug version),Printing.r as minimum. And of course, you own resource build in ViewEdit. Do not forget to call MA_REGISTER_CLASS(in 3.3) or macroDontDeadStrip(in 3.1.4) for views you defined in ViewEdit. The only way to find out what is missing - debugger. 2. ViewEdit is not a best choice for MacApp views editing. Use Ad Lib instead. Yuo donnot need to duplicate menus in CMNU and MENU. 3.You need to insert num of rows you need. 4.Double-click does not supported in TGridView, but you can override DoMouseCommand of you view and examine TTolboxEvent for number of clicks. 5.Try to look on Apple MacApp examples - DemoText,DemoDialogs - it's a good examples of MacApp appplications. 6. CodeWarrior is, to my mind, the best choice. Use Rez compiler to compile MacApp resources. Hope this helps -- //\\ Lev Knopov \\// Scitex Israel /// \\\ Lev_Knopov@mail.stil.scitex.com Lev Knopov Lev_Knopov@mail.stil.scitex.com Scitex Israel --------------------------- >From mneylon@engin.umich.edu (Michael K. Neylon) Subject: Matching struct definitions to TMPL resources Date: 22 Jan 1996 14:21:11 GMT Organization: University of Michigan Engineering, Ann Arbor I have a preferences structure in my program, which I read in from the data fork of my prefs file. When generating this prefs file for a new user, I have a 'pref' resource and a 'TMPL' resource. The latter should describe the order and size of each item in the 'pref' resource, and then I set up the default values in the 'pref' resource. However, I am having trouble synchonizing the prefs TMPL to the prefs structure. One of the problems is that I cannot find anywhere where there is a full list of 4-letter codes that describe the types that can be used within the TMPL. Also, I would think that I may need to do some struct alignment within my program, but again, I'm not sure if this is necessary, much less how to do it. Any help with this would be appriciated...TIA... -- Michael K. Neylon, Graduate Student | "Pausing only to reconstruct Dept. of ChE, Univ. of Michigan | the whole of integral mneylon@engin.umich.edu | mathematics, he continues http://www-personal.engin.umich.edu/~mneylon/ | on..." Marvin - tHGttG +++++++++++++++++++++++++++ >From jeff@ntsi.com (Jeff Miller) Date: Thu, 25 Jan 1996 19:59:04 -0800 Organization: Network TeleSystems, Inc. In article <4e06gn$7a7@srvr1.engin.umich.edu>, mneylon@engin.umich.edu (Michael K. Neylon) wrote: > However, I am having trouble synchonizing the prefs TMPL to the > prefs structure. One of the problems is that I cannot find > anywhere where there is a full list of 4-letter codes that describe > the types that can be used within the TMPL. >From the ResEdit Reference book (I apologize for the formatting, I copied this from Acrobat): These are the types you may choose from for your editable data fields: DBYT, DWRD, DLNG Decimal byte, decimal word, decimal long word HBYT, HWRD, HLNG Hex byte, hex word, hex long word AWRD, ALNG Word align, long align FBYT, FWRD, FLNG Byte fill, word fill, long fill (with 0) HEXD Hex dump of remaining bytes in resource (This can only be the last type in a resource.) PSTR Pascal string (length byte followed by the characters) LSTR Long string (length long followed by the characters) WSTR Same as LSTR, but a word rather than a long word ESTR, OSTR Pascal string padded to even or odd length (needed for DITL resources) CSTR C string (characters followed by a null) ECST, OCST Even-padded C string, or odd-padded C string (padded with nulls) BOOL Boolean (two bytes) Note Scrolling can become extremely slow if a template contains many BBIT or BOOL items. ResEdit does the appropriate type checking for you when you put the editing dialog window away. The template mechanism is flexible enough to describe a repeating sequence of items within a resource, as in 'STR#', 'DITL', and .'MENU' resources. You can also have repeating sequences within repeating sequences, as in 'BNDL' resources. To terminate a repeating sequence, put the appropriate code in the template as follows: BBIT Binary bit (There must be 8 or an even multiple of 8 of these; if fewer than 8 bits are defined, you must include placeholder bits.) TNAM Type name (four characters, like OSType and ResType) CHAR A single character RECT An 8-byte rectangle Hnnn A 3-digit hex number; displays nnn bytes in hex format Cnnn A C string that is nnn hex bytes long (The last byte is always a 0, so the string itself occupies the first nnn-1 bytes.) P0nn A Pascal string that is nn hex bytes long (The length byte is not included in nn, so the string occupies the entire specified length.) LSTZ LSTE List Zero–List End. Terminated by a 0 byte (as in 'MENU' resources). ZCNT LSTC LSTE Zero Count/List Count–List End. Terminated by a zero-based word count that starts the sequence (as in 'DITL' resources). OCNT LSTC LSTE One Count/List Count–List End. Terminated by a one-based word count that starts the sequence (as in 'STR#' resources). LSTB LSTE List Begin–List End. Ends at the end of the resource. (As in 'acur' and 'APPL' resources.) The LSTB (list-begin) code begins the repeating sequence of items, and the LSTE code is the end. Labels for these codes are usually set to the string "*****". Both of these codes are required. It is generally advisable to keep the beginning and ending labels identical to each other and to have them be no more than five characters long. Jeff - ----------------------------------------------------------- Jeff Miller | jeff@ntsi.com | Network TeleSystems, Inc. - ----------------------------------------------------------- --------------------------- >From mrw@welchgate.welch.jhu.edu (mrw) Subject: Menu Manager limitations? Date: 20 Jan 1996 21:30:17 GMT Organization: Johns Hopkins University I can't find this information in IM. What is the limit to the number of items I can put in a 'MENU' resource? I am displaying these items in a PowerPlant StdPopupmenu object. Thanks in advance, -marty +++++++++++++++++++++++++++ >From jwbaxter@olympus.net (John W. Baxter) Date: Sat, 20 Jan 1996 20:52:30 -0800 Organization: Internet for the Olympic Peninsula In article <4drmt9$mcb@news.jhu.edu>, mrw@welchgate.welch.jhu.edu (mrw) wrote: >I can't find this information in IM. > >What is the limit to the number of items I can put in a 'MENU' >resource? I am displaying these items in a PowerPlant StdPopupmenu >object. You can put any number of items (any number you're likely to want to) into a MENU resource as far as Inside Mac is concerned. Only the first 31 can be enabled/disabled in the resource or in code, since only those have bits available in the 32-bit word in the resource and menu record which holds those flags. (I think there's a signed 2-byte count, so 32767 is the limit, but you don't want that many, so it's moot.) --John -- "Officials said the collision was caused by the fog, which was as thick as sea poop." John W. Baxter Port Ludlow, WA jwbaxter@olympus.net +++++++++++++++++++++++++++ >From pcastine@prz.tu-berlin.de (Peter Castine) Date: Wed, 24 Jan 1996 11:05:58 +0100 Organization: Process Control Center, TU Berlin In article <4drmt9$mcb@news.jhu.edu>, mrw@welchgate.welch.jhu.edu (mrw) wrote: >What is the limit to the number of items I can put in a 'MENU' >resource? I am displaying these items in a PowerPlant StdPopupmenu >object. You will take serious performance hits (not to mention having created an abysmal user interface) long before you get to the technical limits of the number of items in a menu. There is a HIG recommendation to the effect that (with the exception of dynamic menus, such as a Font menu) you shouldn't have more menu items than what would fit _without_ scrolling on a 9" classic screen. This was something like 17 or 21 items. Macs with 9" screens haven't been produced for quite a while now, but there are still some around (I believe John Norstrad's most valued UI-tester uses a Mac with 512x342 screen resolution). As to the technical limits: a look at the MenuInfo data structure suggests the only limit is available memory; the Resource Manager has supported resources > 32,767 bytes for years now. The implementation of Menu Manager traps might put a limit at 32 or 16k items, but you'll have to do some ROM disassembly to find out for sure (and even then, you never know what future trap patches might do). Hope this helps, Peter - -------- For a good time, http://www.prz.tu-berlin.de/~pcastine --------- Dr. Peter Castine | Whenever I hear anyone arguing for slavery, I pcastine@prz.tu-berlin.de | feel a strong impulse to see it tried on him Process Control Center | personally. Technical University Berlin | -- Abraham Lincoln --------------------------- >From hvision@pophost.eunet.be (hypervision) Subject: Programming a PinnBall Date: Tue, 02 Jan 1996 22:45:11 -0100 Organization: hypervision A couple of days ago i finished my first (beta) pinball. Collision detection, bouncing, gravity, multiple heigths, whatever... it all works nice and fast. The only problem is that i have some problem with the 'feel' of the game : the ball doesn't seem to make a really realistic drop (although the algorithm is pure physics, and it is correct (i hope)) I guess the trick is to set the parameters correctly. So here i go : - when calculating gravity, i add (every 5 ticks or so) a small amount to the ball's vertical velocity. how much should i add ? (in terms of the ball's size, which is variable and currently set to 40x40 pixs in a 640x480 pinball arena) I tried a bunch of values ranging from 0.5 to 1.5, but they all seem weird (greater than 1.5 flips the ball out of the arena) - when the ball bounces an object, i calc the refraction vector and set that to the new velocity of the ball. Should i scale this velocity also ? How much would be a logical value (considering non-bouncing objects. i.e. plain walls) - am i forgetting something crucial ? If i ever finish this thing entirely (currenlty working on sounds and moveable parts), i'll probably release the source code. Thanks in advance Grendel. +++++++++++++++++++++++++++ >From jregier@qualcomm.com (Jason Regier) Date: Tue, 02 Jan 1996 17:49:55 -0800 Organization: Qualcomm, Inc. In article <hvision-0201962245110001@193.75.128.7>, hvision@pophost.eunet.be (hypervision) wrote: Re: getting a pinball simulator to simulate well: > - when calculating gravity, i add (every 5 ticks or so) a small amount > to the ball's vertical velocity. how much should i add ? (in terms of the > ball's size, which is variable and currently set to 40x40 pixs in a > 640x480 pinball arena) > I tried a bunch of values ranging from 0.5 to 1.5, but they all seem weird > (greater than 1.5 flips the ball out of the arena) > Well, I have no idea what kind of value is appropriate numerically, but you can take some physical measurements and do some back-of-the-envelope calculations to come up with a reasonable number. Here's some tips to get you started... First of all, it doesn't matter if your ball is huge or not. From physics, you know F=ma, and the acceleration due to gravity is a constant 9.8 m/s^2. Now your ball isn't moving vertically through space, so you know that it can't be effectively feeling the full force of gravity. Given the length of the pinball table and the height at the scoreboard (both of which are easy to measure) you can compute the angle of tilt on the pinball table using trigonometry. Multiply the 9.8 m/s^2 for vertical motion times the sine of the angle of tilt, and you'll have the effective acceleration on the ball. This number is in m/s^2, so you need to start converting units to get things right. Find an appropriate conversion factor between physical lengths and pixel distances, and some constant time multiplier to get your times right, and you should be all set. You will have to tweak these conversion factors to get the effect you want, but once you're all done, it should hopefully look pretty good. Of course, this is physics-dork way of doing things, and you might want to just play with numbers instead (as you were doing) until something looks cool. > - when the ball bounces an object, i calc the refraction vector and set > that to the new velocity of the ball. Should i scale this velocity also ? > How much would be a logical value (considering non-bouncing objects. i.e. > plain walls) You'd calculate the reflected velocity vector, and set the ball's new velocity to that. Realistically, you should scale this number by some constant factor to account for the elasticity of the collision. TOTMGPG has some stuff on this, but the gist is this: if you multiply by an elastic factor of 0, then your balls stops when it hits the object. This is an inelastic collision, and you definitely don't want that. If you set the elasticity to 1, then you ball doesn't lose any energy in the collision, and it has the same speed entering and leaving. Realistically, you want your ball to lose a bit in the collision so try 0.8 or so for that factor. > - am i forgetting something crucial ? > Just remember to be somewhat accurate in your calculations. Nothing is more annoying than a pinball game where it's REALLY easy to make the same shot twice. Good luck! Jason -- Jason Regier GlobalStar Software Engineer QUALCOMM, Inc. (619) 658-4752 jregier@qualcomm.com +++++++++++++++++++++++++++ >From jmunkki@beta.hut.fi (Juri Munkki) Date: 3 Jan 1996 03:36:30 GMT Organization: Helsinki University of Technology In article <jregier-0201961749550001@jregier-mac.qualcomm.com> jregier@qualcomm.com (Jason Regier) writes: >In article <hvision-0201962245110001@193.75.128.7>, >hvision@pophost.eunet.be (hypervision) wrote: >> - am i forgetting something crucial ? >Just remember to be somewhat accurate in your calculations. Nothing is >more annoying than a pinball game where it's REALLY easy to make the same >shot twice. For a good game of pinball, I would think that it would be important to model ball spin as well. It's mathematically a bit tougher than the collisions and motion without it, but it should be possible to take shortcuts. For a really good implementation, I would think that quaternions might come in handy. I don't know if any computer pinball games model spin...all of the ones that I have tried have felt more like video games rather than the real thing. It may also be a good idea to run the simulation at an extremely high frame rate (say 100-500 frames per second) and draw the results at around the screen refresh rate (motion blurring the ball is a very good idea). The material of the bumper should determine how the ball bounces off on a collision. A very hard surface will conserve energy very well. A soft surface will absorb the energy. A rubbery surface would first absorb the energy and then bounce back, restoring the momentum (but not the spin). Most computer pinballs seem to use brownian motion simulation to jitter the ball so that it doesn't get stuck so easily. I don't like it when they overdo it, but I guess it's a necessary evil. -- Juri Munkki jmunkki@iki.fi Life is easy when polygons are cheap. http://www.iki.fi/~jmunkki Windsurfing: Faster than the wind. +++++++++++++++++++++++++++ >From johnb@hk.super.net (John W. Blackburne) Date: Wed, 03 Jan 1996 21:28:36 +0800 Organization: Tempest In article <hvision-0201962245110001@193.75.128.7>, hvision@pophost.eunet.be (hypervision) wrote: :A couple of days ago i finished my first (beta) pinball. :Collision detection, bouncing, gravity, multiple heigths, whatever... it :all works nice and fast. The only problem is that i have some problem with :the 'feel' of the game : the ball doesn't seem to make a really realistic :drop (although the algorithm is pure physics, and it is correct (i hope)) : :I guess the trick is to set the parameters correctly. So here i go : : : - when calculating gravity, i add (every 5 ticks or so) a small amount :to the ball's vertical velocity. how much should i add ? (in terms of the :ball's size, which is variable and currently set to 40x40 pixs in a :640x480 pinball arena) :I tried a bunch of values ranging from 0.5 to 1.5, but they all seem weird :(greater than 1.5 flips the ball out of the arena) First for realism you should have some sort of constant time base. One way is to do your calcs at frequent fixed intervals, e.g. 20 times a second, either by making sure your graphics can be done in 0.05 sec then waiting between redraws until 0.05 sec later, or by having a time manager task doing the velocity calcs independent of screen redraw every 0.05 sec. If you find it difficult to do your calcualations at fixed times use the time between your calculations in your calcuations as a scaling factor. E.g. if your accn is m then use this_time = MyGetTime() v = v + m * (this_time - last_time) last_time = this_time In the above m is acceleration due to gravity. On a sloped surface this should be about 9.8 * sin (angle_of_slope) (m/s^2), scaled to fit it on screen. (Both v and m are vectors, so the above is not real code in any language I use.) For added realism you could include a drag factor: this is probably not very significant in pinball but it does act as a limiting factor on speed, and so is noticable in some circumstances. Adding in a drag factor d to the above formula you get v = v + (m - (d * v)) * (this_time - last_time) The best value for d can be determined by trial an error, but it should probably be a small number, e.g. 0.1. One guide is that the above equation gives no change in velocity when (m - (d * v)) = 0, i.e. when v = m/d, which will be the 'terminal' or maximum velocity of the ball as it rolls down the sloped table. You should do your calcuations at a much higher resolution than the screen resolution, e.g. use fixed point or floating point arithmetic. Fixed point is best where you're doing a lot of calcuations and can't rely on a floating point co-porcessor being present, though with only one moving object most of the time you might find floats easier. Then just take the integer part when plotting to screen. : - when the ball bounces an object, i calc the refraction vector and set :that to the new velocity of the ball. Should i scale this velocity also ? :How much would be a logical value (considering non-bouncing objects. i.e. :plain walls) The easiset way is probably to use surface normals, then do something like v = v - n * ((v.n) * (1 + e)) n is the unit normal vector, the '.' is a dot product, and e is the coefficient of resitution. You then just need a table of n and e for each surface. As Juri noted the amount of reflection will vary for different surfaces, from e=0 for no bounce to e=1 for a perfect bounce, with no energy lost. Again experiment to see what is best. You might also want to include spin, but this makes it a fair bit more complex, as at each colision you'd want to not only check how much spin effected the impact (typically by ginving it a boost along the surface) but also how much the surface affected he spin, which would depend on the surface and the angle of impact. Spin would also effect it's trajectory. : - am i forgetting something crucial ? Magnets. Some of the most fun pinball games I've played have had magnets, or even better electro-magnets, invisibly embedded in the playing surface. Note that I am not a very good pinball player, so the degree of randomness such would introduce did not bother me. Tilt. Not sure how you'd do this, I've seen a couple of computer implementations, neither of them impressed me. Pits/ramps. You could use most of the calculations above but would want to vary both the magnitude and direction of the vector m. John -- John Blackburne, johnb@tempest.net.hk Programmer Asia, Inc. Online: http://www.asia-inc.com Technology consultant and trainer: http://www.hk.super.net/~johnb +++++++++++++++++++++++++++ >From jregier@qualcomm.com (Jason Regier) Date: Wed, 03 Jan 1996 10:15:14 -0800 Organization: Qualcomm, Inc. In article <johnb-0301962128360001@0.0.0.0>, johnb@hk.super.net (John W. Blackburne) wrote: > Adding in a drag factor d to the above formula you get > > v = v + (m - (d * v)) * (this_time - last_time) > I think you might get more "realistic" results if you tried d * v^2 and made d a small number. If you make d too high, it will look like playing pinball in a viscous medium like oil, which is a pretty strange effect. Honestly, you might want to scrap drag altogether. The drag on a pinball is pretty darn small-- most of your energetic losses occur when you hit objects like bumpers and targets. Juri, you brought up spin. Spin would be REALLY cool to see implemented. But are you sure that you'd want to use quaternions? Quaternions are great for doing rotations in 3D space, but for a top-down pinball game (like all the ones I've seen) you don't have 3 angles of rotation to deal with. There should be only 2: one in the vertical plane, and one in the horizontal plane (horizontal meaning in the plane of the screen, and vertical meaning perpendicular to the screen). If you further assume that all your bumpers and flippers make contact with the ball through the center of the ball, then you can't really impart any weird spin in the vertical direction, so the problem pretty much reduces down to one angle. You can calculate the amount of horizontal spin by simply looking at where the ball contacts an object, the rotational moment of inertia for a sphere, and some physics. > Magnets. Way cool, and probably pretty easy to add. Just assume some 1/r^2 force relation for your "point" magnetic source (where r is the distance between the ball and the magnet). This just appears as another acceleration acting on your ball when you go to calculate the ball's next position and velocity vectors. And when the magnet's not on, the force/acceleration disappears. > Tilt. Not sure how you'd do this, I've seen a couple of computer > implementations, neither of them impressed me. > I'd guess that you check to see if you're within some distance of an object. If you are, then make the ball hit the wall. Tilting and slapping is more like imparting an impulse to the ball, which corresponds to an instantaneous change in velocity. If you are slamming the pinball table forward (i.e. vertically on the screen), then when calculate the collision, SUBTRACT some number from the ball's vertical velocity when calculating the collision. Likewise, if you slap on the left of the table, when you do the collision, make the ball appear as if it were really traveling faster towards the left than it really is. > Pits/ramps. You could use most of the calculations above but would want to > vary both the magnitude and direction of the vector m. > For pits and ramps, you could probably get away with faking it. It seems pretty silly to me to make all your calculations in 3D just because you add one ramp. Here's how I'd fake a ramp: I basically am envisioning a two-state system, where you're either on the ramp or you're not... let a boolean variable RAMP (one for each ball) keep track of this. As the ball passes through the entrance to a ramp, toggle RAMP appropriately. Thus, if you never pass through the entrance, RAMP is 0, indicating that you never made it up the ramp, and your game progresses normally. If RAMP is 1, then you're on the ramp. Draw appropriately, and add forces when on the ramp to simulate the hump that you have to get over to stay on the ramp. This a pretty cool discussion! Later, Jason -- Jason Regier GlobalStar Software Engineer QUALCOMM, Inc. (619) 658-4752 jregier@qualcomm.com +++++++++++++++++++++++++++ >From jmunkki@beta.hut.fi (Juri Munkki) Date: 4 Jan 1996 02:30:28 GMT Organization: Helsinki University of Technology In article <jregier-0301961015140001@jregier-mac.qualcomm.com> jregier@qualcomm.com (Jason Regier) writes: >Juri, you brought up spin. Spin would be REALLY cool to see implemented. >But are you sure that you'd want to use quaternions? Quaternions are >great for doing rotations in 3D space, but for a top-down pinball game >(like all the ones I've seen) you don't have 3 angles of rotation to deal >with. There should be only 2: one in the vertical plane, and one in the >horizontal plane (horizontal meaning in the plane of the screen, and >vertical meaning perpendicular to the screen). If you further assume that >all your bumpers and flippers make contact with the ball through the >center of the ball, then you can't really impart any weird spin in the >vertical direction, so the problem pretty much reduces down to one angle. >You can calculate the amount of horizontal spin by simply looking at where >the ball contacts an object, the rotational moment of inertia for a >sphere, and some physics. I didn't give it too much thought, so maybe quaternions are overkill, but it seemed to me that spin would affect the ball motion when it was traveling (touching only at the bottom), so you would want to know the distance and direction it has rotated at the bottom and bleed some of that into the acceleration or deceleration fo the ball. This also goes the other way: some of the ball speed is converted into rotational energy. If the spin of the ball is in synch with the motion, no energy transfer happens. Then, when the ball hits an obstacle, it might be necessary to get the rotation in the same manner, but against the surface that it hit. Spin is one of the reasons why the ball may fly up when it hits an obstacle: the ball rotation is converted into upward motion. I think rotational physics are my weakest area, so you may be right and I might be wrong. Still, I'm sure quaternions would guarantee the correct results whereas taking shortcuts could produce more complicated code that doesn't quite match reality. -- Juri Munkki jmunkki@iki.fi Life is easy when polygons are cheap. http://www.iki.fi/~jmunkki Windsurfing: Faster than the wind. +++++++++++++++++++++++++++ >From jregier@qualcomm.com (Jason Regier) Date: Thu, 04 Jan 1996 10:05:23 -0800 Organization: Qualcomm, Inc. In article <4cfe44$7ne@nntp.hut.fi>, jmunkki@beta.hut.fi (Juri Munkki) wrote: > I didn't give it too much thought, so maybe quaternions are overkill, > but it seemed to me that spin would affect the ball motion when it > was traveling (touching only at the bottom), so you would want to > know the distance and direction it has rotated at the bottom and > bleed some of that into the acceleration or deceleration fo the ball. Since we're kinda assuming that there is negligible friction between the ball and the waxed pinball table, then the spin of the pinball won't affect the way the ball moves across the surface of the table. If you assume that there is some friction, then you're right, the spin of the ball will affect its motion across the table. But regardless of table friction, the spin of the ball WILL affect its path after a collision. And like you said, this would produce a variety of neat, strange effects. Given the rotational and translational velocities of the ball prior to the collision, you can find it's starting energy. If the collision is say, 80% elastic, you know that your energy after the collision is %80 of the starting energy. The trick is determining how much of that final energy goes into translational motion and how much goes into rotational motion. Oh, and I just think quaternions seem like overkill because they're designed for rotations in 3D space. If you take the top-down view, then like I said before, the only angle you really care about is rotation in the plane of the table. > Still, I'm sure quaternions would guarantee the correct results whereas taking > shortcuts could produce more complicated code that doesn't quite match > reality. > Yep, you may be right. Jason -- Jason Regier GlobalStar Software Engineer QUALCOMM, Inc. (619) 658-4752 jregier@qualcomm.com +++++++++++++++++++++++++++ >From jmunkki@beta.hut.fi (Juri Munkki) Date: 5 Jan 1996 01:13:50 GMT Organization: Helsinki University of Technology In article <jregier-0401961005230001@jregier-mac.qualcomm.com> jregier@qualcomm.com (Jason Regier) writes: >Since we're kinda assuming that there is negligible friction between the >ball and the waxed pinball table, then the spin of the pinball won't >affect the way the ball moves across the surface of the table. If you >assume that there is some friction, then you're right, the spin of the >ball will affect its motion across the table. I would think that the friction between the ball and table can be considerable, if the ball is not rolling on the surface. If the spin is left out and the friction with the the table is left out, you don't have a pinball game: you get a weird sort of air hockey or "shufflepuck" game. If you want to see ball spin affecting its trajectory on a table, take a look at the Williams pinball Whirlwind. The ball acts like it is drunk after a few spins in the whirlwind. My advice to the person who was writing this pinball is: learn the physics, do the math and impress everyone by the incredible realism. -- Juri Munkki jmunkki@iki.fi Life is easy when polygons are cheap. http://www.iki.fi/~jmunkki Windsurfing: Faster than the wind. +++++++++++++++++++++++++++ >From Robert Grant <grant@informix.com> Date: Fri, 05 Jan 1996 13:27:39 -0800 Organization: Informix Software, Inc. Menlo Park, CA 94025 All this spin stuff is interesting, but how is the interaction with the flipper handled? Something that is very common in pinball is catching the ball with the flipper and then letting it roll down before flipping it back up the table - hopefully at the desired angle. This seems to me to be fairly complicated or am I missing something? Robert. +++++++++++++++++++++++++++ >From jmunkki@beta.hut.fi (Juri Munkki) Date: 6 Jan 1996 03:18:37 GMT Organization: Helsinki University of Technology In article <30ED97CB.3401@informix.com> Robert Grant <grant@informix.com> writes: >All this spin stuff is interesting, but how is the interaction >with the flipper handled? Something that is very common in >pinball is catching the ball with the flipper and then letting >it roll down before flipping it back up the table - hopefully >at the desired angle. This seems to me to be fairly >complicated or am I missing something? Laws of physics are not really complicated. Yet, if you try to take shortcuts, the shortcuts can become complicated. A very high internal frame rate combined with rotational energy calculations should make the flipper interaction realistic. The roll of the ball keeps it glued to the flipper and guide. -- Juri Munkki jmunkki@iki.fi Life is easy when polygons are cheap. http://www.iki.fi/~jmunkki Windsurfing: Faster than the wind. +++++++++++++++++++++++++++ >From slamtilt@mcs.com (Samuel Zehr) Date: Sat, 06 Jan 1996 02:09:18 -0600 Organization: Pixie Enterprises In article <4chu0e$nca@nntp.hut.fi>, jmunkki@beta.hut.fi (Juri Munkki) wrote: > In article <jregier-0401961005230001@jregier-mac.qualcomm.com> jregier@qualcomm.com (Jason Regier) writes: > >Since we're kinda assuming that there is negligible friction between the > >ball and the waxed pinball table, then the spin of the pinball won't > >affect the way the ball moves across the surface of the table. If you > >assume that there is some friction, then you're right, the spin of the > >ball will affect its motion across the table. > > I would think that the friction between the ball and table can be > considerable, if the ball is not rolling on the surface. If the spin > is left out and the friction with the the table is left out, you > don't have a pinball game: you get a weird sort of air hockey or > "shufflepuck" game. > Actually, the ball doesn't roll as much as you would think - it glides. That's what makes pinball so non-obvious. The ball is on a mylar surface, so the spin of the ball can easily be opposite to the direction of movement. In a factory new pinball game, the ball really shouldn't 'roll' at all... sz -- Samuel Zehr "My mom said it looked like a Anonymous title pretty little rose" Anonymous company --Bernd Meierbachtol +++++++++++++++++++++++++++ >From jhs@olden.Princeton.EDU (James Shaw) Date: 11 Jan 1996 15:24:26 GMT Organization: Computer Science Department, Princeton University Jason Regier writes: > This a pretty cool discussion! Agreed. I've also been working on a shapes engine to support pinball as well as some other physically based games. I've got the basic collision detection for most important shapes in but I've only got the typical simple rotationless physics. I'd like to continue this discussion (either in news or in email) of the solutions (and implementations) of spin and rotation. Juri started it out with: > For a good game of pinball, I would think that it would be important to > model ball spin as well. It's mathematically a bit tougher than the > collisions and motion without it, but it should be possible to take > shortcuts. For a really good implementation, I would think that > quaternions might come in handy. And Jason continues with: > Juri, you brought up spin. Spin would be REALLY cool to see implemented. [ Discussion of quaternions deleted. ] I'll agree with Juri; I think quaternions are needed. There are three angles of rotation: spin (e.g. from top view the ball acts like a top), rolling (the balls rotational motion in the direction it is moving) and "english" or anti-rolling (the rotation part perpendicular to the balls direction which takes it off course). For example, from an unmoving ball getting struck by the plunger, shouldn't the need to start rotating, bleed some translational energy away. And the big question: how does rolling bounce? Also, even if quaternions aren't needed for pinball. How about a realistic billiards game? Juri continued with: > If you want to see ball spin affecting its trajectory on a table, > take a look at the Williams pinball Whirlwind. The ball acts like > it is drunk after a few spins in the whirlwind. > My advice to the person who was writing this pinball is: learn the > physics, do the math and impress everyone by the incredible realism. Good suggestion. I'd like to take you up on it but, better yet, I'd like to get a small list of people who would like to discuss this in detail. I'll be happy to start with my guess of the physics but I'd like others to discuss it with and to check my work. I'm hoping that either Juri or Jason or both would be interested, but also any lurkers who think that they can contribute. Interested? Please email me, or just continue the thread. Best, James jhs@cs.princeton.edu +++++++++++++++++++++++++++ >From pottier@bireme.ens.fr (Francois Pottier) Date: 11 Jan 1996 19:54:53 GMT Organization: Ecole Normale Superieure, Paris In article <4d3a3a$7na@cnn.Princeton.EDU>, James Shaw <jhs@olden.Princeton.EDU> wrote: >I'll agree with Juri; I think quaternions are needed. There are three >angles of rotation: How are quaternions used for modelling rotations? In classical physics any rotation is usually represented by a vector W, and a vector product is used to compute the image of a given vector by the rotation, i.e. after a time t, vector X becomes Wt /\ X. (W is actually called a pseudo-vector because it is dependent on the choice of a direct base, but that is a physical consideration which isn't very important for modelling). As far as I know quaternions are elements of a non-commutative field H. How can they be used for rotations. It's been a few years since I left the physics class... -- Francois pottier@dmi.ens.fr http://www.eleves.ens.fr:8080/home/pottier/ +++++++++++++++++++++++++++ >From jmunkki@beta.hut.fi (Juri Munkki) Date: 12 Jan 1996 11:09:56 GMT Organization: Helsinki University of Technology In article <4d3pud$p77@nef.ens.fr> pottier@bireme.ens.fr (Francois Pottier) writes: >How are quaternions used for modelling rotations? SIGGGraph'85, page 245: "Animating Rotations with Quaternion Curves" by Ken Shoemake. It mostly deals with interpolating rotations using quaternions, but provides a lot of references and a basic discussion of how quaternions convert to rotation. The Graphics Gems book series also has a lot of articles on quaternions. I still only have the first book (shame on me), but it has a basic discussion of quaternions on page 498: "Using Quaternions for Coding 3D Transformations" by Patrick-Gilles Maillot. The source code is available on anonymous ftp. -- Juri Munkki jmunkki@iki.fi Life is easy when polygons are cheap. http://www.iki.fi/jmunkki Windsurfing: Faster than the wind. +++++++++++++++++++++++++++ >From jregier@qualcomm.com (Jason Regier) Date: Mon, 15 Jan 1996 16:36:03 -0800 Organization: Qualcomm, Inc. In article <4d3a3a$7na@cnn.Princeton.EDU>, jhs@olden.Princeton.EDU (James Shaw) wrote: > I'll agree with Juri; I think quaternions are needed. There are three > angles of rotation: spin (e.g. from top view the ball acts like a top), > rolling (the balls rotational motion in the direction it is moving) and > "english" or anti-rolling (the rotation part perpendicular to the balls > direction which takes it off course). > First of all, quaternions are 4 component vectors with some really neat properties that lend themselves quite nicely to rotations, especially in 3D graphical systems. I don't know nearly as much about these as I could or probably should, but for more info, check out more advanced 3D Computer Graphics books. Also, Embedded Systems magazine has had several extensive articles in the past about rotations with quaternions, most of them called something like "The Spin Doctors". If I understand correctly, quaternions basically give you some powerful alternatives to dealing with Euler angles. If you're dealing with 2D systems, I get the strong impression that quaternions may be a little heavy duty for the job. Physically, if you apply a force through the center of mass of an object, you're imparting purely translational energy and zero rotational energy. But we all know that frictional forces act at the edge of a ball, so there's bound to be some energy going into the rotation of the pinball as it moves across the playing surface. But the question is can you see those 3 dimensions of spin on a pinball in real life? I can't. I can see when somebody spins the ball really fast (i.e. Whirlwind) and it dances around like a top. But I've never seen a pinball react to some backspin like a cue ball does on a pool table. Thus, if I were modelling a pinball game, I'd ignore backspin and only simulate the spin I could see in the real world. > Also, even if quaternions aren't needed for pinball. How about > a realistic billiards game? > Well, that's a different story. I don't think there's really any way you can do a realistic billiards game without taking into account all the directions of english. (You might think there's only back/topspin and side english, but masse and jump shots can produce spin in the 3rd direction). Sounds to me like quaternions might be really handy here. And I'd love to see a great pool game-- I've yet to check out Virtual Pool. Anybody know if it's good? Jason -- Jason Regier GlobalStar Software Engineer QUALCOMM, Inc. (619) 658-4752 jregier@qualcomm.com +++++++++++++++++++++++++++ >From johnb@hk.super.net (John W. Blackburne) Date: Tue, 16 Jan 1996 19:12:45 +0800 Organization: Tempest In article <jregier-1501961636030001@jregier-mac.qualcomm.com>, jregier@qualcomm.com (Jason Regier) wrote: :But the question is can you see those 3 dimensions of spin on a pinball in :real life? I can't. I can see when somebody spins the ball really fast :(i.e. Whirlwind) and it dances around like a top. But I've never seen a :pinball react to some backspin like a cue ball does on a pool table. :Thus, if I were modelling a pinball game, I'd ignore backspin and only :simulate the spin I could see in the real world. I would forget about backspin on this too. Apart from it being invisible it would not appear because of the dynamics. You can get sidespin from a ball striking a rough barrier at a shallow angle. To get backspin you would need to either have the ball contact a barrier on a point on the top or bottom. You could do that with a barrier like this _________ \ -------- (or something even steeper) but how many of these do you see on a pinball table ? Or you could 'flick' a ball off a barrier, as you can with a marble by pushing down with it under the edge og your thumb, but again does this mak sense on a pinball table. I'm not even sure sidespin would be necessary. I recently downloaded the demo of the Mac pinball game 'Loony Labyrinth', and while watching it run in demo mode I carefully looked out for any sign of spin, and could see none, as far as I could tell. But it's a fine game. What makes it so ? A varied, interesting, multi-level table, excellent graphics and sound and very smooth gameplay, with very straighforward mechanics as far as I could tell. John -- John Blackburne, johnb@tempest.net.hk Programmer Asia, Inc. Online: http://www.asia-inc.com Technology consultant and trainer: http://www.hk.super.net/~johnb +++++++++++++++++++++++++++ >From jinjur@kudonet.com (john calhoun) Date: 18 Jan 1996 04:21:00 GMT Organization: Scheherazade Software In article <DL8Crv.37r@olsen.ch>, james@olsen.ch (James Shaw) wrote: > This had an interesting effect on the simulation. I had to > define how elastic collisions worked for a ball striking a surface. > I ruled that the spin reverses along the normal, just like translational > motion. It can be anywhere from inelastic to elastic just like > translational collisions. I have this image in my head of a rolling > gear catching against the side of something and bouncing back, but > otherwise, don't know if this bouncing is physically valid. Comments? Doesn't sound right. If the ball is spinning like a top when it collides with a barrier, you would expect the angle of deflection (off the barrier) to be modified and (perhaps) the spin to completely stop at the instant of collision (giving over it's rotational momentum to a change in direction of the ball). Imagine a billiard ball spinning like a top hitting a side rail dead on (perpindicular), it shouldn't bounce straight back along the path of incidence - it should instead come off at some angle. For the instant at which the side of the ball contacts the side rail (assuming friction and thus elasticity) there will be a sudden torque that converts into a translational (no longer rotational) force. I think the velocity the ball was going when it struck the rail (how hard it pressed into the rail) and the the coefficent of friction between the ball and the rail would determine both the maginitude of the torque moment and thus the degree to which the spin was reduced. > Rolling had the effect of, with gravity, losing energy in the system. > This was at least in my implementation. I had an explanation in > my head why this would happen but I can't explain it at the moment. I don't understand your wording on this for several reasons. I don't see how gravity causes a thig to "lose" energy, nor do I see how rollinf or spin would either. Now, if a ball has back soin that is slowly translated into translational motion, I would expect some friction between the ball and the surface and thus some heat produced. Perhaps this is what you meant by a loss of energy in the system. > I didn't do anything with the interaction of the 3 directions of > rotation. I think they are independent but I don't have a physical > arguement yet. I don't buy into that exactly. There is a definite "gyroscope" action going on that will prevent a spinning top (or ball) from rolling over, but friction with the surface the ball is on might tend to erode that. Get a ball spinning like a top on a coffee table, and then pick up one end of the coffee table. You expect the incline to start the ball sliding down the table - and you expect as well the ball to try and maintain it's original spin. But how would the friction of sliding down the table act on the ball? Would that small moment of force start to tip the balls spin? Sounds like you might just need to tweak your system a bit and you'll have it. john calhoun- +++++++++++++++++++++++++++ >From jmunkki@beta.hut.fi (Juri Munkki) Date: 18 Jan 1996 00:39:40 GMT Organization: Helsinki University of Technology In article <DL8Crv.37r@olsen.ch> james@olsen.ch (James Shaw) writes: >If anyone else is interested, I'd like to start an email discussion of >the physics. There are enough mistakes that can be made so multiple >participants would be helpful. I think the topic is very suitable for the newsgroup, so I would keep the discussion alive here and let everyone contribute. I'm extremely tied up with Avara, so any time spent here comes from my recreational time quota and shouldn't involve "deep thought". ;) I'm glad you tried the spin and I'm glad you like the results. Even if it is not absolutely correct, the added twist of handling spin (does that count as pun?) will probably be appreciated by people who play your game. It still seems to me that quaternions would provide the ideal simple solution for handling all kinds of spin: with any kind of motion you'll have just a surface normal for the surface that you are hitting or touching, a motion vector and a quaternion. The tough part is then handling the situation where the ball bounces up from the 2D plane. But as with anything else having to do with rotations, quaternions are just one solution. I haven't used them much (just some rotation interpolations for objects and camera motion in 3D), but I have a feeling that they would be the elegant solution for pinballs as well. As long as you have a limited amount of balls (say under 10), most machines should be able to handle any kind of math you want to throw at them. -- Juri Munkki jmunkki@iki.fi Life is easy when polygons are cheap. http://www.iki.fi/jmunkki Windsurfing: Faster than the wind. +++++++++++++++++++++++++++ >From d88-bli@xbyse.nada.kth.se (Bo Lindbergh) Date: 19 Jan 1996 03:06:53 GMT Organization: Royal Institute of Technology, Stockholm, Sweden In article <4dk4sc$1a8@nntp.hut.fi> jmunkki@beta.hut.fi (Juri Munkki) writes: > > As long as you have a limited amount of balls (say under 10), most > machines should be able to handle any kind of math you want to throw > at them. Hmm, what's the greatest number of balls simultaneously in play ever used in a physical pinball machine? And if I ask this in rec.games.pinball, will they laugh at me? :-) /Bo Lindbergh +++++++++++++++++++++++++++ >From james@olsen.ch (James Shaw) Date: Mon, 15 Jan 1996 16:07:07 GMT Organization: Olsen & Associates AG, Zurich, Switzerland I said earlier: > I'll agree with Juri; I think quaternions are needed. There are three > angles of rotation: spin (e.g. from top view the ball acts like a top), > rolling (the balls rotational motion in the direction it is moving) and > "english" or anti-rolling (the rotation part perpendicular to the balls > direction which takes it off course). I take it back. Quaternions are not needed. I implemented rolling, english and spinning this weekend and needed only a 3D vector to store them. Of course, if I wanted to display the rolling object's absolute position, I would need a rotation matrix or quaternions, but for the spin's velocity, I only needed one vector. Here is what I did in my implementation: I assumed that the ball could only be hit on the side and effectively on the bottom. I stored the rolling/english as the x, y portion of my vector w, and defined the x movement to be the rotation direction which moves the ball in the x direction; same for y. If the ball spins with rate w and the ball is moving at velocity v, then the ball is touching (hitting) the ground and there is an apparent velocity between the ground and the ball of a = w - v. (If there is no slipping and the ball rolls along, a = 0) Because there is some (a lot) of slipping, for one time step, I define f, the friction of the ball and the ground. That means that I add f * a to w and subtract it from v. This makes them match. I actually should be using a ratio of the mass of the object to its moment, but I've just set it to 1 for now. Summary for rolling: a = w - v; w += MtoM * f * a; v -= f * a; This accomplishes converting translation into rolling and vice versa. It does it via slipping and catching according to f. This had an interesting effect on the simulation. I had to define how elastic collisions worked for a ball striking a surface. I ruled that the spin reverses along the normal, just like translational motion. It can be anywhere from inelastic to elastic just like translational collisions. I have this image in my head of a rolling gear catching against the side of something and bouncing back, but otherwise, don't know if this bouncing is physically valid. Comments? The rolling's effect was to dampen instantaneous translational motion. If the ball hit an active bumper, it went quickly away but slowed down as the ball slipped and both rolled faster and moved slower. If I turned off translational elastisity, then when the ball hit something it would thud to a stop, but be spinning away and as it 'caught' the floor it would start to take off, like a race car. It looked good. Rolling had the effect of, with gravity, losing energy in the system. This was at least in my implementation. I had an explanation in my head why this would happen but I can't explain it at the moment. I did a similar slipping for spin of the ball (the z portion of w) and am still playing with the ball spinning along object, which from the top view and gravity on is what you might call rolling. I didn't do anything with the interaction of the 3 directions of rotation. I think they are independent but I don't have a physical arguement yet. I keep thinking that a spinning ball pushed ahead would start to veer in the direction of the spin. I'm also remembering that a spin in one direction could resist spins in other directions? I'm playing with this but I'd appreciate anyone out there who has an opinion of the actual physics involved. I haven't had a chance yet to put a whirlwind type rotater in and see if the ball wobbles, as Juri mentioned. My guess is that it won't (yet?) because I'm missing something with the physics. If anyone else is interested, I'd like to start an email discussion of the physics. There are enough mistakes that can be made so multiple participants would be helpful. Best, James +++++++++++++++++++++++++++ >From jregier@qualcomm.com (Jason Regier) Date: Thu, 18 Jan 1996 10:13:57 -0800 Organization: Qualcomm, Inc. In article <4dk4sc$1a8@nntp.hut.fi>, jmunkki@beta.hut.fi (Juri Munkki) wrote: > It still seems to me that quaternions would provide the ideal simple > solution for handling all kinds of spin: with any kind of motion > you'll have just a surface normal for the surface that you are > hitting or touching, a motion vector and a quaternion. The tough > part is then handling the situation where the ball bounces up from > the 2D plane. > THAT would be really interesting to see. I've never seen a pinball simulator where you can actually hit the ball so hard that it smacks off the glass (as in real pinball games). Of course, in order to make your pinball hop, you'd need to keep track of the heights of the bumpers and other objects. Well, at least you need to know the height at which it will contact the ball (i.e. if bumpers contact below the ball's center of mass, then you can hop the ball off the surface of the table!) > As long as you have a limited amount of balls (say under 10), This is a parameter related to the pinball game, and not the programmer, right? ;) Jason -- Jason Regier GlobalStar Software Engineer QUALCOMM, Inc. (619) 658-4752 jregier@qualcomm.com +++++++++++++++++++++++++++ >From sg94f7nc@dunx1.ocs.drexel.edu (Geoffrey Kinnel) Date: 18 Jan 1996 19:10:24 GMT Organization: Drexel University This discussion of spin in pinball is interesting, but don't forget that pinball tables are covered with mylar, and there is not a whole lot of friction as the ball slides around the table. Compare this to a pool table, where the surface is felt and you can use the spin. For more pinball related stuff, check out rec.games.pinball and the Pinball Archive http://pinball.cc.cmu.edu. As an aside, many of the wierd effect people attribute to "playfield magnets" are actually due to spin on the ball. I realize this sounds like it is in contradiction with the low friction playfield; I don't pretend to understand it. I hope this helps someone, at least a little. Geoff +++++++++++++++++++++++++++ >From jregier@qualcomm.com (Jason Regier) Date: Thu, 18 Jan 1996 11:38:15 -0800 Organization: Qualcomm, Inc. In article <jinjur-1701962018470001@165.227.52.132>, jinjur@kudonet.com (john calhoun) wrote: > In article <DL8Crv.37r@olsen.ch>, james@olsen.ch (James Shaw) wrote: > > > This had an interesting effect on the simulation. I had to > > define how elastic collisions worked for a ball striking a surface. > > I ruled that the spin reverses along the normal, just like translational > > motion. It can be anywhere from inelastic to elastic just like > > translational collisions. I have this image in my head of a rolling > > gear catching against the side of something and bouncing back, but > > otherwise, don't know if this bouncing is physically valid. Comments? > Doesn't sound right to me either. In an elastic collision, you can't have nonconservative forces (i.e. friction). If there are no frictional forces (really frictional torques), then when the spinning ball collides with the wall, the ball's angular momentum can't affect the wall. Therefore, angular momentum is conserved because no external torques (or angular impulses) act on your system. However, in the real world, we do have friction. When the ball contacts the surface, a frictional force will be exerted on the ball. Thus, energy won't be conserved. The ball's spin will change because of the frictional force, yet the immovable wall won't move because an external impulse acts to keep the wall in place after the collision. Since you have an external impulse acting on your system, angular momentum is not conserved in your collision and the ball's spin will change. The extent of change in this collision will depend on the frictional forces exerted during the collision and the loss in energy as a result of the collision. And remember for the linear momentum part, when a ball hits a motionless wall, you exert a force (really an impulse) to keep the wall in place during the collision. So since you're applying an external impulse, linear momentum is not conserved and that's why your ball bounces back. But if the collision is elastic, no friction acts on the ball, so energy is conserved. > > Rolling had the effect of, with gravity, losing energy in the system. > > This was at least in my implementation. > Well, that's wrong. Gravity is a conservative force, so energy is conserved. If you're losing energy, then that's most likely due to roundoff error or other inaccuracies in your implementation. If friction acts on your ball, as it does on everyday balls when they roll, then your ball will lose energy as it rolls. If there's no friction, then your ball is simply spinning and translating on a surface, and it won't lose its energy. You better take a closer look at the simple case of a ball just bouncing off a surface under the influence of gravity and see whether your system works right or not. <whew> I think that's right. Jason -- Jason Regier GlobalStar Software Engineer QUALCOMM, Inc. (619) 658-4752 jregier@qualcomm.com +++++++++++++++++++++++++++ >From johnb@hk.super.net (John W. Blackburne) Date: Sun, 21 Jan 1996 17:15:33 +0800 Organization: Tempest In article <jregier-1801961138150001@jregier-mac.qualcomm.com>, jregier@qualcomm.com (Jason Regier) wrote: :In article <jinjur-1701962018470001@165.227.52.132>, jinjur@kudonet.com :(john calhoun) wrote: : :> In article <DL8Crv.37r@olsen.ch>, james@olsen.ch (James Shaw) wrote: :> :> > This had an interesting effect on the simulation. I had to :> > define how elastic collisions worked for a ball striking a surface. :> > I ruled that the spin reverses along the normal, just like translational :> > motion. It can be anywhere from inelastic to elastic just like :> > translational collisions. I have this image in my head of a rolling :> > gear catching against the side of something and bouncing back, but :> > otherwise, don't know if this bouncing is physically valid. Comments? :> :Doesn't sound right to me either. In an elastic collision, you can't have :nonconservative forces (i.e. friction). If there are no frictional forces :(really frictional torques), then when the spinning ball collides with the :wall, the ball's angular momentum can't affect the wall. Therefore, :angular momentum is conserved because no external torques (or angular :impulses) act on your system. I'm not sure I agree with this. I can certainly imagine a ball hitting an elastic surface at an angle/rotating, so it's surface is initially moving relative to the elastic surface, and still have it conserving energy, as long as it doesn't slide along the surface. Only dynamic friction is non-conservative. Friction between two surfaces that do not move relative to each other does not lose energy. Enegy may be lost internally in the rubber (or whatever) as it stretches perpendicularly and parallel to the surface, and due to other frictional forces, but it need not be lost in the friction between the ball and surface. In fact the greater the coefficient of friction the less likely slipping will be be, so the more likely energy will be conservered. John -- John Blackburne, johnb@tempest.net.hk Programmer Asia, Inc. Online: http://www.asia-inc.com Technology consultant and trainer: http://www.hk.super.net/~johnb +++++++++++++++++++++++++++ >From sg94f7nc@dunx1.ocs.drexel.edu (Geoffrey Kinnel) Date: 25 Jan 1996 21:22:06 GMT Organization: Drexel University Bo Lindbergh (d88-bli@xbyse.nada.kth.se) wrote: : In article <4dk4sc$1a8@nntp.hut.fi> jmunkki@beta.hut.fi (Juri Munkki) writes: : > : > As long as you have a limited amount of balls (say under 10), most : > machines should be able to handle any kind of math you want to throw : > at them. : Hmm, what's the greatest number of balls simultaneously in play ever used : in a physical pinball machine? And if I ask this in rec.games.pinball, : will they laugh at me? :-) : /Bo Lindbergh As I recall, I heard tell of a machine with a 13-ball multiball! This sounds suspect to me, but the folks on rec.games.pinball would be happy to verify or repudiate my claim. Many machines support three ball multiball and some support up to six. More than that would get unwieldy, clogging up the flippers, in my opinion. Geoff --------------------------- >From drysdall@waikato.ac.nz (Richard Drysdall) Subject: Q: When to call ReleaseResource? Date: Mon, 22 Jan 1996 16:45:53 +1300 Organization: University of Waikato Hi. This may be a silly question, but TR isn't too clear on when to use ReleaseResource. Suppose I have a function which has a loop in it like this: void whatever () { Handle resourceHandle; do { /* UseResFile and some other stuff */ resourceHandle = Get1Resource ('blah', 128); /* look at the resource */ /* now finished with that resource */ } while (some condition); } /* end of function */ My question is, should I call ReleaseResource every time I loop? Once at the end of the function? Or not at all? Is it ok to call ReleaseResource on a handle, and then 're-create' the resource handle with another call to GetResource? Thanks very much for any help. -- Richard Drysdall, University of Waikato, New Zealand. "I'm called a theoretical physicist because in practice I'm not." Information gathering organisations are hereby denied permission to use any personal information pertaining to myself (including my email address) in any commercial transaction. +++++++++++++++++++++++++++ >From Andrew Welch <andrew@AmbrosiaSW.com> Date: Mon, 22 Jan 1996 00:06:28 -0500 Organization: Ambrosia Software, Inc. Richard Drysdall wrote: > = > My question is, should I call ReleaseResource every time I loop? Once at > the end of the function? Or not at all? Is it ok to call ReleaseResource > on a handle, and then 're-create' the resource handle with another call t= o > GetResource? This response is rather lengthy, but hopefully it will be helpful to = you and others. It's from my little project "Mac Programming = Pitfalls". =2E.... #3 -- Properly handling resources. Author - Andrew Welch When you load in a resource -- either directly by calling = GetResource(), or indirectly by calling a Toolbox routine like = GetPicture(), which in turn calls GetResource() -- the Resource = Manager "owns" that Handle. Do not dispose of it yourself by = calling DisposeHandle(). The Resource Manager keeps a table of all of the resources that it = loaded into memory. If you call GetResource() on a resource Handle = that is already in memory, the Resource Manager simply returns the = Handle to you. When you call CloseResFile(), all of the resource = Handle=B9s "owned" by that resource file are automatically disposed = for you. Therefor, do *not* call DisposeHandle() on any Handle that was = loaded in by the Resource Manager. Doing so wil result in the = Resource Manager referencing a handle that has already been disposed = of. Can you say "mysterious random crashes"? Now let's look at how to properly handle resources in memory. We'll = look at some example code first, and then an explanation: Handle myResource; myResource =3D GetResource(MY_RESOURCE_TYPE, MY_RESOURCE_ID); if (myResource !=3D nil) { HNoPurge(myResource); // -- Manipulate the resource as you please... HPurge(myResource); } The first thing you'll notice is that we don't call ResError() to = see if the resource was loaded in successfully -- the proper way to = check to see if a resource was loaded in OK is to check for nil. Next you'll notice that the first thing we do if the resource could = be loaded in OK is we make the resource unpurgable. Any Handle that = is purgable may disappear out from underneath us if memory is needed = elsewhere, and we shouldn't assume that that the resource will be = unpurgable when it is loaded in. Finally, instead of disposing of the memory that the resource Handle = occupies, we simply mark it as purgable. As we already outlined = earlier, you should not call DisposeHandle() on any resource Handle. = If you will never look at the resource again, you can call = ReleaseResource() to have the Resource Manager dispose of the = resource Handle in memory, and remove it from the Resource Manager's = internal data structures. However a better way to handle it is to simply set the resource = Handle to purgable as was done in the above example. What this does = is it keeps the resource Handle in memory, but if the Memory Manager = needs more memory for some other operation, it'll automatically = purge it. By using this technique, your application will be fast because if = memory is available, resources that you use will be kept in memory. = Calls to GetResource() on handles that are already in memory will = simply return the resource Handle, rather than go to the disk to = load the data in. If for some reason one of your resource Handles = was purged, subsequent calls to GetResource() will simply load it = back into memory. If you use this technique throughout your code, you won't have to = worry about which Handles to call ReleaseResource() on, which to = keep around, etc. It's one simple, effective, optimal technique for = handling resources throughout your application. Let the Memory = Manager and Resource Manager work for you. +--------------------------------------------------------------+ | Andrew Welch - Thaumaturgist - Ambrosia Software, Inc. | +-------------------------------+------------------------------+ | AOL-> Keyword: Ambrosia | eWorld-> Shortcut: Ambrosia | | CIS-> GO word: Ambrosia | http://www.AmbrosiaSW.com/ | +-------------------------------+------------------------------+ +++++++++++++++++++++++++++ >From DaveZ@mailbag.com (David B. Zwiefelhofer) Date: Tue, 23 Jan 1996 09:04:03 -0500 Organization: Utility Reduction Specialists, Inc. In article <drysdall-2201961645530001@ciscoara1-10.slip.waikato.ac.nz>, drysdall@waikato.ac.nz wrote: > Hi. > > This may be a silly question, but TR isn't too clear on when to use > ReleaseResource. Suppose I have a function which has a loop in it like > this: > > > void whatever () > > { > Handle resourceHandle; > > do { > /* UseResFile and some other stuff */ > resourceHandle = Get1Resource ('blah', 128); > /* look at the resource */ > /* now finished with that resource */ > } > while (some condition); > > } /* end of function */ > > > My question is, should I call ReleaseResource every time I loop? Once at > the end of the function? Or not at all? Is it ok to call ReleaseResource > on a handle, and then 're-create' the resource handle with another call to > GetResource? Why call Get1Resource in the loop if you're going to need that resource every time through the loop? Call it once before the loop and ReleaseResource after the loop. You could call ReleaseResource after the loop and leave the call to Get1Resource in the loop. If the resource is in memory already Get1Resource will give you a handle to it. It won't reload another copy. So it would load it the first time through the loop and then just keep giving you a handle to it during the subsequent calls. Good luck, Dave -- David B. Zwiefelhofer Utility Reduction Specialists, Inc. 1605 Monroe Street, Suite 110 Madison, WI 53211-2052 (608) 258-8965 (608) 258-9686 FAX +++++++++++++++++++++++++++ >From "Andrew C. Plotkin" <erkyrath+@CMU.EDU> Date: Mon, 22 Jan 1996 16:45:53 -0500 Organization: Carnegie Mellon, Pittsburgh, PA stk@berlin.snafu.de (Stefan Kurth) writes: > Andrew Welch <andrew@AmbrosiaSW.com> wrote: > > > If for some reason one of your resource Handles was purged, subsequent > > calls to GetResource() will simply load it back into memory. > > Will they? I thought that GetResource would return the empty handle in > this case, and you would have to call LoadResource explicitly. No? >From NIM: "If the entry contains a a handle whose value is NIL, and if you haven't called SetResLoad with the load parameter set to FALSE, GetResource attempts to read the resource into memory." --Z "And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..." +++++++++++++++++++++++++++ >From stk@berlin.snafu.de (Stefan Kurth) Date: Mon, 22 Jan 1996 20:45:03 +0100 Organization: none Andrew Welch <andrew@AmbrosiaSW.com> wrote: > If for some reason one of your resource Handles was purged, subsequent > calls to GetResource() will simply load it back into memory. Will they? I thought that GetResource would return the empty handle in this case, and you would have to call LoadResource explicitly. No? -- Stefan Kurth Berlin, Germany --------------------------- >From Robert Altman <rl3gppc@tribeca.ios.com> Subject: Quickdraw 3D intro?? Date: 23 Jan 1996 20:25:13 GMT Organization: Internet Online Services I am an intermediate C programmer, and I would like to write some apps that use basic Quickdraw 3D (i.e. I would use the standrd viewer). Are there any good intros to Quickdraw 3D (in bookstores or on the Net)? I have a book that Apple publishes, but it is difficult to digest as it is more of a formal definition than a tutorial. Thanks!!! --Robert +++++++++++++++++++++++++++ >From jaks@netcom.com (Eric Jackson) Date: Wed, 24 Jan 1996 20:52:24 GMT Organization: NETCOM On-line Communication Services (408 261-4700 guest) In article <4e3g79$s9p@news.ios.com>, Robert Altman <rl3gppc@tribeca.ios.com> wrote: >I am an intermediate C programmer, and I would like to write some apps >that use basic Quickdraw 3D (i.e. I would use the standrd viewer). Are >there any good intros to Quickdraw 3D (in bookstores or on the Net)? I >have a book that Apple publishes, but it is difficult to digest as it is >more of a formal definition than a tutorial. > >Thanks!!! Here is a good place to start. http://product.info.apple.com/qd3d/QD3D.HTML Now I would suggest that you take a look at the develop articles they are pretty good. I think that you might be able to find them at the URL that I suggested. Eric --------------------------- >From Darren King <breakpt@interlog.com> Subject: Starting MacTCP on startup Date: Mon, 15 Jan 1996 20:02:29 -0500 Organization: BreakPoint Design When I start my program, I check for MacTCP. If it isn't running, the call returns 0 (correctly). Most programs start MacTCP if it isn't running (netscape, etc...). How do you tell if MacTCP isn't installed on the system or if just isn't running right now? This behaviour is common on home machines that have to dial up the internet so MacTCP isn't running all the time. thanx Darren King, BreakPoint Design +++++++++++++++++++++++++++ >From colen@teleport.com (Colen Garoutte-Carson) Date: Tue, 16 Jan 1996 13:27:56 +0100 Organization: Teleport - Portland's Public Access (503) 220-1016 In article <30FAF925.71FA@interlog.com>, breakpt@interlog.com wrote: > When I start my program, I check for MacTCP. If it isn't running, > the call returns 0 (correctly). Most programs start MacTCP if > it isn't running (netscape, etc...). How do you tell if MacTCP > isn't installed on the system or if just isn't running right > now? This behaviour is common on home machines that have to dial > up the internet so MacTCP isn't running all the time. Darren, There is a Gestalt to check for the existance of MacTCP. However, the Gestalt will fail under AU/X. I've include pascal code below for a hack that I use (to check for the control panel). This probably won't work pre-Sys7. - Colen Garoutte-Carson function HasMacTCP: boolean; var hasit, done: boolean; myPB: CInfoPBRec; fileName: str255; fi: HParamBlockRec; result: longint; begin hasit := Gestalt('mtcp', result) = NoErr; if not hasit then {Failsafe if Gestalt does not work (Which it does not under AU/X)} begin fileName := 'Control Panels'; myPB.ioNameptr := @fileName; myPB.ioVRefNum := theWorld.sysVRefNum; myPB.ioFVersNum := 0; myPB.ioDirID := 0; myPB.ioFDirIndex := 0; if PBGetCatInfoSync(@myPB) = noErr then begin if BitTst(@mypb.ioFlAttrib, 3) then begin fi.ioCompletion := nil; fi.ioNamePtr := @filename; fi.ioVRefNum := theWorld.sysVRefNum; fi.ioDirID := myPB.ioDirID; fi.ioFDirIndex := 1; done := false; while not done do begin done := PBHGetFInfoSync(@fi) <> noErr; if not done then begin if (fi.ioFlFndrInfo.fdType = 'cdev') and ((fi.ioFlFndrInfo.fdCreator = 'atcp') or (fi.ioFlFndrInfo.fdCreator = 'ztcp')) then begin hasit := true; done := true; end; fi.ioFDirIndex := fi.ioFDirIndex + 1; fi.ioDirID := myPB.ioDirID; end; end; end; end; end; HasMacTCP := hasit; end; +++++++++++++++++++++++++++ >From Andreas.Magnusson@mailbox.swipnet.se (Andreas Magnusson) Date: Wed, 17 Jan 1996 09:10:12 +0100 Organization: - In article <colen-1601961327560001@ip-pdx05-15.teleport.com>, colen@teleport.com (Colen Garoutte-Carson) wrote: >In article <30FAF925.71FA@interlog.com>, breakpt@interlog.com wrote: > >> When I start my program, I check for MacTCP. If it isn't running, >> the call returns 0 (correctly). Most programs start MacTCP if >> it isn't running (netscape, etc...). How do you tell if MacTCP >> isn't installed on the system or if just isn't running right >> now? This behaviour is common on home machines that have to dial >> up the internet so MacTCP isn't running all the time. > >Darren, > > There is a Gestalt to check for the existance of MacTCP. However, >the Gestalt will fail under AU/X. I've include pascal code below for a >hack that I use (to check for the control panel). This probably won't >work pre-Sys7. > > - Colen Garoutte-Carson > > fileName := 'Control Panels'; And I doubt it would work on an non-US machine? Or does AU/X require an US-system so that you know for sure that the folder is called Control Panels? Is there some AU/X reason also that you don't use FindFolder instead? /Andreas -- Andreas Magnusson | ...but Hilta laughed like someone who had m-26334@mailbox.swipnet.se| thought hard about life and had seen the joke. x95andma@ida.liu.se | zune@lysator.liu.se | - Terry Pratchett +++++++++++++++++++++++++++ >From stk@berlin.snafu.de (Stefan Kurth) Date: Thu, 18 Jan 1996 15:25:58 +0100 Organization: none Colen Garoutte-Carson <colen@teleport.com> wrote: > Do you know of any safe way, other than Gestalt, to check for the > existance of MacTCP? Walk the driver unit table and look for the .ipp driver. -- Stefan Kurth Berlin, Germany +++++++++++++++++++++++++++ >From isis@isis-intl.com (Mike Cohen) Date: Fri, 19 Jan 1996 11:44:46 -0600 Organization: ISIS International In article <Andreas.Magnusson-1701960910120001@dialup100-134.swipnet.se>, Andreas.Magnusson@mailbox.swipnet.se (Andreas Magnusson) wrote: >And I doubt it would work on an non-US machine? Or does AU/X require an >US-system so that you know for sure that the folder is called Control >Panels? I think A/UX was a restricted product that couldn't be shipped outside the US. -- Mike Cohen - isis@isis-intl.com Home Page: http://www.isis-intl.com/ Sound is the same for all the world - Youssou N'dour, "Eyes Open" *** Save Mystery Science Theater 3000! Comedy Central has decided to *** cancel it. Call them at (212) 767-8600 and tell them what you think. *** Full details at http://fermi.clas.virginia.edu/~jcp9j/canceled.html +++++++++++++++++++++++++++ >From nigel.stanger@stonebow.otago.ac.nz (Nigel Stanger) Date: Mon, 22 Jan 1996 13:57:56 +1300 Organization: Dept. of Information Science, University of Otago In article <AD2534AE966883482@cpr-cap-1.wyoming.com>, isis@isis-intl.com (Mike Cohen) wrote: > I think A/UX was a restricted product that couldn't be shipped outside the > US. We had people running it here in New Zealand... ===================================================================== Nigel Stanger, Internet: nigel.stanger@stonebow.otago.ac.nz University of Otago, Phone: +64 3 479-8179 Dunedin, NEW ZEALAND. Fax: +64 3 479-8311 +++++++++++++++++++++++++++ >From dnebing@epix.net (Dave Nebinger) Date: Fri, 19 Jan 1996 14:14:08 -0500 Organization: KHP Services, Inc In article <19960118152558238156@stk.berlin.snafu.de>, stk@berlin.snafu.de (Stefan Kurth) wrote: > Colen Garoutte-Carson <colen@teleport.com> wrote: > > > Do you know of any safe way, other than Gestalt, to check for the > > existance of MacTCP? > > Walk the driver unit table and look for the .ipp driver. Again, this will only determine if MacTCP has been opened already. It does not determine if it is merely installed but not yet opened. Dave. ========================================================== Dave Nebinger dnebing@epix.net The Alt.Sources.Mac Archivist <http://www.AmbrosiaSW.com/alt.sources.mac/> <ftp://ftp.AmbrosiaSW.com/pub/alt.sources.mac/> +++++++++++++++++++++++++++ >From colen@teleport.com (Colen Garoutte-Carson) Date: Wed, 17 Jan 1996 15:34:06 +0100 Organization: Teleport - Portland's Public Access (503) 220-1016 In article <Andreas.Magnusson-1701960910120001@dialup100-134.swipnet.se>, Andreas.Magnusson@mailbox.swipnet.se (Andreas Magnusson) wrote: > > fileName := 'Control Panels'; > > And I doubt it would work on an non-US machine? Or does AU/X require an > US-system so that you know for sure that the folder is called Control > Panels? > > Is there some AU/X reason also that you don't use FindFolder instead? Andreas, Well, I never made any claims as to the quality of the code. :) It's been a while since I threw that together. If you want to be technical, all of that failsafe code should be avoided. Just because the MacTCP control panel is in the Control Panels folder doesn't mean it was there when you last booted the machine. Do you know of any safe way, other than Gestalt, to check for the existance of MacTCP? Since I do not have A/UX, myself, and fixed this problem for someone from remote, I'm not entirely sure that the Gestalt does not work. Can anyone confirm this for me? - Colen +++++++++++++++++++++++++++ >From pope@edunet.dk (Povl H. Pedersen) Date: 18 Jan 1996 11:23:54 GMT Organization: edu! In article <colen-1601961327560001@ip-pdx05-15.teleport.com>, colen@teleport.com (Colen Garoutte-Carson) wrote: : fileName := 'Control Panels'; nnonononononono NO !!!!!! ALWAYS use FindFolder to find the special folders (Systemmappe, and those inside like Kontrolpaneler, Udvidelser, Indstillinger, Skrifter). Don't ever assume anything about naming of these folders. Or if you do, then you should also do a: typedef char struct { unused: 1; // we are in the US, so we only do 7-bit ASCII data: 7; } NeverEver assume anything about such things. Color is misspelled even in the UK. -- Povl H. Pedersen - pope@edunet.dk Macintosh / Unix / Win (aaargghh) programmer - System Administrator Microsoft philosophy since 1984: Why innovate when you can immitate +++++++++++++++++++++++++++ >From dnebing@epix.net (Dave Nebinger) Date: Thu, 18 Jan 1996 09:46:40 -0500 Organization: KHP Services, Inc In article <colen-1601961327560001@ip-pdx05-15.teleport.com>, colen@teleport.com (Colen Garoutte-Carson) wrote: > In article <30FAF925.71FA@interlog.com>, breakpt@interlog.com wrote: > > > When I start my program, I check for MacTCP. If it isn't running, > > the call returns 0 (correctly). Most programs start MacTCP if > > it isn't running (netscape, etc...). How do you tell if MacTCP > > isn't installed on the system or if just isn't running right > > now? This behaviour is common on home machines that have to dial > > up the internet so MacTCP isn't running all the time. > > There is a Gestalt to check for the existance of MacTCP. However, > the Gestalt will fail under AU/X. I've include pascal code below for a > hack that I use (to check for the control panel). This probably won't > work pre-Sys7. Note that checking for the control panel does not mean that MacTCP is installed: 1. Inits and cdevs might have been disabled at startup. 2. The software might just have been installed without restarting the Mac. Dave. ========================================================== Dave Nebinger dnebing@epix.net The Alt.Sources.Mac Archivist <http://www.AmbrosiaSW.com/alt.sources.mac/> <ftp://ftp.AmbrosiaSW.com/pub/alt.sources.mac/> +++++++++++++++++++++++++++ >From stk@berlin.snafu.de (Stefan Kurth) Date: Tue, 23 Jan 1996 02:13:31 +0100 Organization: none Dave Nebinger <dnebing@epix.net> wrote: > stk@berlin.snafu.de (Stefan Kurth) wrote: > > > Walk the driver unit table and look for the .ipp driver. > > Again, this will only determine if MacTCP has been opened already. > It does not determine if it is merely installed but not yet opened. Yes it does. The MacTCP driver is installed at startup, so its existence or abscence in the driver table _does_ tell you if MacTCP is installed or not. To find out if it has been opened already, you have to check the dOpened bit of the driver's dCtlFlags. -- Stefan Kurth Berlin, Germany --------------------------- >From cmsngr@aol.com (CMSngr) Subject: VBL Afterlife Date: 7 Jan 1996 20:29:13 -0500 Organization: America Online, Inc. (1-800-827-6364) Hi! I was wondering what happens to VBL tasks registered from an application when that application unexpectedly dies. I am seeing some strangeness in the CW debugger on runs after the first one. Any comments? Thanks! -Chris +++++++++++++++++++++++++++ >From bwade@qualia.com (Bretton Wade) Date: Sun, 07 Jan 1996 23:27:22 -0500 Organization: qualia, inc. In article <4cps19$aql@newsbf02.news.aol.com>, cmsngr@aol.com (CMSngr) wrote: # I was wondering what happens to VBL tasks registered from an # application when that application unexpectedly dies. I am seeing some # strangeness in the CW debugger on runs after the first one. Any # comments? Yeah, the VBL sticks around and keeps trying to call the function you gave it. Patch ExitToShell to remove the task, or reboot after every crash... -- bwade@qualia.com http://www.qualia.com/ +++++++++++++++++++++++++++ >From dwareing@adelaide.on.net (David Wareing) Date: Mon, 08 Jan 1996 15:43:59 +0930 Organization: Weyland Yutani In article <4cps19$aql@newsbf02.news.aol.com>, cmsngr@aol.com (CMSngr) wrote: >Hi! > > I was wondering what happens to VBL tasks registered from an >application when that application unexpectedly dies. I am seeing some >strangeness in the CW debugger on runs after the first one. Any >comments? What happens is death. Say goodbye to your machine for 3 minutes while you reboot it from the switch. This is one of the perils of working with VBL and Time Manager tasks during development. If you need to 'es' or just get out of the app in a real hurry, then that TM task is probably going to clobber you very shortly afterwards. If it doesn't get you immediately, you can put money on it to crash you within minutes. So, either do without such tasks during development (substitute them with less accurate mechanisms), or try to make sure all your debugging code addresses the tasks and cleans them up properly before exiting. Then there's still a problem after development too. If a user tries to do a hard-quit on your app (which seems to be a very common habit among some users) then it's probably going to be crash time for their Mac. And of course they'll blame you, despite your protests that hard-quitting is a stupid thing to do... -- David Wareing dwareing@adelaide.on.net Belair, South Australia http://www.AmbrosiaSW.com/~dwareing/ Macintosh Games & Multimedia Programming +++++++++++++++++++++++++++ >From jmunkki@beta.hut.fi (Juri Munkki) Date: 8 Jan 1996 06:26:34 GMT Organization: Helsinki University of Technology In article <dwareing-0801961543590001@ppp147.adelaide.on.net.au> dwareing@adelaide.on.net (David Wareing) writes: >In article <4cps19$aql@newsbf02.news.aol.com>, cmsngr@aol.com (CMSngr) wrote: >> I was wondering what happens to VBL tasks registered from an >>application when that application unexpectedly dies. I am seeing some >>strangeness in the CW debugger on runs after the first one. Any >>comments? >This is one of the perils of working with VBL and Time Manager tasks >during development. If you need to 'es' or just get out of the app >in a real hurry, then that TM task is probably going to clobber you >very shortly afterwards. If it doesn't get you immediately, you can >put money on it to crash you within minutes. So, either do without >such tasks during development (substitute them with less accurate >mechanisms), or try to make sure all your debugging code addresses >the tasks and cleans them up properly before exiting. As was already said, patching ExitToShell works well. Arashi does it for the sound code, so you can check the source. (It's 68K code only, so PowerMac programmers will have to do it slightly differently.) It's much easier to debug a program when you know that doing an ExitToShell from the debugger is ok. What I do now is that I have a manager that keeps a list of procedures to call on ExitToShell. It can also remove calls from the list, so if the program is terminated normally, the calls are all removed before ExitToShell is called. All the classes that need this service use this manager instead of patching ExitToShell on their own. (I would post it, but I only have a 68K Think C version...) -- Juri Munkki jmunkki@iki.fi Life is easy when polygons are cheap. http://www.iki.fi/~jmunkki Windsurfing: Faster than the wind. +++++++++++++++++++++++++++ >From zzkbergm@dingo.uq.edu.au (Christoph Bergmann) Date: Mon, 08 Jan 1996 19:02:47 +1000 Organization: University of Queensland In article <4cqdeq$5ff@nntp.hut.fi>, jmunkki@beta.hut.fi (Juri Munkki) wrote: > In article <dwareing-0801961543590001@ppp147.adelaide.on.net.au> dwareing@adelaide.on.net (David Wareing) writes: > >In article <4cps19$aql@newsbf02.news.aol.com>, cmsngr@aol.com (CMSngr) wrote: > >> I was wondering what happens to VBL tasks registered from an > >>application when that application unexpectedly dies. I am seeing some > >>strangeness in the CW debugger on runs after the first one. Any > >>comments? > > >This is one of the perils of working with VBL and Time Manager tasks > >during development. If you need to 'es' or just get out of the app > >in a real hurry, then that TM task is probably going to clobber you > >very shortly afterwards. If it doesn't get you immediately, you can > >put money on it to crash you within minutes. So, either do without > >such tasks during development (substitute them with less accurate > >mechanisms), or try to make sure all your debugging code addresses > >the tasks and cleans them up properly before exiting. > > As was already said, patching ExitToShell works well. Arashi does it for > the sound code, so you can check the source. (It's 68K code only, so > PowerMac programmers will have to do it slightly differently.) > > It's much easier to debug a program when you know that doing an ExitToShell > from the debugger is ok. this would be one alternative.. the one i use was simply to (in the timetask..) check the keyboard. if i hold down cmd-option-control, the task would kill itself.. saves a lot of bother with ES trapping, but u wouldnt want it in a final version.. ChrisB +++++++++++++++++++++++++++ >From groovy@netaxs.com (Groovy) Date: Mon, 08 Jan 1996 16:17:07 -0400 Organization: Groovy Threads In article <4cqdeq$5ff@nntp.hut.fi>, jmunkki@beta.hut.fi (Juri Munkki) wrote: > > What I do now is that I have a manager that keeps a list of procedures > to call on ExitToShell. It can also remove calls from the list, so if > the program is terminated normally, the calls are all removed before > ExitToShell is called. All the classes that need this service use this > manager instead of patching ExitToShell on their own. (I would post it, > but I only have a 68K Think C version...) > > -- > Juri Munkki jmunkki@iki.fi Life is easy when polygons are cheap. > http://www.iki.fi/~jmunkki Windsurfing: Faster than the wind. My tasks "themselves" always check to see if my app is present and running before doing anything. This way if I crash or a user hard quits my task doesn't care cause it will not do anything but rts. I guess you could write the code to maybe even dequeue itself. Groovy +++++++++++++++++++++++++++ >From cmsngr@aol.com (CMSngr) Date: 10 Jan 1996 20:09:49 -0500 Organization: America Online, Inc. (1-800-827-6364) bwade@qualia.com says: "Yeah, the VBL sticks around and keeps trying to call the function you gave it. Patch ExitToShell to remove the task, or reboot after every crash..." Hi! That was my suspicion. Score one for uninstalling a VBL task after every sync for debug builds. This may have extra overhead but it sure is safer. Thanks! -Chris PS: What a mac day, first I spent an hour with the Inside Mac Files book figuring out how to find all the files in a directory and then this VBL thing. Sometimes the mac is actually worse than embedded printer code. (My day job.) To bad the elegance of the GUI is not reflected in the API eh? +++++++++++++++++++++++++++ >From jesjones@halcyon.com (Jesse Jones) Date: 11 Jan 1996 03:37:21 GMT Organization: Edmark In article <groovy-0801961617070001@chestnut1-44.slip.netaxs.com>, groovy@netaxs.com (Groovy) wrote: > In article <4cqdeq$5ff@nntp.hut.fi>, jmunkki@beta.hut.fi (Juri Munkki) wrote: > > > > > > What I do now is that I have a manager that keeps a list of procedures > > to call on ExitToShell. It can also remove calls from the list, so if > > the program is terminated normally, the calls are all removed before > > ExitToShell is called. All the classes that need this service use this > > manager instead of patching ExitToShell on their own. (I would post it, > > but I only have a 68K Think C version...) > > > > -- > > Juri Munkki jmunkki@iki.fi Life is easy when polygons are cheap. > > http://www.iki.fi/~jmunkki Windsurfing: Faster than the wind. > > My tasks "themselves" always check to see if my app is present and running > before doing anything. This way if I crash or a user hard quits > my task doesn't care cause it will not do anything but rts. > > > I guess you could write the code to maybe even dequeue itself. > > > Groovy Note that IM:Processes says that VBL tasks installed in the app's heap are removed automatically when the app quits or crashes (page 4-9). On the other hand, the OS doesn't appear to do this for Time Manager tasks: until I installed an ExitToShell patch I had problems quitting the app abnormally when Time Manager tasks were installed. --Jesse +++++++++++++++++++++++++++ >From bwade@qualia.com (Bretton Wade) Date: Mon, 15 Jan 1996 22:46:50 -0500 Organization: qualia, inc. In article <jesjones-1001960740360001@blv-pm11-ip14.halcyon.com>, jesjones@halcyon.com (Jesse Jones) wrote: # Note that IM:Processes says that VBL tasks installed in the app's heap are # removed automatically when the app quits or crashes (page 4-9). On the # other hand, the OS doesn't appear to do this for Time Manager tasks: until # I installed an ExitToShell patch I had problems quitting the app # abnormally when Time Manager tasks were installed. The normal VBL queue may get cleaned up on exit, but the slot manager queues don't seem to be. -- bwade@qualia.com http://www.qualia.com/ +++++++++++++++++++++++++++ >From Valentin Bonnard <bonnardv@pratique.fr> Date: 25 Jan 1996 13:08:57 GMT Organization: Internet Way bwade@qualia.com (Bretton Wade) wrote: >In article <jesjones-1001960740360001@blv-pm11-ip14.halcyon.com>, >jesjones@halcyon.com (Jesse Jones) wrote: > ># Note that IM:Processes says that VBL tasks installed in the app's heap are ># removed automatically when the app quits or crashes (page 4-9). On the ># other hand, the OS doesn't appear to do this for Time Manager tasks: until ># I installed an ExitToShell patch I had problems quitting the app ># abnormally when Time Manager tasks were installed. > >The normal VBL queue may get cleaned up on exit, but the slot manager >queues don't seem to be. > >-- >bwade@qualia.com >http://www.qualia.com/ I have just pressed Cmd-Opt-Esc and pressed the OK button in one of my apps who install a normal VBL (not with SlotVInstall), and the mouse stoped moving immediatly... (and I had to do a Cmd-Ctrl-Restart) Valentin bonnard bonnardv@pratique.fr --------------------------- >From Todd_Clements@hmc.edu (Todd Clements) Subject: Why would dragging in a thumb crash? Date: Mon, 22 Jan 1996 21:39:56 -0800 Organization: Harvey Mudd College I'm trying to work out some of the more hideous bugs in my program right now, and this one keeps coming up. I can use the scroll bar just fine in a certain window...however, if I try to grab the thumb and use it, it crashes with the resultant macsbug log file: /* begin log file */ Unimplemented Instruction at 00060258 Calling chain using A6/R1 links Back chain ISA Caller 010B1CF4 68K 00FC26E8 main+00114 010B1CE0 68K 00FC2734 EventLoop+0000E 010B1CD0 68K 00FC6AC4 GetEvent+0011C 010B1CA2 68K 4087C4AA _FindDialogItem+003C8 010B1BF2 68K 4086ED2C _TrackControl+00134 010B1BAE 68K 4086EB90 _DragControl+00072 010B1B78 68K 408768DE _DragTheRgn+001DA Closing log /* end log file */ It doesn't look like its my program thats doing it directly since I'm letting the system software deal with dragging in the thumb, but I'm sure I've done it indirectly, somewhere in the depths of memory. Does anyone have a hint as to what _type_ of error I've made (I realize without code it would be impossible to tell me the actual error) Any help is appreciated, as are copies to e-mail. Todd -- tclement@hmc.edu Todd Clements - <http://www.cs.hmc.edu/~tclement> "If the federal government were around when the Creator put His hand on this state, Indiana wouldn't be here...it'd still be waiting for an environmental impact statement. - Ronald Reagan +++++++++++++++++++++++++++ >From mike_duigou@fwb.com (Mike Duigou) Date: Wed, 24 Jan 1996 16:35:40 -0800 Organization: FWB Inc. The usual problem is that you have an action proc when the user is dragging the thumb. The toolbox is flawed in that you can have an action proc for the other scroll bar parts, but not the thumb. To track the thumb you can't do it with an action proc. You *must* specify -1 for the action proc if the part returned from FindControl is kControlIndicatorPart. Sample source exists for making the thumb have action when you move it. (Sorry, I don't have any). Mike Duigou FWB Inc. -- - - "Me, when I have nothing to say, my lips are sealed." -- Talking Heads +++++++++++++++++++++++++++ >From dnebing@epix.net (Dave Nebinger) Date: Thu, 25 Jan 1996 12:52:03 -0500 Organization: KHP Services, Inc In article <mike_duigou-2401961635400001@205.172.32.172>, mike_duigou@fwb.com (Mike Duigou) wrote: > You *must* specify -1 for the action > proc if the part returned from FindControl is kControlIndicatorPart. The only flaw in the above statement occurs if you have installed your action proc into the control. In that situation you must use ((ControlActionUPP)0). Dave. ========================================================== Dave Nebinger dnebing@epix.net The Alt.Sources.Mac Archivist <http://www.AmbrosiaSW.com/alt.sources.mac/> <ftp://ftp.AmbrosiaSW.com/pub/alt.sources.mac/> +++++++++++++++++++++++++++ >From awiner@oracle.com (Adam Winer) Date: Thu, 25 Jan 1996 14:39:46 -0800 Organization: Oracle Corporation In article <mike_duigou-2401961635400001@205.172.32.172>, mike_duigou@fwb.com (Mike Duigou) wrote: > The usual problem is that you have an action proc when the user is > dragging the thumb. The toolbox is flawed in that you can have an action > proc for the other scroll bar parts, but not the thumb. To track the thumb > you can't do it with an action proc. You *must* specify -1 for the action > proc if the part returned from FindControl is kControlIndicatorPart. > Sample source exists for making the thumb have action when you move it. > (Sorry, I don't have any). Wrong. You can have an action proc, but it has a different prototype than the normal action proc. Unfortunately, Apple never gave us support in the headers for this (despite "clearly" documenting it on page 5-117 of NIM:Toolbox Essentials) Use the following in your headers: typedef pascal void (*ControlIndicatorActionProcPtr)(void); enum { uppControlIndicatorActionProcInfo = kPascalStackBased }; #if GENERATINGCFM typedef UniversalProcPtr ControlIndicatorActionUPP; #define CallControlIndicatorActionProc(userRoutine) \ CallUniversalProc((UniversalProcPtr)(userRoutine), \ uppControlIndicatorActionProcInfo) #define NewControlIndicatorActionProc(userRoutine) \ (ControlIndicatorActionUPP) \ NewRoutineDescriptor((ProcPtr)(userRoutine), \ uppControlIndicatorActionProcInfo, \ GetCurrentISA()) #else typedef ControlIndicatorActionProcPtr ControlIndicatorActionUPP; #define CallControlIndicatorActionProc(userRoutine) \ (*(userRoutine))() #define NewControlIndicatorActionProc(userRoutine) \ (ControlIndicatorActionUPP)(userRoutine) #endif -- Adam Winer awiner@us.oracle.com --------------------------- >From bwade@qualia.com (Bretton Wade) Subject: [ANNOUNCE] BSP Tree Demo Application v1.3 Date: Wed, 24 Jan 1996 23:50:35 -0500 Organization: qualia, inc. The Macintosh BSP Tree Demonstration application with complete CW 8 source and projects is available at the URL file://ftp.qualia.com/pub/bspfaq/BSP_Tree_Demo_1.3.sea.hqx for more information about BSP Trees, the BSP Tree FAQ is available at the URL http://www.qualia.com/bspfaq/ -- bwade@qualia.com http://www.qualia.com/ --------------------------- >From julian@cs.auckland.ac.nz (Julian Harris) Subject: [Q] PowerPC VBLs? Date: Wed, 24 Jan 1996 21:19:22 +1300 Organization: Computer Science, The University of Auckland Hi all, I've got a bit of code: // Returns address of a VBL task record, from within a VBL task pascal long GetVBLRec( void ) ONEWORDINLINE( 0x2E88 ); // MOVE.L A0, (A7) That is used inside the VBL routine: // This is the task that is executed during a VBL // NOTE: can not have debug information in an interrupt routine! static pascal void ChangeCursor( void ) { CursorTaskPtr RecPtr; // Get cursor information. RecPtr = (CursorTaskPtr) GetVBLRec(); // Display the next cursor SetCursor( *( RecPtr->myCursors[RecPtr->myFrame] )); // Advance to the next cursor frame RecPtr->myFrame++; // Wrap around to the first cursor if (RecPtr->myFrame >= RecPtr->numberOfCursors) RecPtr->myFrame = 0; // Set task to run again RecPtr->myVBLTask.vblCount = InterruptDelay; } But I don't know how to do this on the PowerPC. I get a link error on GetVBLRec which is reasonable because it's 68k ASM. Anyone have any ideas? TIA. . . . . . . . . . . . . . . . . . . . . . . . . . . . "I can't remember when I've felt better!" > Julian Harris, Programmer > - Ralph Wilson after trying new Norecog > Comp. Sci. Dept. x8915 > vitamins with special memory inhibitors. > The University of Auckland > > julian@cs.auckland.ac.nz > +++++++++++++++++++++++++++ >From erichsen@pacificnet.net (Erichsen) Date: Thu, 25 Jan 1996 13:52:38 -0700 Organization: Coalition to Ban Dihydrogen Monoxide In article <julian-2401962119230001@julian.cs.auckland.ac.nz>, julian@cs.auckland.ac.nz (Julian Harris) wrote: >// Returns address of a VBL task record, from within a VBL task >pascal long GetVBLRec( void ) > ONEWORDINLINE( 0x2E88 ); // MOVE.L A0, (A7) You don't need this on a PowerPC. The TaskPtr is passed as a parameter to your routine on a PowerPC. Like: pascal void ChangeCursor( CursorTaskPtr RecPtr ) --------------------------- >From Kevin <webb@iftech.com> Subject: _Jackson Trap Date: Tue, 16 Jan 1996 13:08:14 -0500 Organization: Interpath -- Providing Internet access to North Carolina Does anyone have any info on the _Jackson trap ($ABO3). I had never heard of it before, but it has been causing some problems lately and I want to know what the story behind it is. Please email: webb@iftech.com Thanks kpw +++++++++++++++++++++++++++ >From greg@ohs.uwo.ca (Greg Chapman) Date: Fri, 19 Jan 1996 11:27:04 -0500 Organization: OHS, Univ. of Western Ontario In article <30FBE98E.7B2D@iftech.com>, Kevin <webb@iftech.com> wrote: >Does anyone have any info on the _Jackson trap ($ABO3). I had >never heard of it before, but it has been causing some problems >lately and I want to know what the story behind it is. _Jackson was the code name for Color Quickdraw while it was being developed. If you're throwing exceptions or bombing out and seeing _Jackson, you're most likely in a low memory situation, or are doing something evil to the graf ports et al. -- Greg Chapman - Mac Programmer/Developer Systems Manager - U. of Western Ontario OHS London, Ontario, Canada email: greg@ohs.uwo.ca - - "The laws of physics do not apply to this man." +++++++++++++++++++++++++++ >From tg3@u.washington.edu (Thurman Gillespy III) Date: Fri, 19 Jan 1996 10:23:22 -0800 Organization: Dept of Radiology, Univ of Washington In article <30FBE98E.7B2D@iftech.com>, Kevin <webb@iftech.com> wrote: >Does anyone have any info on the _Jackson trap ($ABO3). I had >never heard of it before, but it has been causing some problems >lately and I want to know what the story behind it is. > >Please email: webb@iftech.com > >Thanks >kpw Ah, yes, our good friend Mr. _Jackson. Somewhere, somehow (in a galaxy far, far away) you have caused QuickDraw to crash. Usually because it ran out of memory. There are canonical methods for handling low memory situations, see IM Memory for more details. A Q&D workaround is to _always_ leave a memory cushion whenever you call NewPtr, NewHandle or anything else that allocates memory. I leave about 50k to be safe, but your milage will most definitely vary. -- Thurman Gillespy III | tg3@u.washington.edu Department of Radiology, SB-05 | voice (206)543-3320 University of Washington | fax (206)543-6317 Seattle, WA 98195 | +++++++++++++++++++++++++++ >From bill@scconsult.com (Bill Stewart-Cole) Date: Sat, 20 Jan 1996 22:43:07 -0600 Organization: ZOG In article <Steve-1901961842000001@dwilson.vip.best.com>, Steve@emer.com (Steve Wilson) wrote: >In article <30FBE98E.7B2D@iftech.com>, Kevin <webb@iftech.com> wrote: > >> Does anyone have any info on the _Jackson trap ($ABO3). I had >> never heard of it before, but it has been causing some problems >> lately and I want to know what the story behind it is. > >I think it is part of color quickdraw. A lot of crashes occur there, but >I don't know why that is. It is not uncommon to crash CQD by hitting a _Debugger call at the start of _Jackson when you make a QuickDraw call with the wrong sort of parameter (like a pointer where a handle should be) or when you are trying to move large pictures or complex regions around. Deciphering the cause post-crash is terribly difficult, but you can usually locate it by sniffing out QuickDraw calls and looking carefully at the last one before the crash. What I have most often seen is that CQD is running out of memory and slamming the stack down into the heap hard (not only thru the heap end block, but sometimes right down thru the entire heap and out the bottom end, which gets very ugly) by trying to push an entire picture, pixmap, or region structure. Because CQD is running from system space it doesn't run into any problems strictly from overwriting the entire application heap. I believe that _Jackson itself is the lowest-level routine for throwing pixel data into the frame buffer, and some wag at Apple equated this to Jackson Pollack's spattering of paint on canvas. -- Bill Stewart-Cole I dare you to find my web page: Success is its own punishment +++++++++++++++++++++++++++ >From Steve@emer.com (Steve Wilson) Date: 20 Jan 1996 02:42:39 GMT Organization: Emergent Behavior In article <30FBE98E.7B2D@iftech.com>, Kevin <webb@iftech.com> wrote: > Does anyone have any info on the _Jackson trap ($ABO3). I had > never heard of it before, but it has been causing some problems > lately and I want to know what the story behind it is. I think it is part of color quickdraw. A lot of crashes occur there, but I don't know why that is. Steve Wilson Emergent Behavior (415) 494-6763 Steve@emer.com +++++++++++++++++++++++++++ >From isis@isis-intl.com (Mike Cohen) Date: Sat, 20 Jan 1996 14:47:40 -0600 Organization: ISIS International In article <30FBE98E.7B2D@iftech.com>, Kevin <webb@iftech.com> wrote: >Does anyone have any info on the _Jackson trap ($ABO3). I had >never heard of it before, but it has been causing some problems >lately and I want to know what the story behind it is. > That's an internal call used by Color QuickDraw. When you see the infamous _Jackson crash, it means QuickDraw either didn't have enough memory to complete some operation or some software corrupted QuickDraw's globals so it just decided to give up. -- Mike Cohen - isis@isis-intl.com Home Page: http://www.isis-intl.com/ Sound is the same for all the world - Youssou N'dour, "Eyes Open" *** Save Mystery Science Theater 3000! Comedy Central has decided to *** cancel it. Call them at (212) 767-8600 and tell them what you think. *** Full details at http://fermi.clas.virginia.edu/~jcp9j/canceled.html +++++++++++++++++++++++++++ >From mclow@mailhost2.csusm.edu (Marshall Clow) Date: Sat, 20 Jan 1996 22:30:45 -0800 Organization: Aladdin Systems In article <30FBE98E.7B2D@iftech.com>, Kevin <webb@iftech.com> wrote: >Does anyone have any info on the _Jackson trap ($ABO3). I had >never heard of it before, but it has been causing some problems >lately and I want to know what the story behind it is. > >Please email: webb@iftech.com > Short answer: _Jackson is where QuickDraw goes to die. Slightly longer answer: Color QuickDraw calls _Jachson when it is in the middle of doing something and something goes wrong. An example of this is when it is drawing a picture, and a region in the picture has to be scaled, and MapRgn fails (not enough memory, for example). Because of some history that I am not privy to, QD jumps to Jackson, rather than failing gracefully. There isn't really anything you can do about it, except make sure that QuickDraw doesn't fail. 99% of the failures are caused by running out of memory. Don't run out of memory. Not really a satisfying answer, is it? -- Marshall Clow Aladdin Systems "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -- Benjamin Franklin _Historical Review of Pennsylvania_, 1759 +++++++++++++++++++++++++++ >From dowdy@apple.com (Tom Dowdy) Date: Tue, 23 Jan 1996 17:03:09 GMT Organization: Apple Computer, Inc. In article <bill-2001962243070001@sc1.scconsult.com>, bill@scconsult.com (Bill Stewart-Cole) wrote: > In article <Steve-1901961842000001@dwilson.vip.best.com>, Steve@emer.com > (Steve Wilson) wrote: > > >In article <30FBE98E.7B2D@iftech.com>, Kevin <webb@iftech.com> wrote: > > > >> Does anyone have any info on the _Jackson trap ($ABO3). I had > >> never heard of it before, but it has been causing some problems > >> lately and I want to know what the story behind it is. > > > >I think it is part of color quickdraw. A lot of crashes occur there, but > >I don't know why that is. > > It is not uncommon to crash CQD by hitting a _Debugger call at the start > of _Jackson when you make a QuickDraw call with the wrong sort of > parameter (like a pointer where a handle should be) or when you are trying > to move large pictures or complex regions around. Deciphering the cause > post-crash is terribly difficult, but you can usually locate it by > sniffing out QuickDraw calls and looking carefully at the last one before > the crash. What I have most often seen is that CQD is running out of > memory and slamming the stack down into the heap hard (not only thru the > heap end block, but sometimes right down thru the entire heap and out the > bottom end, which gets very ugly) by trying to push an entire picture, > pixmap, or region structure. Because CQD is running from system space it > doesn't run into any problems strictly from overwriting the entire > application heap. > > I believe that _Jackson itself is the lowest-level routine for throwing > pixel data into the frame buffer, and some wag at Apple equated this to > Jackson Pollack's spattering of paint on canvas. Sigh. I post this every so often, but the incorrect information still seems to be running around. No. _Jackson does *nothing* but throw a SysErr. At the time that 32 bit QuickDraw was being written, two traps were assigned to it. One is now known as _QDDispatch, and the other was never used and kept its original name _Jackson. The code name for 32 bit QuickDraw was Jackson Pollack. As far as I know, _QDDispatch was never referred to as _Pollack. I can only assume that _Jackson was going to be used for some setjmp style of error recovery, but that was never implemented. There are two common ways to end up in _Jackson. Flat running out of RAM, or incorrect parameters to QuickDraw. Because of the second, you'll sometimes have some bug that is totally unrelated to drawing cause a _Jackson to fire -- you've trashed either your heap or your own data, and later attempts to draw same result in the trap. -- Tom Dowdy Internet: dowdy@apple.COM Apple Computer MS:302-3KS UUCP: {sun,voder,amdahl,decwrl}!apple!dowdy 1 Infinite Loop AppleLink: DOWDY1 Cupertino, CA 95014 "The 'Ooh-Ah' Bird is so called because it lays square eggs." --------------------------- >From tbekiare@ux7.cso.uiuc.edu (Bekiares Tyrone Drew) Subject: detecting CD-ROM Date: 18 Jan 1996 22:00:44 GMT Organization: University of Illinois at Urbana How would I go about detecting if a machine has a CD-ROM drive (internal or extenal)? Should I go through the drive queue and look for removeables with a certain attribute? I can't think of what would mark a CD-ROM drive differently than a syquest or bernoulli cartidge other than read only.. thoughts? Thanks! tb93@uiuc.edu +++++++++++++++++++++++++++ >From mclow@mailhost2.csusm.edu (Marshall Clow) Date: Sat, 20 Jan 1996 22:38:09 -0800 Organization: Aladdin Systems In article <4dmfuc$d92@vixen.cso.uiuc.edu>, tbekiare@ux7.cso.uiuc.edu (Bekiares Tyrone Drew) wrote: >How would I go about detecting if a machine has a CD-ROM drive >(internal or extenal)? > >Should I go through the drive queue and look for removeables >with a certain attribute? I can't think of what would mark >a CD-ROM drive differently than a syquest or bernoulli cartidge >other than read only.. > Short answer: You can't with 100% reliability. Long answer is at: <http://dev.info.apple.com/techqa/devices/dev18.html#RTFToC18> -- Marshall Clow Aladdin Systems "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -- Benjamin Franklin _Historical Review of Pennsylvania_, 1759 --------------------------- End of C.S.M.P. Digest **********************