From: owner-csmp@ee.mcgill.ca Subject: csmp digest Vol 4 No 040 C.S.M.P. Digest Mon, 29 Sep 97 Volume 4 : Issue 40 Today's Topics: Asynchronous sound Block Initializer Codewarrior C++ Standard Template Library (STL) prob's Does StandardGetFile cause memory leaks? Drag and Drop : Promised HFS Getting the highlight menu color ? How to fade screen to black? How to make an app drop-launchable How to tell if volume is CD-ROM Open Document Apple Event? Pic C.S.M.P. Digest Mon, 29 Sep 97 Volume 4 : Issue 40 Today's Topics: Asynchronous sound Block Initializer Codewarrior C++ Standard Template Library (STL) prob's Does StandardGetFile cause memory leaks? Drag and Drop : Promised HFS Getting the highlight menu color ? How to fade screen to black? How to make an app drop-launchable How to tell if volume is CD-ROM Open Document Apple Event? PicHandle Question Q: What is 'Far' code-glue? Q: Writing Printer Drivers QC and other tools? Rel Block Movement?? Software to determine causes of crash Use of keyUp and keyDown events? What's the 'CCI(TM)'? [Q] How to determine the current application FSSpec? [Q] Routine Dispatch Code changing menu items in popup menus? nonrelocatable-locked memory The Comp.Sys.Mac.Programmer Digest is moderated by Mark Aiken (marka@ee.mcgill.ca). 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 ee.mcgill.ca). 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 digests can be obtained by email, ftp or through the World Wide Web. If you want to receive the digest by mail, send email to majordomo@ee.mcgill.ca with no subject and one of the following commands as body: help Sends you a summary of commands subscribe csmp Adds you to the mailing list unsubscribe csmp Removes you from the list Once you have subscribed, you will automatically receive each new issue as it is created. Back issues are available by ftp from Info-Mac mirror sites in the per/csmp subdirectory, e.g. ftp://sumex-aim.stanford.edu/info-mac/per/csmp/ The contents of all back issues can be searched by accessing the following URL, courtesy of Andrew Barry (ajbarry@ozemail.com.au): http://marvin.stattech.com.au/search.html They can also be searched through the following URLs, thanks to Tim Tuck (Tim.Tuck@sensei.com.au): http://wais.sensei.com.au/searchform.html wais://wais.sensei.com.au:210/csmp? ------------------------------------------------------- >From Daniel Krause Subject: Asynchronous sound Date: Sat, 06 Sep 1997 09:29:55 -0500 Organization: EarthLink Network, Inc. I've got all the subroutines from "Inside Macintosh:Sound" understood but I don't know how to integrate them into a whole. Anybody have a good source code for simply playing an async sound from a sound file? I have found a few but they try and do everything in the world along with it and the code gets lost. Any help out there? respond to my e-mail please, thanks oldmanhonda@earthlink.net +++++++++++++++++++++++++++ >From sbryan@vendorsystems.com (Steve Bryan) Date: Thu, 11 Sep 1997 11:59:03 -0500 Organization: VSI In article <341168E1.5BED@earthlink.net>, oldmanhonda@earthlink.net wrote: > I've got all the subroutines from "Inside Macintosh:Sound" understood > but I don't know how to integrate them into a whole. Anybody have a good > source code for simply playing an async sound from a sound file? I have > found a few but they try and do everything in the world along with it > and the code gets lost. Any help out there? > > respond to my e-mail please, thanks > > oldmanhonda@earthlink.net Issue 11 of the late lamented 'develop' magazine had a useful article and source code about asynchronous sound. Here are the urls: http://gemma.apple.com/cgi-bin/ftpchooser.pl?partialURL=Periodicals/develop/develop11/develop_Issue_11/The_Asynchronous_Sound_.sit.hqx http://gemma.apple.com/cgi-bin/ftpchooser.pl?partialURL=Periodicals/develop/develop11/develop_11_code/Async_Sound_Helper.sit.hqx A bookmark where you can check for develop back issues is: http://gemma.apple.com/dev/toc.shtml -- Steve Bryan sbryan@vendorsystems.com --------------------------- >From BHuey@nospam.att.net (Hugh Johnson) Subject: Block Initializer Date: Wed, 10 Sep 1997 13:38:25 -0600 Organization: Semplice In C/C++, isn't there a way to initialize a block of data on the stack that doesn't conform to any data type? I mean, here¼s my problem: I have string constants which I need to encrypt with a simple Xor scheme, and it's just so much easier to code them right into the source rather than building some kind of resource struct. So I'd like to just declare them in their respective functions like so: uchar demoStr[] = 0x15F33E6CC2; // will be "\pDemo" after Xor Obviously this won't compile, but I want something like this. I have to do a bunch of these things and I'd hate to have to break each one up into a kosher data type array. Isn't there a way just to do it as a hex block like this? -- Hugh Johnson Replace "nospam" with "worldnet" +++++++++++++++++++++++++++ >From DavidO@dascorp.com (David Phillip Oster) Date: Wed, 10 Sep 1997 15:59:21 -0700 Organization: Digital Arts & Sciences Corp. In article , BHuey@nospam.att.net (Hugh Johnson) wrote: >In C/C++, isn't there a way to initialize a block of data on the stack >that doesn't conform to any data type? I mean, here¼s my problem: I have >string constants which I need to encrypt with a simple Xor scheme, and >it's just so much easier to code them right into the source rather than >building some kind of resource struct. So I'd like to just declare them in >their respective functions like so: > > uchar demoStr[] = 0x15F33E6CC2; // will be "\pDemo" after Xor the following will compile: uchar demoStr[] = { 0x15, 0xF3, 0x3E, 0x6C, 0xC2}; try using a regular expression search and replace: Search for: ([0-9a-f][0-9a-f]) replace by: 0x&, -- -- Warning: posted from an unlocked cubicle: no guarantee its really me. WebTV means a whole new generation of even more clueless newbies. They are easy to filter out though. Just look for this header in their posts: Date: 00:00:00 +++++++++++++++++++++++++++ >From BHuey@nospam.att.net (Hugh Johnson) Date: Sat, 13 Sep 1997 00:09:41 -0600 Organization: Semplice In article , DavidO@dascorp.com (David Phillip Oster) wrote: > >In C/C++, isn't there a way to initialize a block of data on the stack > >that doesn't conform to any data type? I mean, here¼s my problem: I have > >string constants which I need to encrypt with a simple Xor scheme, and > >it's just so much easier to code them right into the source rather than > >building some kind of resource struct. So I'd like to just declare them in > >their respective functions like so: > > > > uchar demoStr[] = 0x15F33E6CC2; // will be "\pDemo" after Xor > > > the following will compile: > uchar demoStr[] = { 0x15, 0xF3, 0x3E, 0x6C, 0xC2}; > > try using a regular expression search and replace: > > Search for: > ([0-9a-f][0-9a-f]) > > replace by: > 0x&, > Thanks, yes, that's basically what I ended up doing. But I still wish there was something equivalent to the "code" statement in Rez, where you could just paste in a bunch of hex and the compiler would size the array to suit. -- Hugh Johnson Replace "nospam" with "worldnet" +++++++++++++++++++++++++++ >From BHuey@nospam.att.net (Hugh Johnson) Date: Sat, 13 Sep 1997 22:34:59 -0600 Organization: Semplice In article <5vd77f$mnm@bgtnsc02.worldnet.att.net>, BHuey@nospam.att.net (Hugh Johnson) wrote: > Thanks, yes, that's basically what I ended up doing. But I still wish > there was something equivalent to the "code" statement in Rez, where you > could just paste in a bunch of hex and the compiler would size the array > to suit. I meant the "DATA" statement. -- Hugh Johnson Replace "nospam" with "worldnet" +++++++++++++++++++++++++++ >From Conal Walsh Date: Sun, 14 Sep 1997 00:07:36 -0400 Organization: Correct Procedures Pty Ltd David Phillip Oster wrote: > > In article , BHuey@nospam.att.net (Hugh Johnson) wrote: > > >In C/C++, isn't there a way to initialize a block of data on the stack > >that doesn't conform to any data type? I mean, here1s my problem: I have > >string constants which I need to encrypt with a simple Xor scheme, and > >it's just so much easier to code them right into the source rather than > >building some kind of resource struct. So I'd like to just declare them in > >their respective functions like so: > > > > uchar demoStr[] = 0x15F33E6CC2; // will be "\pDemo" after Xor > > the following will compile: > uchar demoStr[] = { 0x15, 0xF3, 0x3E, 0x6C, 0xC2}; > > try using a regular expression search and replace: > > Search for: > ([0-9a-f][0-9a-f]) > > replace by: > 0x&, Reminder: if you are writing in C, you will need "static uchar demoStr[] = { ... }" if this is inside a function. Even for C++, it is much more efficient to make a declaration like this "static" storage type. You probably also want to make it "const". CYL /||\ Conal Walsh / ||/ Correct Procedures Engineering and Consultancy \ || Toronto, Canada Services for the \|| correct@mypostbox.com Telecommunications Industry "Some people live in the fast lane; I live in the oncoming traffic." --------------------------- >From Audrey Pichair Subject: Codewarrior C++ Standard Template Library (STL) prob's Date: Sun, 07 Sep 1997 12:49:31 -0800 Organization: Netcom Hi all: I am using Codewarrior on a PowerPC, and I have a problem with the predefined templates in the C++ Standard Template Library (STL). When I try to instantiate one of the templates in the STL (in this case, list.h) I get a compile time error. I followed the syntax from Glass in Schubert's "The STL Primer" (i.e., list mylist; ) Also, I tried the fix suggested on Metrowerks' Known Bug List on the the Metrowerks website: (i.e., list> mylist;) However, both of these resulted in compile time errors. I'll include a sample program and the error message: *** a program example... #include #include //int array1 [] = {9,16,36}; //int array2 [] = {1,4}; int main() { list> lst; //list l1 (array1, array1+3); //list l2 (array2, array2+2); //l1.splice (l1.begin (), 12); //list::iterator i = l1.begin (); //while (i != l1.end()) //cout << *i++ << '\n'; return 0; } *** the error message... Error : illegal template argument(s) HelloWorld.cp line 16 list> lst; I would appreciate whatever input or suggestions anyone might have. -Audrey +++++++++++++++++++++++++++ >From MWRon@metrowerks.com (MW Ron) Date: Sun, 07 Sep 1997 19:37:03 -0400 Organization: Metrowerks In article <34131359.17B7@iname.com>, aud@iname.com wrote: >I am using Codewarrior on a PowerPC, and I have a problem with the >predefined templates in the C++ Standard Template Library (STL). When I >try to instantiate one of the templates in the STL (in this case, >list.h) I get a compile time error. > list> lst; > >Error : illegal template argument(s) >HelloWorld.cp line 16 list> lst; I answered this on csmpcw, but thought I'd add some more information. The error is with the line parsing the >> as the operator >> rather than the end of two templates. I know it is silly and the error message could be cleaned up a bit but the underscore is under the >> and most people have done this once before in their lifes and know the drill. I'm sure you will understqnd the error message next time :) Ron -- METROWERKS Ron Liechty http://www.metrowerks.com MWRon@metrowerks.com +++++++++++++++++++++++++++ >From support@metrowerks.com (Ary Djajadi) Date: Mon, 08 Sep 1997 09:15:16 -0500 Organization: Metrowerks, Inc In article <34131359.17B7@iname.com>, aud@iname.com wrote: > I followed the syntax from Glass in Schubert's "The STL Primer" > (i.e., list mylist; ) > > Also, I tried the fix suggested on Metrowerks' Known Bug List on the the > Metrowerks website: > (i.e., list> mylist;) > > However, both of these resulted in compile time errors. Audrey, The current CW's compiler technology does not yet support the default template argument. That is why the allocator needs to be specified. The reason it won't compile is because you are missing a space in between '>>' list> lst; //----> not gonna work list > lst; //----> should work ^----> notice the space here. The space is important to avoid compiler confusion between right shift operator and end of template argument. Thanks. Ary, Metrowerks Technical Support --------------------------- >From dstone@BIT.chem.utoronto.ca (David Stone) Subject: Does StandardGetFile cause memory leaks? Date: 12 Sep 1997 21:18:50 GMT Organization: University of Toronto Chemistry Yet more memory hell and strange situations... My application uses StandardGetFile with three entries in the SFTypeList and no custom filter proc. If I simply select Open from my file menu and click the cancel button in the dialog, and repeat this a few times, QC reports a memory error. This is not always the same, and dose not always occur on the same number of cycles, but could be either "heap does not contain handle" or "Invalid physical block length". Further more, when I "es" out of MacsBug, QC does not turn off and I have to reboot. Is MacOS 7.5.0 really that flakey, or am I missing something? SFTypeList myTypes; StandardFileReply reply; myTypes[0] = 'TYP1'; myTypes[1] = 'TYP2'; myTypes[2] = 'TYP3'; StandardGetFile(0L,3,myTypes,&reply; David Stone (remove the obvious bit to reply...) +++++++++++++++++++++++++++ >From kevin@vailstar.com (Kevin Michael Vail) Date: Sat, 13 Sep 1997 12:51:59 -0400 Organization: The Vail-Starn Family In article , dstone@BIT.chem.utoronto.ca (David Stone) wrote: >My application uses StandardGetFile with three entries in the >SFTypeList and no custom filter proc. If I simply select >Open from my file menu and click the cancel button in the >dialog, and repeat this a few times, QC reports a memory >error. This is not always the same, and dose not always occur >on the same number of cycles, but could be either "heap >does not contain handle" or "Invalid physical block length". >Further more, when I "es" out of MacsBug, QC does not turn >off and I have to reboot. Is MacOS 7.5.0 really that >flakey, or am I missing something? I seem to recall reading somewhere that MacOS8 does fix a memory leak problem that existed in 7.5.x. -- Kevin Michael Vail | I would rather have a mind opened by wonder kevin@vailstar.com | than one closed by belief. -- Gerry Spence +++++++++++++++++++++++++++ >From devon@???.onyx-tech.com (Devon Hubbard) Date: Sun, 14 Sep 1997 14:44:36 -0700 Organization: Onyx Technology In article , kevin@vailstar.com (Kevin Michael Vail) wrote: >In article , >dstone@BIT.chem.utoronto.ca (David Stone) wrote: > >>My application uses StandardGetFile with three entries in the >>SFTypeList and no custom filter proc. If I simply select >>Open from my file menu and click the cancel button in the >>dialog, and repeat this a few times, QC reports a memory >>error. This is not always the same, and dose not always occur >>on the same number of cycles, but could be either "heap >>does not contain handle" or "Invalid physical block length". >>Further more, when I "es" out of MacsBug, QC does not turn >>off and I have to reboot. Is MacOS 7.5.0 really that >>flakey, or am I missing something? > >I seem to recall reading somewhere that MacOS8 does fix a memory leak >problem that existed in 7.5.x. There was a problem in 7.5 where Standard File was doing a BlockMove with a srcPtr of NIL and QC would report that error. QC was rev'd (back in Jul of 95) to avoid reporting that error though as it just became annoying to the majority of our customer base. Apple later fixed the bug in 7.5.1 or around there (sorry, I can't remember). If this is reproducible for you everytime, please send us an email at and we'll look into it. Regards, dEVoN Hubbard Onyx Technology, Inc. -- To email the author, remove the '????.' from the email address. --------------------------- >From Thomas.Poetzl@studbox.uni-stuttgart.de (Thomas Poetzl) Subject: Drag and Drop : Promised HFS Date: 7 Sep 1997 14:22:56 GMT Organization: Comp.Center (RUS), U of Stuttgart, FRG Hallo, What I have to do to receive a "promised HFS flavor" ?. Where can I find an example ? Thanks Thomas +++++++++++++++++++++++++++ >From DavidO@dascorp.com (David Phillip Oster) Date: Mon, 08 Sep 1997 15:56:54 -0700 Organization: Digital Arts & Sciences Corp. In article , Thomas.Poetzl@studbox.uni-stuttgart.de (Thomas Poetzl) wrote: >Hallo, > >What I have to do to receive a "promised HFS flavor" ?. Where >can I find an example ? Tech note 1085 on http://www.devworld.apple.com warning(1): you can't promise an hfsFlavor in 7.5.3 and expect it to work. Promising a promiseHFSFlavor does work, however. waring(2): I've promised alias files, and gotten it to work for a single file, but Finder crashes for multiple files after I've made them all. I'm attempting to debug this today. -- -- Warning: posted from an unlocked cubicle: no guarantee its really me. Give a man a fish: feed him for a day. Teach a man to fish: feed him for life. Teach a hundred men to fish: deplete the fish stock, destroy an ecosystem. --------------------------- >From "StÈphane Madrau" Subject: Getting the highlight menu color ? Date: Thu, 11 Sep 1997 16:40:18 +0200 Organization: LSGC - GSMP I wrote a little MDEF that draws some colors sqares, to choose a color in a palette. When highlighted, a menu item is outlined with a 2-sized, black RoundRect. All was ok in the B&W mode of System 7. Now I want to go further, and make it work for Aaron, Kaleidoscope, and even MacOS8... So, I can paint the background in the color I want (gray in MacOS8, etc), but the highlight color is always black, of course. I saw Mercutio-MDEF is functioning correctly, but the simple Concordia-MDEF on the ToolChest CD draws always Black on white. Is there a way to get the RGBColor used for highlighting a menu item ? (a simple way that can work in any case is better :-) ). Or do I need to use an other highlight method ? Thanks. StÈphane +++++++++++++++++++++++++++ >From DavidO@dascorp.com (David Phillip Oster) Date: Thu, 11 Sep 1997 14:09:56 -0700 Organization: Digital Arts & Sciences Corp. In article <341802D2.241454EA@ensic.u-nancy.fr>, madrau@ensic.u-nancy.fr wrote: >Is there a way to get the RGBColor used for highlighting a menu item ? look up the system call: GetMCEntry() in Inside Macintosh:Toolbox Essentials (page 3-145) The appropriate fields for a Menu item are: ID Item RGB1 RGB2 RGB3 RGB4 N<>0 M<>0 Mark color Item text Keyboard Background color equivalent color of menu color Test is hilited by redrawing the menu item with the background color and the item text color flipped. for other kinds of hiliting, you might consider using Quickdraw's hilite mode. The hilite mode is described in „Highlighting¾ beginning on page 4-41 of Inside Macintosh: Imaging With QuickDraw. basicly, you do: LMSetHiliteMode(LMGetHiliteMode() & 0x7F); InvertRect(&r); -- -- Warning: posted from an unlocked cubicle: no guarantee its really me. "When you asked me to live in sin with you, you didn't say you meant 'sloth'." +++++++++++++++++++++++++++ >From "StÈphane Madrau" Date: Fri, 12 Sep 1997 16:34:31 +0200 Organization: LSGC - GSMP David Phillip Oster wrote: > look up the system call: GetMCEntry() in Inside Macintosh:Toolbox > Essentials > (page 3-145) > > > The appropriate fields for a Menu item are: > > ID Item RGB1 RGB2 RGB3 RGB4 > N<>0 M<>0 Mark color Item text Keyboard Background > color equivalent color of menu > color Won't work because the colors I use for drawing the squares are in the mctb. I'll take a look at that without creating an mctb resource... > Test is hilited by redrawing the menu item with the background color > and > the item text color flipped. Ok in B&W, but with Appearance ? Highlight color is (eg) Emerald and text is black.... > for other kinds of hiliting, you might consider using Quickdraw's > hilite mode. > The hilite mode is described in „Highlighting¾ beginning on page 4-41 > of Inside Macintosh: Imaging With QuickDraw. > > basicly, you do: > > LMSetHiliteMode(LMGetHiliteMode() & 0x7F); > InvertRect(&r); Won't work: it uses the text-highlight color, not the menu one (which was always black until Aaron or some other extensions...) And without this mode, I get a yellow square on a grey background... What i'm wondering is: what does Aaron ? does it patch the system routine ? Basically, it's only an 'InvertRect' or sthg like that, not ? So, why doesn' is patch my Invertrect routine ???? StÈphane +++++++++++++++++++++++++++ >From jac@igor.caltech.edu (Jeff Clites) Date: Fri, 12 Sep 1997 20:31:24 -0700 Organization: California Institute of Technology, Pasadena In article <341952F7.3B71972A@ensic.u-nancy.fr>, madrau@ensic.u-nancy.fr wrote: [snip] >Won't work: it uses the text-highlight color, not the menu one (which >was always black until Aaron or some other extensions...) >And without this mode, I get a yellow square on a grey background... > >What i'm wondering is: what does Aaron ? does it patch the system >routine ? Basically, it's only an 'InvertRect' or sthg like that, not ? >So, why doesn' is patch my Invertrect routine ???? I'm not sure what Aaron does for menu highlighting, but for progress bars I'm told it patches PaintRect so that when called to paint a rectangle of a specific height and color, the patch kicks in and makes the progress bar look 3D. (If you have Norton Utilities' SpeedDisk, you can see one of the rare instances where this seemingly brutal strategy messes up--one of the items in the color key looks like a progress bar, but should just be a gray rect.) So, if Aaron patches InverRect, the patch probably only kicks in for rectangles of a certain height. If you are really stuck, you could probably email Greg Landweber (auther or Aaron and Kaleidoscope). He seems caffeinated enough that he might be willing to help. Also, I've noticed that Alessandro Levi Montalcini's products (at least "Simple Text Color Menu") properly use the Appearance accent color for things like focus frames, so he might be able to help. His web page is at http://persoweb.francenet.fr/~alm. Also, have you checked the Appearance headers? There might be a simple Toolbox call to get this color under OS8. I'll bet that doing it under older OS's is whole other story, and it might be easiest to get the info directly from Aaron or Kaleidoscope. (Or, find out what resource they use to store the info in, and get it from there. I believe they have a guide to writing Kaleidoscope Schemes, so it might reveal the magic resource.) Good luck. (I fear I wasn't of much help.) - ------------------------------------------------------------------------ Jeff Clites Pasadena, California My account name is jac and the rest of my address has igor and caltech and edu, separated by dots. Don't spam me or anybody else (please). --------------------------- >From stoedle@online.no (Daniel St¯dle) Subject: How to fade screen to black? Date: Fri, 29 Aug 1997 18:26:43 +0200 Organization: Telenor Online Public Access Hello everyone, How do I fade the screen to black and back again? I have tried the method used in Tricks of the Mac Game Programming Gurus, but upon having faded the screen, it slows my game down to a crawl. It simply isn't playable after fading, I can't have more than three or four sprites on screen. The game itself is heavily sprite based and relies on both CopyBits and a custom blitting routine to do the graphics. The game runs in 8-bit. Any help would be very much appreciated. Also, if anyone could tell me an easy and fast way of making moving stars in the background, that'd be great. Thanks, Daniel St¯dle +++++++++++++++++++++++++++ >From dtp@pluto.njcc.com (David T. Pierson) Date: Fri, 29 Aug 1997 23:42:00 -0400 Organization: New Jersey Computer Connection, Lawrenceville, NJ In article , stoedle@online.no (Daniel St¯dle) wrote: > How do I fade the screen to black and back again? I have tried the method > used in Tricks of the Mac Game Programming Gurus, but upon having faded > the screen, it slows my game down to a crawl. I don't know what the method you used is, but you could try gamma fading via DrawSprocket, part of Apple's Game Sprocket Libraries. http://gemma.apple.com/dev/techsupport/insidemac/Sprockets/GameSprockets-85.html Alternatively, there is also some code at Ambrosia's source code archive. I use Matt Slot's which is at: http://www.AmbrosiaSW.com/alt.sources.mac/volume10.html HTH, David +++++++++++++++++++++++++++ >From demon@news.loop (The Anonymous Mouse) Date: Mon, 01 Sep 1997 10:54:40 +0000 Organization: The Cheese Factory > Also, if anyone could tell me an easy and fast way of making moving stars > in the background, that'd be great. This is a cool bit of code as its easy to incorporate into any program. http://hyperarchive.lcs.mit.edu/HyperArchive/Archive/dev/src/warp-ii-c.hqx In article , stoedle@online.no (Daniel St¯dle) wrote: > Hello everyone, > > How do I fade the screen to black and back again? I have tried the method > used in Tricks of the Mac Game Programming Gurus, but upon having faded > the screen, it slows my game down to a crawl. It simply isn't playable > after fading, I can't have more than three or four sprites on screen. The > game itself is heavily sprite based and relies on both CopyBits and a > custom blitting routine to do the graphics. The game runs in 8-bit. Any > help would be very much appreciated. > > Also, if anyone could tell me an easy and fast way of making moving stars > in the background, that'd be great. > > Thanks, > Daniel St¯dle -- Reply to: The anonymous mouse. anonymouse@mindless.com +++++++++++++++++++++++++++ >From demon@news.loop (The Anonymous Mouse) Date: Mon, 01 Sep 1997 10:47:25 +0000 Organization: The Cheese Factory Apple game sprockets had Gamma fading - http://devworld.apple.com/dev/techsupport/insidemac/Sprockets/GameSprockets- 120.html I've seen a few third party lib's that do really nice gamma fades to various colors and do not slow down drawing (at least they didnt with my app's). try searching for 'gamma fade' Mouse In article , stoedle@online.no (Daniel St¯dle) wrote: > Hello everyone, > > How do I fade the screen to black and back again? I have tried the method > used in Tricks of the Mac Game Programming Gurus, but upon having faded > the screen, it slows my game down to a crawl. It simply isn't playable > after fading, I can't have more than three or four sprites on screen. The > game itself is heavily sprite based and relies on both CopyBits and a > custom blitting routine to do the graphics. The game runs in 8-bit. Any > help would be very much appreciated. > > Also, if anyone could tell me an easy and fast way of making moving stars > in the background, that'd be great. > > Thanks, > Daniel St¯dle -- Reply to: The anonymous mouse. anonymouse@mindless.com +++++++++++++++++++++++++++ >From schorsch.noSPAM@apple.com (Brent Schorsch) Date: Fri, 12 Sep 1997 06:14:23 -0700 Organization: Apple Computer, Inc In article , demon@news.loop (The Anonymous Mouse) wrote: > Apple game sprockets had Gamma fading - > http://devworld.apple.com/dev/techsupport/insidemac/Sprockets/GameSprockets- > 120.html had??? it's still there ... You can find it at (the unofficial sprockets page): http://www.unsupported.com/ don't let the name fool you, Sprockets are fully supported.. this site just has the latest and greatest stuff, the ramp time to get stuff on the 'official site' is a lot longer, so it's stuff is necessarily older -Brent --------------------------- >From NOSPAM.dcardani@totalint.com.NOSPAM (Darrin Cardani) Subject: How to make an app drop-launchable Date: Wed, 10 Sep 1997 08:59:30 -0500 Organization: Total Integration, Inc. I have an application I wrote and I want to be able to drop a document on it and have it lauch and open the document. I have set the "IsHighLevelEventAware" bit and have even rebuilt the desktop. For some reason, though, dragging a document over it does not cause it to highlight and dropping the document on it does nothing. What else do I have to do to make the Finder recognize that the app can have documents dropped on it? Darrin - -- To send email to me, please remove the "NOSPAM." from the beginning of my address and the ".NOSPAM" from the end of my address. And please - no spam. +++++++++++++++++++++++++++ >From rang@trillium.adaptec.com (Anton Rang) Date: Wed, 10 Sep 1997 12:14:02 -0500 Organization: Adaptec Trillium Development Center In article , NOSPAM.dcardani@totalint.com.NOSPAM (Darrin Cardani) wrote: > I have an application I wrote and I want to be able to drop a document on > it and have it lauch and open the document. I have set the > "IsHighLevelEventAware" bit and have even rebuilt the desktop. For some > reason, though, dragging a document over it does not cause it to highlight > and dropping the document on it does nothing. What else do I have to do to > make the Finder recognize that the app can have documents dropped on it? You need to make sure that there's an entry with the type of the document in your bundle resource. (You may need to rebuild the desktop after adding it.) That's about the only thing I can think of. -- Anton +++++++++++++++++++++++++++ >From GUDATH@EZINFO.VMSMAIL.ETHZ.CH (Henrik 'Ratte' Gudat) Date: 10 Sep 1997 19:18:45 GMT Organization: Synergetix In NOSPAM.dcardani@totalint.com.NOSPAM writes: > I have an application I wrote and I want to be able to drop a document on > it and have it lauch and open the document. I have set the > "IsHighLevelEventAware" bit and have even rebuilt the desktop. For some > reason, though, dragging a document over it does not cause it to highlight > and dropping the document on it does nothing. What else do I have to do to > make the Finder recognize that the app can have documents dropped on it? You must define BNDL resources. For each file type you'd like to recognize, you have to add an item so the Finder knows what documents your application accepts. It's pretty simple - start ResEdit and create a BNDL resource. It's pretty much learning by doing. If you would like to recognize folders, too, use 'fold' in the file type field. BTW, it helps to have a look at other applications such as StuffIt Expander or so. They're full of it. :-) Please note that after you have added these resources, the MacOS will not recognize the bundles immediately. You have to rebuild the desktop in order to have changes take effect. - henrik +++++++++++++++++++++++++++ >From NOSPAM.dcardani@totalint.com.NOSPAM (Darrin Cardani) Date: Thu, 11 Sep 1997 16:38:38 -0500 Organization: Total Integration, Inc. In article , rang@trillium.adaptec.com (Anton Rang) wrote: > In article , > NOSPAM.dcardani@totalint.com.NOSPAM (Darrin Cardani) wrote: > > I have an application I wrote and I want to be able to drop a document on > > it and have it lauch and open the document. I have set the > > "IsHighLevelEventAware" bit and have even rebuilt the desktop. For some > > reason, though, dragging a document over it does not cause it to highlight > > and dropping the document on it does nothing. What else do I have to do to > > make the Finder recognize that the app can have documents dropped on it? > > You need to make sure that there's an entry with the type of the > document in your bundle resource. (You may need to rebuild the desktop > after adding it.) That's about the only thing I can think of. That did it! Thanks! Darrin --------------------------- >From Student Subject: How to tell if volume is CD-ROM Date: Fri, 05 Sep 1997 12:35:48 -0500 Organization: The University of Manitoba Is there a way to determine whether a given volume is a CD-ROM based on a HParamBlock? Bill. +++++++++++++++++++++++++++ >From blob@apple.BOGUS.com (Brian Bechtel) Date: Tue, 09 Sep 1997 08:45:52 -0700 Organization: Apple Computer, Inc. -- DTS In article <341042F3.9F5A0170@domain.com>, Student wrote: > Is there a way to determine whether a given volume is a CD-ROM based on > a HParamBlock? See Q&A DV 18 at -- --Brian Bechtel to respond, remove the characters ".BOGUS" from my address --------------------------- >From Hank_Gillette@smtp.svl.trw.com (Hank Gillette) Subject: Open Document Apple Event? Date: Wed, 10 Sep 1997 22:44:20 -0700 Organization: None (I'm a Democrat) I recently added code to handle Open Document Apple Events to my application. It works fine when dropping documents on the icon of my active application, but I have two problems. If I launch my application by dropping a document on its icon, the program launches but does not open the document. If I've read Inside Mac correctly, dropping the document on the application icon should generate an Open Document Apple Event, but if it does, my application is not seeing it. Any ideas? I would also like to be able to drop a folder containing documents on my application and then process them. I currently generate an FSSpec record in my Open Document routine, but I cannot determine from this that I have been passed a folder. How do I find this out. Thanks, Hank Gillette +++++++++++++++++++++++++++ >From jac@igor.caltech.edu (Jeff Clites) Date: Thu, 11 Sep 1997 04:08:04 -0700 Organization: California Institute of Technology, Pasadena In article , Hank_Gillette@smtp.svl.trw.com (Hank Gillette) wrote: >I would also like to be able to drop a folder containing documents on my >application and then process them. I currently generate an FSSpec record >in my Open Document routine, but I cannot determine from this that I have >been passed a folder. How do I find this out. Check out DropShell 2.0. It has a routine, called FSpIsFolder which tells you whether your FSSpec is for a folder. This routine is in the DSUtils.c file. Also, this package has some useful code for iterating through a folder hierarchy, and it has code for handling odoc and other events. Check it out, it's great. - ------------------------------------------------------------------------ Jeff Clites Pasadena, California My account name is jac and the rest of my address has igor and caltech and edu, separated by dots. Don't spam me or anybody else (please). --------------------------- >From John Andersson Subject: PicHandle Question Date: Mon, 15 Sep 1997 02:18:49 +0000 Organization: Elektriska Bildbolaget Hi All! I hope someone could give me a hint on this one.. Where is the actual data of a pict stored after a "GetPicture" toolbox call? I load my picture into a PicHandle record, but I cant find the "pure" bitmap data. Ä Where is that data, and how is it stored? (RGBRGBRGB..?) Ä Where can i find "Apple Technote #27"? (TN #27 should explain the PICT file format in detail, but I cant find it on www.apple.com) /John +++++++++++++++++++++++++++ >From marssaxman@sprynet.com.antispam (Mars Saxman) Date: Sun, 14 Sep 1997 19:59:03 -0800 Organization: Red Planet Software In article <341C9B09.7099@bildbolaget.com>, john@bildbolaget.com wrote: > Hi All! > > I hope someone could give me a hint on this one.. > Where is the actual data of a pict stored after a "GetPicture" toolbox > call? I load my picture into a PicHandle record, but I cant find the > "pure" bitmap data. > > Ä Where is that data, and how is it stored? (RGBRGBRGB..?) > Ä Where can i find "Apple Technote #27"? > > (TN #27 should explain the PICT file format in detail, but I cant find > it on www.apple.com) > > /John PICT is not a bitmap format. Most of the PICT files currently passed around contain mainly bitmap data, but PICT itself is a vector format (mostly) that happens to be able to contain bitmaps. PICT is essentially a list of captured QuickDraw commands. OpenPicture and ClosePicture are the "start" and "stop" controls for an image macro recorder, and DrawPicture plays back the commands. Thus examining the data in the PicHandle isn't going to do you much good unless you write a full PICT parser, and even that isn't a terribly safe endeavour given that there are several versions of QuickDraw floating around with different ways of handling PICTs. The best thing to do is to create a new GWorld with the same dimensions as your PICT, then draw the PICT into it. Following this you can use LockPixels on the GWorld and examine its data directly. -Mars +++++++++++++++++++++++++++ >From shapiro@@aol.com (Eric Shapiro) Date: Sun, 14 Sep 1997 23:49:17 -0400 Organization: Relium Corp. In article <341C9B09.7099@bildbolaget.com>, john@bildbolaget.com wrote: > Where is the actual data of a pict stored after a "GetPicture" toolbox > call? I load my picture into a PicHandle record, but I cant find the > "pure" bitmap data. > > Ä Where is that data, and how is it stored? (RGBRGBRGB..?) > Ä Where can i find "Apple Technote #27"? Technotes can generally be found at . It really isn't easy to find the raw image data in a PICT because a PICT can contain much more than a simple raster image. It can contain lines, polygons, text, clipping, etc. If you just want the raster (bit) image, create a GWorld, draw the PICT into that GWorld, and then walk the rows by hand. The pixel format of the GWorld will depend on the depth that you specified to NewGWorld. In a 32-bit GWorld, the pixel format is NRGB NRGB NRGB (where N is ignored). In an 8-bit GWorld, each byte is an index into a color table which contains the RGB values for the pixel. -Eric --------------------------- >From drysdallSPAMFREE@waikato.ac.nz (Richard Drysdall) Subject: Q: What is 'Far' code-glue? Date: Tue, 09 Sep 1997 12:23:51 +1200 Organization: University of Waikato Hi. Can anyone tel me what 'Far' means in the contect of code or glue? For example, in the API's for InternetConfig, there's a "ICGlue.o" and an "ICGlueFar.o". Is it something to do with code segments? Thanks for any help. -- Richard Drysdall, University of Waikato, New Zealand (MIME mail is ok) * Please remove the upper case letters from my email address to reply. * Information gathering organisations are hereby denied permission to use any personal information pertaining to myself (including my email address) in any form of commercial transaction. Unsolicited email will be forwarded to the appropriate postmasters. +++++++++++++++++++++++++++ >From Conal Walsh Date: Sun, 14 Sep 1997 00:18:28 -0400 Organization: Correct Procedures Pty Ltd Richard Drysdall wrote: > > Hi. > > Can anyone tel me what 'Far' means in the contect of code or glue? For > example, in the API's for InternetConfig, there's a "ICGlue.o" and an > "ICGlueFar.o". Is it something to do with code segments? Yes - it is specific to 68k code. In this case, "ICGlue.o" utilises PC-relative addressing mode to implement calls to external code, meaning that the called code must be within 32k of the calling code when linked. "ICGlueFar.o" uses absolute 32-bit address mode which is dynamically relocated when the code loads and runs; this is the normal case these days since few people bother with the old "near" code model. CYL /||\ Conal Walsh / ||/ Correct Procedures Engineering and Consultancy \ || Toronto, Canada Services for the \|| correct@mypostbox.com Telecommunications Industry "Some people live in the fast lane; I live in the oncoming traffic." --------------------------- >From Gideon Greenspan Subject: Q: Writing Printer Drivers Date: Wed, 27 Aug 1997 04:01:54 +0100 Organization: University of Cambridge, England Does anyone have any information or writing a Chooser-selectable Printer Driver for the Mac? Thanks, Gideon gdg20@cam.ac.uk +++++++++++++++++++++++++++ >From demon@news.loop (The Anonymous Mouse) Date: Thu, 28 Aug 1997 10:44:30 +0000 Organization: The Cheese Factory I'm in the process of writing one for my employer and recommend unless you *really* have to then dont bother. Apple are little help and offered me a technote that was 3 years out of date and had the following disclaimer '....Third-party PMRF developers have told me that development of a PMRF with no experience could easily take 3 to 5 man years...." - Tech note 'Learning to drive'. You'll find little info on 'classic' drivers and lots on GX (which I couldnt use as it must work withoput GX - how many people do you know use GX??). heres a little insight into what involved- creating code resources for chooser and ones that are called by printmanager (these have a jump table so the printmanager can access the correct routine). you need to install quickdraw bottlenecks procedures to handle all QD calls. You need to create an interface with the outside world - ie opening serial port or SCSI. I could go on, but I wont. really, as bad as this sounds, dont do it if you can help it. If you feel you must then I can throw together all my development source I used to get a working driver, it may take a while to do and you'll need patience to examine it all. good luck In article , Gideon Greenspan wrote: > Does anyone have any information or writing a Chooser-selectable Printer > Driver for the Mac? > > Thanks, > Gideon > > gdg20@cam.ac.uk -- Reply to: The anonymous mouse. anonymouse@mindless.com +++++++++++++++++++++++++++ >From nospam@best.com (Dave Polaschek) Date: Thu, 28 Aug 1997 13:45:31 -0500 Organization: Polaschek Publishing In article , Gideon Greenspan wrote: > Does anyone have any information or writing a Chooser-selectable Printer > Driver for the Mac? is a sample printer driver. There is also the document "Learning to Drive". My article, "Desktop Printing Exposed" will tell you how to hook your driver up to desktop printing once you've got it written. Be aware that writing a printer driver is not a trivial task. Learning To Drive cautions that it could take 3 to 5 man-years, and that's not far off if you're not experienced (which it sounds like you aren't). On the other hand, I think that the StdFileSaver sample cuts some of that time off. One last thing, if you're not a member of Apple's Developer Programs, you should be. You're going to have some questions that are best answered by Apple. You should be able to get more information on devworld. -DaveP -- THE "REPLY TO" BUTTOM WILL NOT WORK WITH THIS POSTING The reply-to address has been altered to thwart junk e-mailers. Dave Polaschek - davep@best.com PGP key and other spiffy things at +++++++++++++++++++++++++++ >From demon@news.loop (The Anonymous Mouse) Date: Tue, 09 Sep 1997 17:51:16 +0000 Organization: The Cheese Factory In article , nospam@best.com (Dave Polaschek) wrote: > One last thing, if you're not a member of Apple's Developer Programs, you > should be. You're going to have some questions that are best answered by > Apple. You should be able to get more information on devworld. HA! what a laugh. We ar members of the Associates Plus and had pathetic offerings from Apple on this topic. The basic impression was dont do it. But then Apple and Adobe are in bed together and I guess the Mac printing Postsrcipt or nothing is in someones interest. We've just completed a PCL driver after about 3 months (1 man) development. Stick with it and stuff adobe! -- Reply to: The anonymous mouse. anonymouse@mindless.com --------------------------- >From dstone@chem.utoronto.ca (David Stone) Subject: QC and other tools? Date: 5 Sep 1997 18:42:06 GMT Organization: University of Toronto Chemistry Is the memory debugging tool "QC" still available? I have inadvertently lost all the info I had on this, and am kicking myself for not having bought a copy. Also, what does the 'DIZY' dcmd in Macsbug do? Finally, Macsbug 6.5.3 reports a corrupted heap following a MoveHHi on a BlockMove if I have "athc" on, but continuing anyway shows the heap "uncorrupting" itself. Is this normal? (System 7.5.0, VM & 32bit off). Thanks, Lost In Memory Hell - Again! (Dave Stone) +++++++++++++++++++++++++++ >From andrewwelc@aol.com (AndrewWelc) Date: 7 Sep 1997 11:32:58 GMT Organization: AOL http://www.aol.com > Is the memory debugging tool "QC" still available? I have > inadvertently lost all the info I had on this, and am > kicking myself for not having bought a copy. yep -- http://www.onyx-tech.com/ ...although personally, I've found their "Spotlight" tool to be much more valuable for finding sticky memory-related problems. +--------------------------------------------------------------+ | Andrew Welch - Thaumaturgist - Ambrosia Software, Inc. | +-------------------------------+------------------------------+ | AOL-> Keyword: Ambrosia | http://www.AmbrosiaSW.com/ | | CIS-> GO word: Ambrosia | ftp://ftp.AmbrosiaSW.com/ | +-------------------------------+------------------------------+ +++++++++++++++++++++++++++ >From devon@???.onyx-tech.com (Devon Hubbard) Date: Sun, 14 Sep 1997 14:36:31 -0700 Organization: Onyx Technology In article , dstone@chem.utoronto.ca (David Stone) wrote: >Is the memory debugging tool "QC" still available? I have >inadvertently lost all the info I had on this, and am >kicking myself for not having bought a copy. Yes, QC is still available. You can find it at . If you have any questions or need any help you can send email to anytime. Regards, dEVoN Onyx Technology, Inc. -- To email the author, remove the '????.' from the email address. --------------------------- >From john gallidakis Subject: Rel Block Movement?? Date: Fri, 12 Sep 1997 09:41:36 +0200 Organization: the Invisible Beacon Corporation, Inc. Hello again, I was wondering if anyone knows which routine is used to move the contents of a relocatable block when it's moved. I remember hearing it was BlockMove or am I mistaken? Thanx in advance -- ********************************************************************* If you have a Mac and think you are smart, try to beat my brain child ********************************************************************* +++++++++++++++++++++++++++ >From mh@primenet.com (Mark Hartman) Date: 12 Sep 1997 06:41:01 -0700 Organization: Mark Hartman Computer Solutions Provided it's not a purgeable resource, if the MacOS moves a relocatable block, it moves the contents of that block for you. (After all, if it just moved the pointers and said in essence, "Ha, ha! Now YOU'VE got to find where you left the data and move it yourself, provided it's not already written over!" - it would be sort of stupid.) In article <3418F230.E1E@ath.forthnet.gr>, jgal@ath.forthnet.gr wrote: >Hello again, >I was wondering if anyone knows which routine is used to move the >contents of a relocatable block when it's moved. I remember hearing it >was BlockMove or am I mistaken? >Thanx in advance >-- >********************************************************************* >If you have a Mac and think you are smart, try to beat my brain child > >********************************************************************* ============================================================================ Mark Hartman |Consultants to business, industry and education since 1977 C O M P U T E R | Database design * User interface * Troubleshooting S O L U T I O N S| Networking * Client/server systems * Macintosh * Oracle === tel 714/758-0640 ===============<*>================ fax 714/999-5030 === Do it right the first time. Macintosh. +++++++++++++++++++++++++++ >From devon@???.onyx-tech.com (Devon Hubbard) Date: Fri, 12 Sep 1997 12:12:19 -0700 Organization: Onyx Technology In article <3418F230.E1E@ath.forthnet.gr>, jgal@ath.forthnet.gr wrote: >Hello again, >I was wondering if anyone knows which routine is used to move the >contents of a relocatable block when it's moved. I remember hearing it >was BlockMove or am I mistaken? There's an old saying for Mac programmers, "BlockMove doesn't move memory". The joke here is that BlockMove doesn't move memory in the sense of the Mem Mgr moving relocatable blocks around. There is no specific call that causes relocatable blocks to move per se. There are quite a few calls however that do trigger memory movement by the memory manager. Every Memory Manager call typically moves memory. Calls that allocate memory like NewHandle, NewPtr and their Sys counterparts obviously can move memory. Some exceptions are calls like HLock and HUnlock, which are mem mgr calls that do not move memory. The internals of the memory manager move relocatable blocks in the heap around due to memory manager calls being made that are trying to work with memory. So in a sense the memory movement is automatic and normally not intentially under your control. What is it you are trying to do here? Do you want to detect relocatable blocks that have moved on you? Do you want to cause relocatable blocks to move to test your software? Are you trying to decide the best way to use relocatable blocks? Regards, dEVoN Hubbard Onyx Technology, Inc. -- To email the author, remove the '????.' from the email address. --------------------------- >From dave@digidem.com (David M. Rosner) Subject: Software to determine causes of crash Date: Mon, 15 Sep 1997 13:10:21 -0500 Organization: Digital Demographics, Inc. Does anyone know of software that logs system information, such as a cause of a crash, unreported system events, and other "system event" types of things. I am basically looking for the Mac equivalent of NT's Event Viewer. But what i really need is to determine which application is causing my server to crash every few days of so. Thanks for any help! -Dave M Rosner +++++++++++++++++++++++++++ >From Cathy Stevenson Date: 15 Sep 1997 19:43:25 GMT Organization: (none) dave@digidem.com (David M. Rosner) wrote: >Does anyone know of software that logs system information, such as a cause >of a crash, unreported system events, and other "system event" types of >things. I am basically looking for the Mac equivalent of NT's Event >Viewer. But what i really need is to determine which application is >causing my server to crash every few days of so. > >Thanks for any help! > >-Dave M Rosner I don't know what Event Viewer does, but Macsbug is the main "bug reporter" for the Mac. You can get it from the Apple web site. Cathy (To reply by email please delete NOSPAM from address.) "there's a dance or two in the old dame yet" - mehitabel cstevenson, M.D. cats1921@bestDOTcom +++++++++++++++++++++++++++ >From wndrin@nospam.magicnet.net (David Douglass) Date: Mon, 15 Sep 1997 21:01:58 -0500 Organization: INTERNET AMERICA In article , dave@digidem.com (David M. Rosner) wrote: The latest Norton Utilities has a new feature called "CrashGuard" While not as informative as it could be, it does keep a log and issues a set of options to deal with the problem. Used in conjunction with the extension "Okey Dokey Pro" (on info-mac, clicks OK and records the click on a file) it has handled our server to a certain extent. The biggest problem is that often CrashGuard will have 'try to fix' as the selected option, which doesn't work very often. Might work in your situation though. Dave Douglass (us Daves need to stick together :-) > Does anyone know of software that logs system information, such as a cause > of a crash, unreported system events, and other "system event" types of > things. I am basically looking for the Mac equivalent of NT's Event > Viewer. But what i really need is to determine which application is > causing my server to crash every few days of so. > > Thanks for any help! > > -Dave M Rosner --------------------------- >From Tom Rockwell Subject: Use of keyUp and keyDown events? Date: Tue, 02 Sep 1997 01:22:51 -0400 Organization: Sudden Death I'm hacking together a Pac-Man type game using SpriteWorld. I'll be using the arrow keys, and/or maybe some others to make the character move. Right now it works like this. Push the arrow key, character moves 5 pixels in that direction, pauses for a moment while the computer realizes they key is still pressed, then the character moves continuously in that direction. To get rid of the pause I have to recognize keyUp events, right? = SpriteWorld provides a nice little routine to do this which I have included in my code. My question is, how do I use it in the event handling routine? What's the easiest way? = I've included the pertinent routines in this message in case anyone wants to see them to respond specifically to it. Thanks. ->Later.....Spice - - Here's my event handling routine (swiped right from Glypha, BTW): void HandleEvent (void) { EventRecord theEvent; long sleep =3D 1L; Boolean itHappened; // See if an event is queued up. itHappened =3D WaitNextEvent(everyEvent, &theEvent, sleep, 0L); = if (itHappened) // Ah, an event. I live for events! { switch (theEvent.what) // And what kind of event be ya'? { case mouseDown: // Aiy! Y' be a mouse click do ya'? HandleMouseEvent(&theEvent); break; = case keyDown: // Key down, key held down events. case autoKey: HandleKeyEvent(&theEvent); break; = case keyUp: break; = case updateEvt: // Something needs redrawing! HandleUpdateEvent(&theEvent); break; = case osEvt: // Switching in and out events. HandleOSEvent(&theEvent); break; } } else // Check for "auto open" flag. { // If TRUE, set the flag back to=85 } = SWProcessSpriteWorld(SpriteWorldP); // Process the animation. SWAnimateSpriteWorld(SpriteWorldP); // Now draw it. } And this is my key handling event, also mostly swiped from Glypha: void HandleKeyEvent (EventRecord *theEvent) { char theChar; Boolean commandDown; = theChar =3D theEvent->message & charCodeMask; // Extract key hit. commandDown =3D ((theEvent->modifiers & cmdKey) !=3D 0); // See if comma= nd key down. = if (commandDown) // If command key down, call menu=85 { // handling routine. DoMenuChoice(MenuKey(theChar)); } else { switch (theChar) { case kLeftArrowKey: SWOffsetSprite(MacManP, -5, 0); break; = case kRightArrowKey: SWOffsetSprite(MacManP, 5, 0); break; = case kUpArrowKey: SWOffsetSprite(MacManP, 0, -5); break; = case kDownArrowKey: SWOffsetSprite(MacManP, 0, 5); break; } } } +++++++++++++++++++++++++++ >From Andrew Carl Schott Date: Tue, 02 Sep 1997 19:00:12 -0500 Organization: Rose-Hulman Insitute of Technology Tom Rockwell wrote: > > I'm hacking together a Pac-Man type game using SpriteWorld. I'll be > using the arrow keys, and/or maybe some others to make the character > move. > > Right now it works like this. Push the arrow key, character moves 5 > pixels in that direction, pauses for a moment while the computer > realizes they key is still pressed, then the character moves > continuously in that direction. > > To get rid of the pause I have to recognize keyUp events, right? > SpriteWorld provides a nice little routine to do this which I have > included in my code. My question is, how do I use it in the event > handling routine? What's the easiest way? Maybe you could set a variable when the key is pressed (i.e. if gDownArrowKey is true, then the key is down) and set it to false when you get the corresponding keyUp event. Then, somewhere in your event loop, do an if for each of your variables and move the guy accordingly. Andy +++++++++++++++++++++++++++ >From smfr@santafe.edu (Simon Fraser) Date: Sat, 06 Sep 1997 17:24:05 -0600 Organization: Santa Fe Institute In article <340CA88C.21D1@rose-hulman.edu>, andrew.carl.schott@rose-hulman.edu wrote: > Tom Rockwell wrote: > > > > I'm hacking together a Pac-Man type game using SpriteWorld. I'll be > > using the arrow keys, and/or maybe some others to make the character > > move. > > > > Right now it works like this. Push the arrow key, character moves 5 > > pixels in that direction, pauses for a moment while the computer > > realizes they key is still pressed, then the character moves > > continuously in that direction. > > > > To get rid of the pause I have to recognize keyUp events, right? > > SpriteWorld provides a nice little routine to do this which I have > > included in my code. My question is, how do I use it in the event > > handling routine? What's the easiest way? > > Maybe you could set a variable when the key is pressed (i.e. if > gDownArrowKey is true, then the key is down) and set it to false when > you get the corresponding keyUp event. Then, somewhere in your event > loop, do an if for each of your variables and move the guy accordingly. It's probably better, in the case of games, to bypass event handling for getting keypresses entirely, and just use GetKeys() to see what keys are down. Simon +++++++++++++++++++++++++++ >From johnb@hk.super.net.remove_this_to_mail_me (John W. Blackburne) Date: Sun, 07 Sep 1997 22:42:21 +0800 Organization: Hong Kong Supernet In article , smfr@santafe.edu (Simon Fraser) wrote: :It's probably better, in the case of games, to bypass event handling :for getting keypresses entirely, and just use GetKeys() to see :what keys are down. Only for testing. If you're planning on shipping and don't want to have to deal with support calls from people with devices GetKeys won't handle, such as Apple's ergonomic keyboard or a PowerBook keypad, or whose keyboard has a 'z' where yours has a 'w', and don't want to write code for all other input devices out there, then something like Input Sprockets might be better. John -- John Blackburne; programmer, writer, consultant, trainer tel/fax: Hong Kong (+852) 2816 7484 home page: +++++++++++++++++++++++++++ >From johnb@hk.super.net.remove_this_to_mail_me (John W. Blackburne) Date: Tue, 09 Sep 1997 23:10:58 +0800 Organization: Hong Kong Supernet In article , "Jonas Echterhoff" wrote: :>Only for testing. If you're planning on shipping and don't want to have to :>deal with support calls from people with devices GetKeys won't handle, :>such as Apple's ergonomic keyboard or a PowerBook keypad, or whose :>keyboard has a 'z' where yours has a 'w', and don't want to write code for :>all other input devices out there, then something like Input Sprockets :>might be better. :> :>John :What?? my pb accepts getkeys absolutley without problems. and about :international keyboards, just let the keys be user configurable. in the :configuration dialog, you can use WaitNextEvent(), to be able to diply the :corretct char codes. GetKeys has a general problem in that the keymap returned only has bits set for the last ADB device where keys were pressed. If you use a PowerBook with a keypad the keyboard and and keypad are different ADB devices, so if the user presses a key on the main keyboard and one on the keypad only one of these will appear in the keymap. The other device likely to cause this is Apple's ergonomic keyboard, as with it the keypad/fn key module and main keyboard appear as seperate ADB devices. And for a complex game with many options a user might use a joystick and the keyboard, and again encounter the same problems, as unless you write code to address each model's API joystick buttons are usually mapped to the keyboard. John -- John Blackburne; programmer, writer, consultant, trainer tel/fax: Hong Kong (+852) 2816 7484 home page: +++++++++++++++++++++++++++ >From thebug@berlin.snafu.de.spammers.are.assholes (TheBug) Date: Sun, 07 Sep 1997 23:45:35 +0200 Organization: privat In article , smfr@santafe.edu (Simon Fraser) wrote: > It's probably better, in the case of games, to bypass event handling > for getting keypresses entirely, and just use GetKeys() to see > what keys are down. Remember though that you only get the status of the device that was last to report a change of status and that you get physical key positions. WIth international keyboards the user may read different labels on the keys than what you assume. -- To reply to this item remove the ".spammers.are.assholes" from the email address. Guido K–rber - Programmer and hardware developer thebug@berlin.snafu.de Specialised in mistreating the ADB fax: x49-30-773 81 36 ADB solutions available for licensing Custom development of software and hardware for the Mac. Ask me about ADB products from CH, MicroSpeed, Contour, Hunter Opinions expressed herein are mine unless expressly stated otherwise. Similarities with living or undead persons are coincidence and not intended - really! ;-) Best use before: (see date printed on backside of message) +++++++++++++++++++++++++++ >From "Jonas Echterhoff" Date: 9 Sep 97 09:49:57 +0100 Organization: Universitaet Paderborn, Germany >In article , smfr@santafe.edu >(Simon Fraser) wrote: > >:It's probably better, in the case of games, to bypass event handling >:for getting keypresses entirely, and just use GetKeys() to see >:what keys are down. > >Only for testing. If you're planning on shipping and don't want to have to >deal with support calls from people with devices GetKeys won't handle, >such as Apple's ergonomic keyboard or a PowerBook keypad, or whose >keyboard has a 'z' where yours has a 'w', and don't want to write code for >all other input devices out there, then something like Input Sprockets >might be better. > >John What?? my pb accepts getkeys absolutley without problems. and about international keyboards, just let the keys be user configurable. in the configuration dialog, you can use WaitNextEvent(), to be able to diply the corretct char codes. jonas +++++++++++++++++++++++++++ >From decker02@ptld.uswest.net.no_spam (Matt) Date: Sun, 14 Sep 1997 00:54:26 -0700 Organization: USWEST - Internet Services In article , smfr@santafe.edu (Simon Fraser) wrote: > It's probably better, in the case of games, to bypass event handling > for getting keypresses entirely, and just use GetKeys() to see > what keys are down. > > Simon I've attempted to use getKeys() for keymapping, but I ran into the problem that different keyboards gave me different virtual keycodes, rendering the routine almost completely useless. Now maybe I'm just stupid, but I couldn't find anyway to convert the virtual keycodes into actual ascii, or any kind of keyboard independant standard. If anyone else knows how to do that, I'm be very appreciative if they'd share that bit of knowledge. --Matt --------------------------- >From uzs90z@uni-bonn.de (Michael Schuerig) Subject: What's the 'CCI(TM)'? Date: Tue, 9 Sep 1997 20:08:22 +0200 Organization: Completely Disorganized I've variously seen a 'CCI(TM)' resource that apparently contains information about the file it is in. Which apps use it? Where's it defined? Michael -- Michael Schuerig Do we inhabit some micro-space mailto:uzs90z@uni-bonn.de and interface through wires. http://www.uni-bonn.de/~uzs90z/ -Ian Anderson, "User-Friendly" +++++++++++++++++++++++++++ >From paul@ljl.com (Paul Robichaux) Date: Tue, 09 Sep 1997 15:56:55 -0500 Organization: LJL Enterprises, Inc. In article <199709092007184105080N@rhrz-isdn3-p8.rhrz.uni-bonn.de>, uzs90z@uni-bonn.de (Michael Schuerig) wrote: >I've variously seen a 'CCI(TM)' resource that apparently contains >information about the file it is in. Which apps use it? Where's it >defined? The System 7.6 (and later) Extension Manager uses it. Cassady & Greene's Conflict Catcher originated it. For details on its format and correct usage, see Tech Note 1091 at . Here's a brief excerpt: >The Item Information Window > > >The "Item Information" window, shown in Figure 6, provides a place for >the display of textual information describing the facilities provided by >an extension. Vendors can provide this information by including >necessary resources in their extension files. Extensions Manager 4.0 >retrieves the textual information displayed in this window from one of >four places. The search order for finding that information is as >follows: > >1.It first looks in resource 'CCIÅ'1 128 >2.If that resource does not exist, it looks in an internal Extensions >Manager Info database. >3.If it doesn't find a match in the database, then it looks in the file >for resource 'hfdr' -5696, which is the Finder Balloon Help resource. >4.Finally, it looks in the Finder Help file for information about the >file. [ snip ] >The format of the 'CCIÅ' (Å is the option-2 character, hex AA) resource >is exactly the same as a 'TEXT' resource, a pure text stream with no >extraneous information. Figure 8 showns how it appears in ResEdit. Cheers, -Paul -- Paul Robichaux paul@ljl.com Author, _Windows NT Server 4 Administrator's Guide_ (ISBN 0761507515). +++++++++++++++++++++++++++ >From uzs90z@uni-bonn.de (Michael Schuerig) Date: Wed, 10 Sep 1997 00:08:43 +0200 Organization: Completely Disorganized Michael Schuerig wrote: > I've variously seen a 'CCI(TM)' resource that apparently contains > information about the file it is in. Which apps use it? Where's it > defined? Found it: It's used by the Extension Mgr for the item information. Documented in TN 1091. Michael -- Michael Schuerig P'rhaps he's hungry. Six volts make him smile. mailto:uzs90z@uni-bonn.de And twelve volts would probably kill. http://www.uni-bonn.de/~uzs90z/ -Jethro Tull, "Batteries Not Included" --------------------------- >From Han Guoniu Subject: [Q] How to determine the current application FSSpec? Date: Fri, 05 Sep 1997 12:57:09 +0200 Organization: CRC - Universite Louis Pasteur - Strasbourg France Hello, I need to hnow "my application" FSSpec in "my application". How to determine it? Thanks, Guoniu Han +++++++++++++++++++++++++++ >From passengr.nospam@shore.net (T. Vector) Date: 6 Sep 1997 06:01:27 GMT Organization: By Symbol Name In article <340FE585.76C4@math.u-strasbg.fr>, Han Guoniu wrote: > Hello, > > I need to hnow "my application" FSSpec in "my application". > How to determine it? > use the Process Manager to get your process' PSN (process number). then use the PSN to get the FSSpec. there's a snippet up on the Apple site. -- remove "nospam" to email remove "kocher" to save your company +++++++++++++++++++++++++++ >From dtp@pluto.njcc.com (David T. Pierson) Date: Fri, 05 Sep 1997 16:53:42 -0400 Organization: New Jersey Computer Connection, Lawrenceville, NJ ProcessSerialNumber thePSN; thePSN.highLongOfPSN = kNoProcess; thePSN.lowLongOfPSN = kNoProcess; OSErr err = GetCurrentProcess ( &thePSN ); ProcessInfoRec thePIR; err = GetProcessInformation ( &thePSN, &thePIR ); // at this point, //assuming no errors, thePIR.processAppSpec will be a pointer //to the app's fsspec In article <340FE585.76C4@math.u-strasbg.fr>, Han Guoniu wrote: > Hello, > > I need to hnow "my application" FSSpec in "my application". > How to determine it? > > Thanks, > > Guoniu Han +++++++++++++++++++++++++++ >From meeroh@mit.edu (Miro Jurisic) Date: Sun, 07 Sep 1997 15:43:43 -0400 Organization: MIT In article , dtp@pluto.njcc.com (David T. Pierson) wrote: > ProcessSerialNumber thePSN; > > thePSN.highLongOfPSN = kNoProcess; > thePSN.lowLongOfPSN = kNoProcess; > > OSErr err = GetCurrentProcess ( &thePSN ); > > ProcessInfoRec thePIR; > > err = GetProcessInformation ( &thePSN, &thePIR ); Great way to shoot yourself in the foot. What you really want is: ProcessInfoRec thePIR; FSSpec theFSS; thePIR.processAppSpec = &theFSS; err = GetProcessInformation (&thePSN, &thePIR); // assuming no errors, theFSS will contain the fsspec Hth, meeroh > > // at this point, > //assuming no errors, thePIR.processAppSpec will be a pointer > //to the app's fsspec > > > In article <340FE585.76C4@math.u-strasbg.fr>, Han Guoniu > wrote: > > > Hello, > > > > I need to hnow "my application" FSSpec in "my application". > > How to determine it? > > > > Thanks, > > > > Guoniu Han Ý +++++++++++++++++++++++++++ >From philbert@mail.telis.org (Phil & Maryann Wolff) Date: Mon, 8 Sep 1997 18:26:55 -0700 Organization: TELIS Miro Jurisic wrote: > In article , dtp@pluto.njcc.com > (David T. Pierson) wrote: > > > ProcessSerialNumber thePSN; > > > > thePSN.highLongOfPSN = kNoProcess; > > thePSN.lowLongOfPSN = kNoProcess; > > > > OSErr err = GetCurrentProcess ( &thePSN ); > > > > ProcessInfoRec thePIR; > > > > err = GetProcessInformation ( &thePSN, &thePIR ); > > Great way to shoot yourself in the foot. What you really want is: > > ProcessInfoRec thePIR; > FSSpec theFSS; > thePIR.processAppSpec = &theFSS; > > err = GetProcessInformation (&thePSN, &thePIR); > > // assuming no errors, theFSS will contain the fsspec > > Hth, > > meeroh > ...and there's a shot in the *other* foot. Better use: ProcessInfoRec thePIR; FSSpec theFSS; thePIR.processInfoLength = sizeof( ProcessInfoRec ); thePIR.processName = NULL; thePIR.processAppSpec = &theFSS; err = GetProcessInformation (&thePSN, &thePIR); -Phil --------------------------- >From macgur19@idt.net Subject: [Q] Routine Dispatch Code Date: 11 Sep 97 22:40:16 +0500 Organization: IDT Hello, I am writing an application in C++ and one of my Classes is a wrapper for a Button. I would like to assign a routine ( via a ProcPtr ) to the button during initalization and then send it a doAction() message to tell it to excecute the assigned routine. The problem I am having is I can't seem to get the dispatch code to work.Does anyone have any code examples showing how I can accomplish this ? Any help would be greatly appreciated.Thank you. Please send any responses to macgur19@idt.net +++++++++++++++++++++++++++ >From Conal Walsh Date: Sun, 14 Sep 1997 00:39:52 -0400 Organization: Correct Procedures Pty Ltd macgur19@idt.net wrote: > > Hello, > I am writing an application in C++ and one of my Classes is a wrapper for > a Button. I would like to assign a routine ( via a ProcPtr ) to the button > during initalization and then send it a doAction() message to tell it to > excecute the assigned routine. The problem I am having is I can't seem to > get the dispatch code to work.Does anyone have any code examples showing > how I can accomplish this ? Any help would be greatly appreciated.Thank > you. You cannot call mixed mode code using the "ProcPtr" type. You must use a UPP (universal procedure pointer) which is compiled differently according to 68k or PPC. Look in the appropriate header file for a type with suffix "UPP" and then look for a function "New..UPP". Use the function to create a UPP of the desired type with doAction() as its argument, then pass this UPP to your Button class. Mail me if you need more help. CYL /||\ Conal Walsh / ||/ Correct Procedures Engineering and Consultancy \ || Toronto, Canada Services for the \|| correct@mypostbox.com Telecommunications Industry "Some people live in the fast lane; I live in the oncoming traffic." +++++++++++++++++++++++++++ >From DavidO@dascorp.com (David Phillip Oster) Date: Fri, 12 Sep 1997 12:17:01 -0700 Organization: Digital Arts & Sciences Corp. In article , macgur19@idt.net wrote: >Hello, > I am writing an application in C++ and one of my Classes is a wrapper for >a Button. I would like to assign a routine ( via a ProcPtr ) to the button >during initalization and then send it a doAction() message to tell it to >excecute the assigned routine. The problem I am having is I can't seem to >get the dispatch code to work.Does anyone have any code examples showing >how I can accomplish this ? Any help would be greatly appreciated.Thank >you. The trick is that you can't pass a method directly as a procedure pointer, but you can pass a pair of a procedure pointer and a data pointer. the following should work: class CallMe { public: CallMe(){} ~CallMe(){} void DrawMe(); GrafPtr mPort; Rect mRect; RGBColor mColor; }; extern void CallMeProc(void *param); void CallMe::DrawMe(){ GrafPtr savePort; RGBColor saveColor; GetPort(&savePort); SetPort(mPort); GetForeColor(&saveColor); RGBForeColor(&mColor); PaintRect(&mRect); RGBForeColor(&saveColor); SetPort(savePort); } void CallMeProc(void* param){ // reinterpret_cast is like the old C cast: ((CallMe*) param)->DrawMe() reinterpret_cast(param)->DrawMe(); } - ---------------- typedef void (*WillCallProc)(void *); class WillCall { public: WillCall(){} ~WillCall(){} // dereference the procedure pointer to get the procedure, then call it. void DoTheCall(){ (*mProc)(mParam); } WillCallProc mProc; void* mParam; }; - ---------------- // usage: CallMe* callMe; WillCall* willCall; callMe = new CallMe(); callMe->mPort = qd.thePort; callMe->mColor.red = callMe->mColor.green = 0xDDDD; callMe->mColor.blue = 0; SetRect(&callMe->mRect, 10, 20, 100, 200); willCall = new WillCall(); willCall->mProc = CallMeProc; willCall->mParam = reinterpret_cast(callMe); willCall->DoTheCall(); -- -- Warning: posted from an unlocked cubicle: no guarantee its really me. I used to say, "At least Congress doesn't make death worse every year." Then I had to probate an estate. --------------------------- >From Keith Wiley Subject: changing menu items in popup menus? Date: Fri, 12 Sep 1997 14:38:31 -0400 Organization: (none) Looking through IM:Macintosh Toolbox Essentials (I can't figure out where the volume numbers are written), I found SetMenuItemText(MenuHandle, item, string), but how do you get a menu handle for a popup menu? It's not really a menu at all. It's a control. The handle is embedded in the dialog box resource. What I want to do is have a popup menu that has one of two possible lists of items depending on whether or not a check box is on. Toggling the checkbox should automatically rewrite the popup menu to the alterate list. Presently, it's in a modal dialog box. Thanks a lot. . . .. ... ..... ........ ............. ..................... .. ... ..... ....... ........... ............. ................. . .. .... ........ ................ ................................ Keith Wiley, Electrogenetic Engineer * email: keithw@wam.umd.edu * * * * * * email: kwiley@tigr.org *** ** * * ** * WWW: http://www.wam.umd.edu/~keithw * ** ** *** +++++++++++++++++++++++++++ >From DavidO@dascorp.com (David Phillip Oster) Date: Fri, 12 Sep 1997 12:45:02 -0700 Organization: Digital Arts & Sciences Corp. In article <34198C20.A74BB06A@tigr.org>, Keith Wiley wrote: >What I want to do is have a popup menu that has one of two possible lists of >items depending on whether or not a check box is on. Toggling the checkbox >should automatically rewrite the popup menu to the alterate list. Presently, >it's in a modal dialog box. The easy way: when the checkbox toggles, HideItem of one itrem and ShowItem of another. The hard way: use GetDialogItem to get the handle of the control. cast the handle to a ControlHandle, ch, then access the (**ch).contrlData field as follows: (**(PopupPrivateDataHandle) (**ch).contrlData).mHandle this is the menu handle your interested in. if you change the number of items, remember to call SetControlMaximum() on the control handle to let it know the max has changed. -- -- Warning: posted from an unlocked cubicle: no guarantee its really me. "A man hears what he wants to hear and misremembers the rest." -- Paul Simon, ("The Boxer") +++++++++++++++++++++++++++ >From William.D.Smith@sdsu.edu (William D. Smith) Date: Fri, 12 Sep 1997 13:05:23 -0700 Organization: SDSU, Academic Affairs function GetPopupMenuHandle (TheItem : integer) : MenuHandle; var aHandle : Handle; aRect : Rect; ItemType : integer; begin GetDialogItem (qd .thePort, TheItem, ItemType, aHandle, aRect); aHandle := ControlHandle (aHandle)^^ .contrlData; GetPopupMenuHandle := PopupPrivateDataHandle (aHandle)^^ .mHandle; end { GetPopupMenuHandle }; In article <34198C20.A74BB06A@tigr.org>, Keith Wiley wrote: >Looking through IM:Macintosh Toolbox Essentials (I can't figure out where the >volume numbers are written), I found SetMenuItemText(MenuHandle, item, >string), but how do you get a menu handle for a popup menu? It's not really a >menu at all. It's a control. The handle is embedded in the dialog box resource. William D. Smith SDSU, Academic Affairs --------------------------- >From todd alden marshall Subject: nonrelocatable-locked memory Date: Fri, 05 Sep 1997 11:15:32 -0400 Organization: childrens television workshop What is the difference between locked relocatable memory and non-relocatable memory? I.E., is the only difference that locked-relocatable memory takes up a Handle/Master, and Non-relocatable memory does not, as it is never usable as a handle? I'm trying to decide if I should use NewPtr or not if my memory really can't be temporarily unlocked, if there's really a difference. Thanks! +++++++++++++++++++++++++++ >From jac@igor.caltech.edu (Jeff Clites) Date: Fri, 05 Sep 1997 20:21:09 -0700 Organization: California Institute of Technology, Pasadena In article <34102214.68AF@ctw.org>, todd alden marshall wrote: >What is the difference between locked relocatable memory and >non-relocatable memory? >I.E., is the only difference that locked-relocatable memory takes up a >Handle/Master, and Non-relocatable memory does not, as it is never >usable as a handle? >I'm trying to decide if I should use NewPtr or not if my memory really >can't be temporarily unlocked, if there's really a difference. As I understand it, the big differrence is that the memory manager does its best to tidy up the heap before allocating pointers, and then does its best to put them at the end of the heap, whereas handles are thrown in more liberally, with the expectation that they can be moved later if necessary. The upshot is that if you allocate handles which you lock and then never unlock, you are more likely to fragment your heap than if you use pointers. On the other hand, I believe that allocating handles is faster, because the heap isn't necessarily compacted/purged before allocation. If you never intend to unlock your handles, your life will be made easier by just using pointers. They are less tricky, and are not prone to the nightmares which can result from forgetting to lock a handle.... - ------------------------------------------------------------------------ Jeff Clites Pasadena, California My account name is jac and the rest of my address has igor and caltech and edu, separated by dots. Don't spam me or anybody else (please). +++++++++++++++++++++++++++ >From devon@???.onyx-tech.com (Devon Hubbard) Date: Mon, 08 Sep 1997 21:22:44 -0700 Organization: Onyx Technology In article <34102214.68AF@ctw.org>, todd alden marshall wrote: >What is the difference between locked relocatable memory and >non-relocatable memory? >I.E., is the only difference that locked-relocatable memory takes up a >Handle/Master, and Non-relocatable memory does not, as it is never >usable as a handle? >I'm trying to decide if I should use NewPtr or not if my memory really >can't be temporarily unlocked, if there's really a difference. Just to be clear on some definitions... * Relocatable block A block in the heap that can be moved by the memory manager and referenced through a pointer to the data block itself (double dereference). Typically known as a "handle". * Non-relocatable block A block in the heap that CANNOT be moved by the memory manager and referenced as a "pointer". * A locked relocatable block A block in the heap that can NORMALLY be moved by the memory manager but has been locked down to restrict it from being moved. Once the block has been locked and is being referenced directly with a pointer (e.g. not doubly dereferenced) it is basically the same thing as a 'pointer'. Technically, yes, the only difference between a "locked relocatable" block and a "non-relocatable" block is that the former has a master pointer reference. The real question here is what is contained within the data you are trying to decide whether NewPtr and NewHandle/HLock should be used to allocate? dEVoN -- To email the author, remove the '????.' from the email address. +++++++++++++++++++++++++++ >From carl.gustafson@no.spam.welcome (Carl Gustafson) Date: Tue, 09 Sep 1997 07:51:56 -0400 Organization: Imaging and Computer Vision Center, Drexel University In article , devon@???.onyx-tech.com (Devon Hubbard) wrote: > In article <34102214.68AF@ctw.org>, todd alden marshall > wrote: > > >What is the difference between locked relocatable memory and > >non-relocatable memory? [snip!] > > Just to be clear on some definitions... > > * Relocatable block [etc...] > > * Non-relocatable block [etc...] > > * A locked relocatable block [etc...] > > Technically, yes, the only difference between a "locked relocatable" block > and a "non-relocatable" block is that the former has a master pointer > reference. The real question here is what is contained within the data > you are trying to decide whether NewPtr and NewHandle/HLock should be used > to allocate? There is another difference - when allocated, the memory manager seeks to locate non-relocatable blocks low in the memory map, hopefully where they will be out of the way of relocatable blocks relocating. My reading of the documentation indicates that if the memory manager can't fin existing free space of sufficient size, it will fail, and return with a memFullErr. Relocatable blocks aren't necessarily allocated low in memory, but the memory manager will try to find a block of sufficient space, even if it means moving/compacting the memory map. What this means is that when attempting to allocate large blocks under stressed memory conditions, you are likely to be more successful allocating relocatable blocks than non-relocatable blocks. -- Carl Gustafson carl.gustafson at ece.drexel.edu Computer Vision Center for Vertebrate Brain Mapping Drexel University, Philadelphia, Penna -- Obligatory anti-microsoft screed: Microsoft buys into Apple! The future of Windows is safe! Now they will have a superior system to copy for the next 13 years as well. Macintosh. +++++++++++++++++++++++++++ >From devon@???.onyx-tech.com (Devon Hubbard) Date: Wed, 10 Sep 1997 18:55:13 -0700 Organization: Onyx Technology In article , >There is another difference - when allocated, the memory manager seeks to >locate non-relocatable blocks low in the memory map, hopefully where they >will be out of the way of relocatable blocks relocating. My reading of the >documentation indicates that if the memory manager can't fin existing free >space of sufficient size, it will fail, and return with a memFullErr. >Relocatable blocks aren't necessarily allocated low in memory, but the >memory manager will try to find a block of sufficient space, even if it >means moving/compacting the memory map. What this means is that when >attempting to allocate large blocks under stressed memory conditions, you >are likely to be more successful allocating relocatable blocks than >non-relocatable blocks. Correct. But this is going into specifics of how the memory manager (modern or not) handles (no pun intended here) blocks within a heap and from the tone of Todd's original posting, that would be overkill at this point. dEVoN -- To email the author, remove the '????.' from the email address. --------------------------- End of C.S.M.P. Digest **********************