From: owner-csmp@ee.mcgill.ca Subject: csmp digest Vol 4 No 043 C.S.M.P. Digest Mon, 03 Nov 97 Volume 4 : Issue 43 Today's Topics: "Composite" AppleEvents "Unselecting" a editText item? Advice needed Any problem with long GWorlds? Audio CD control? Drag 'n drop start up (ie aete resource) Drawing Directly To The Screen Event Filter Trap Description and Parameters Graying out an edit field Growing resources Help: Getting and Displaying keys How do I control the CD-ROM? How to Assert Serial Port Pins How to patch traps under PPC How to set the desktop pattern? Installing system-wide AE handler from app? MDEF's - Code-based Installation PowerPC-CFM Question Problems with stereo sound positioning Progress Bar in OS8 and 7.5 Q: CM plug-in example code Q: How to use AppearanceLib with 68K app? RegisterAppearanceClient questions (Appearance manager) ResEdit 'hdlg' resource editor? Serial port help Speeding up concave polygon drawing... VBL programming Window Size [Q] Drawing regions really quickly. [Q] How to Hide Applications Programmatically [Q] Modem or Printer Port ? communicating with internal PB modem copying from serial port custom boot disk-micro OS? network PBRead slow in OS8 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 i'm@not.here (Jeff Clites) Subject: "Composite" AppleEvents Date: Fri, 10 Oct 1997 02:36:56 -0700 Organization: California Institute of Technology, Pasadena I'm sending several AppleEvents to the same target application, and I was wondering if there was a way to send them "all at once" since they are going to the same target. Well, that sounded stupid, so let me phrase it differently: I'm sending a bunch of AEs to the Finder, but under OS 8 it has gone a bit over the edge with multithreading, and for every event the Finder receives a new thread is spawned to handle it, making things as slow as molasses (when you dump a bunch of events at it). So, I'm trying to finagle a way to get my AEs to go into a single thread, so what I'm hankering for is a way to package several events together (if that even makes sense). Any suggestions, or alternatives? Thanks. - ------------------------------------------------------------------------ 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 uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig) Date: Fri, 10 Oct 1997 15:14:53 +0200 Organization: Completely Disorganized Jeff Clites wrote: > I'm sending a bunch of AEs to the Finder, but under OS 8 it has gone a bit > over the edge with multithreading, and for every event the Finder receives > a new thread is spawned to handle it, making things as slow as molasses > (when you dump a bunch of events at it). So, I'm trying to finagle a way > to get my AEs to go into a single thread, so what I'm hankering for is a > way to package several events together (if that even makes sense). You're out of luck. Your best hope is to convince Apple that this behavior on the Finder's part is brain-dead. It ought to service AEs that come from one client app in one single thread. I suggested this to Apple quite some time ago. No reaction so far. Michael -- Michael Schuerig Most people would rather die than think. mailto:uzs90z@uni-bonn.de In fact, they do. http://www.uni-bonn.de/~uzs90z/ -Bertrand Russell --------------------------- >From Bill.Eccles@noSpam.net (Bill Eccles) Subject: "Unselecting" a editText item? Date: Tue, 07 Oct 1997 08:30:40 -0500 Organization: Cable and Wireless, Inc. Gentleones: Is there a simple way to use the Dialog Manager to cause the text edit caret to not be in any editText item in a modeless dialog box? The scenario: The user clicks on editText item 1, enters her name, presses tab, goes to editText item 2, enters the other player's name, and hits return. I'd like the cursor to disappear from all edit text items upon detection of this return, but I've not found a way to used SelIText to cause the cursor to "disappear." Thanks again, Bill -- Bill Eccles Replace the "noSpam" with "USA" +++++++++++++++++++++++++++ >From dstone@BIT.chem.utoronto.ca (David Stone) Date: 7 Oct 1997 15:25:11 GMT Organization: University of Toronto Chemistry In article , Bill.Eccles@noSpam.net (Bill Eccles) wrote: > > Gentleones: > > Is there a simple way to use the Dialog Manager to cause the text edit > caret to not be in any editText item in a modeless dialog box? This is a "feature" of the dialog manager. The IsDialogEvt/DialogSelect duo (and ModalDialog) contain code that forces at least one of the edit text items in the dialog to be active at all times. The only way I have found around this is to double each edit text with a static text, and make one of each pair invisible (HideDItem (?)). Then you have to write code to switch the text between the edit and static versions, hiding and showing as you go. This is messy, plus the modeless dialog requirements tend to complicate the main event loop somewhat. A better method is to implement your modeless dialog as a window, and handle the activate/update events in the normal manner. Although you have to add the code to make sure the window draws correctly when needed, overall it greatly simplifies things and the edit text items can be made to behave the way you want them to. David Stone (remove the obvious bit to reply...) +++++++++++++++++++++++++++ >From ronm@teleport.com (Ron W. Miller) Date: 8 Oct 1997 18:21:12 GMT Organization: Twilight Zone Software In article , dstone@BIT.chem.utoronto.ca (David Stone) wrote: > In article , > Bill.Eccles@noSpam.net (Bill Eccles) wrote: > > > > Gentleones: > > > > Is there a simple way to use the Dialog Manager to cause the text edit > > caret to not be in any editText item in a modeless dialog box? > > This is a "feature" of the dialog manager. The IsDialogEvt/DialogSelect > duo (and ModalDialog) contain code that forces at least one of the > edit text items in the dialog to be active at all times. The only > way I have found around this is to double each edit text with a static > text, and make one of each pair invisible (HideDItem (?)). Then you > have to write code to switch the text between the edit and static versions, > hiding and showing as you go. This is messy, plus the modeless dialog > requirements tend to complicate the main event loop somewhat. > > A better method is to implement your modeless dialog as a window, and > handle the activate/update events in the normal manner. Although you > have to add the code to make sure the window draws correctly when needed, > overall it greatly simplifies things and the edit text items can be made > to behave the way you want them to. > > > David Stone > (remove the obvious bit to reply...) David, It is not necessary to go to the extra trouble of extra edit text items. You can invoke the same behavior by changing the DialogRecord's editField member to an invalid number. I have done this in the past to make a textEdit appear disabled( a little more work is involved ). I also believe that a DTS example application uses this very technique. I can probably find it if needed. Sincerely, Ron W. Miller -- =============================== Ron W. Miller Twilight Zone Software ronm@teleport.com Contract Software Developer Macintosh and Microsoft Windows =============================== --------------------------- >From BHuey@nospam.att.net (Hugh Johnson) Subject: Advice needed Date: Sat, 18 Oct 1997 00:07:37 -0600 Organization: Semplice I got an email from a Japanese magazine wanting to distribute my shareware on their CD ROM. Okay, that's fine with me. But they also ask for my permission to distribute it again in the future as many times as they want without bugging me about it. Is that wise? Should I say okay to a something like that, or is it liable to jump up and bite me in the future? -- Hugh Johnson Replace "nospam" with "worldnet" +++++++++++++++++++++++++++ >From ALX@ravenware.com (Alex Kinnison) Date: Sat, 18 Oct 1997 14:12:05 -0700 Organization: Ravenware Software In article <629g4e$qkc@bgtnsc02.worldnet.att.net>, BHuey@nospam.att.net (Hugh Johnson) wrote: > I got an email from a Japanese magazine wanting to distribute my shareware > on their CD ROM. Okay, that's fine with me. But they also ask for my > permission to distribute it again in the future as many times as they want > without bugging me about it. Is that wise? Should I say okay to a > something like that, or is it liable to jump up and bite me in the future? Hugh, The only problem that might pop up is if you later wish to turn your program into a commercial product. Ravenware does this all the time (our games are all freeware, kinda like distributed advertizing) and continual distribution is OK. If you do get a chance to go commercial, it will generally happen one of two ways; 1) A game house will ask you to distribute 2) You decide to distribute In the first case, we always get a "non-exclusive" clause in the publishing agreement. That means that the game house can sell our stuff, and we can continue to freeware it. Never had a problem with this, most game houses aim their products at folks who are not hooked up to a service (still a whole lot of folks). In the second case, just change your shareware somewhat. Add a few new features, call it "XXXX Pro" or "XXXX Plus" and you'll have a new product and won't be competing (strictly) with the shareware version, and you also have a "sell-up" for folks who really like your shareware version. Look how well some commercial software does with this, Eudora is a great example. Eudora light is free, Eudora Pro costs. I wouldn't worry about it. As long as you retain copyright (which you do unless you *specifically* let someone else have the rights (which you generally shouldn't)) then you still own the game, even if they are distributing it. Alex Kinnison ALX@Ravenware.com Terrorist Technical Writing +++++++++++++++++++++++++++ >From Ian Russell Ollmann Date: Sat, 18 Oct 1997 13:41:44 -0700 Organization: The Scripps Research Institute, La Jolla, CA On Sat, 18 Oct 1997, Hugh Johnson wrote: > I got an email from a Japanese magazine wanting to distribute my shareware > on their CD ROM. Okay, that's fine with me. But they also ask for my > permission to distribute it again in the future as many times as they want > without bugging me about it. Is that wise? Should I say okay to a > something like that, or is it liable to jump up and bite me in the future? If you plan to update your software, and want them to ask for the new version before sending out the old one and all of the support headache that that entails, then it would be wise to say no to the future distribution without asking. It is not like you are setting yourself up for added trouble by asking them to ask again. After all, how hard is it for you to send them an updated copy of your software? Not very. Ian Ollmann --------------------------- >From "Seth Hill" Subject: Any problem with long GWorlds? Date: 10 Oct 97 13:34:14 -0700 Organization: All USENET -- http://www.Supernews.com I was wondering if there was a performance hit to using really long GWorlds, say 2048x32 or bigger, as compared with using a more rectangular GWorld. The memory requirements are going to be 64K whether it's long or rectangular, but (I'm holding a bunch of 32x32 sprites offscreen..) It would be much easier to deal with a long GWorld as opposed to the rectangular one... Any weird consequences of doing stuff like this? _____________________________________________________________________ Seth Hill | ferris@proaxis.com Troposphere Software | http://www.proaxis.com/~ferris/software/ "What are we going to do tomorrow night, Brain?" "The same thing we do every night, Pinky - Try to take over the world! +++++++++++++++++++++++++++ >From erkyrath@netcom.com (Andrew Plotkin) Date: Sat, 11 Oct 1997 20:19:44 GMT Organization: Netcom On-Line Services Seth Hill (ferris@proaxis.com) wrote: > I was wondering if there was a performance hit to using really long > GWorlds, say 2048x32 or bigger, as compared with using a more rectangular > GWorld. The memory requirements are going to be 64K whether it's long or > rectangular, but (I'm holding a bunch of 32x32 sprites offscreen..) > It would be much easier to deal with a long GWorld as opposed to the > rectangular one... Any weird consequences of doing stuff like this? There's some padding that can occur on each line, so a *narrow* GWorld (32 wide by 2048 high) might waste a lot of space. But a 2048x32 should be ok. --Z -- "And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..." +++++++++++++++++++++++++++ >From masong7@aol.com (MasonG7) Date: 12 Oct 1997 21:50:17 GMT Organization: AOL http://www.aol.com ************ Seth Hill (ferris@proaxis.com) wrote: > I was wondering if there was a performance hit to using really long > GWorlds, say 2048x32 or bigger, as compared with using a more rectangular > GWorld. The memory requirements are going to be 64K whether it's long or > rectangular, but (I'm holding a bunch of 32x32 sprites offscreen..) > It would be much easier to deal with a long GWorld as opposed to the > rectangular one... Any weird consequences of doing stuff like this? There's some padding that can occur on each line, so a *narrow* GWorld (32 wide by 2048 high) might waste a lot of space. But a 2048x32 should be ok. ************ Also of note is the fact that copying a wide GWorld is a bit faster than copying a tall one because of the row calculations that must be performed. Ex: a copy of a 32x2048 GWorld will spend a good portion of it's time calculating the next row, while a copy of a 2048x32 GWorld will spend almost all of it's time copying. MasonG7@aol dot com Mason Gup +++++++++++++++++++++++++++ >From Bruce@hoult.actrix.gen.nz (Bruce Hoult) Date: Tue, 14 Oct 1997 22:32:17 +1300 Organization: (none) Seth Hill writes: > I was wondering if there was a performance hit to using really long > GWorlds, say 2048x32 or bigger, as compared with using a more rectangular > GWorld. The memory requirements are going to be 64K whether it's long or > rectangular, but (I'm holding a bunch of 32x32 sprites offscreen..) > > It would be much easier to deal with a long GWorld as opposed to the > rectangular one... Any weird consequences of doing stuff like this? What I'd recommend, all else being equal, is to use a GWorld that is 32 pixels wide by 2048 pixels high, rather than the other way around. This will store each icon will in a continuous region of memory, rather than smeared out all over the place. The advantages: - each icon will be on a single 4K page of memory, saving on virtual memory swapping (maybe), but certainly saving on the number of TLB reloads. - each cache line within a single icon (which at 8 bits per pixel will be a scan line in the icon) will map to a different set in the cache. This means that if you're heavily using a particular icon (or a small number), it will stay entirely in L1 cache, speeding the program. With a 2048x32 organisation, every scan line of an icon would map to the same cache set. There are only a small number of cache lines in each set (eight in PPC601 and PPC750, four in PPC604e, PPC604 and PPC603e, two in PPC603), so you'd only be able to keep two, four or eight scan lines from a given icon in L1 cache at the same time. This isn't good. - if you're using fewer than 8 bits per pixel then you'll get several scan lines from the same icon into each cache line. With a 2048x32 organisation you'd need to move 32 cache lines to copy an icon, but a lot of that space would be wasted. Hope this helps. Of course, this is for PowerPC. The same issues arise with the 68K, though the actual numbers are different. -- Bruce -- 'We have no intention of shipping another bloated operating system and forcing that down the throats of our Windows customers' -- Paul Maritz, Microsoft Group Vice President +++++++++++++++++++++++++++ >From "Seth Hill" Date: 15 Oct 97 14:56:36 -0700 Organization: All USENET -- http://www.Supernews.com On Tue, Oct 14, 1997 2:32 AM, Bruce Hoult wrote: >What I'd recommend, all else being equal, is to use a GWorld that is >32 pixels wide by 2048 pixels high, rather than the other way around. >This will store each icon will in a continuous region of memory, >rather than smeared out all over the place. > >The advantages: > >- each icon will be on a single 4K page of memory, saving on virtual > memory swapping (maybe), but certainly saving on the number of TLB > reloads. > >- each cache line within a single icon (which at 8 bits per pixel will > be a scan line in the icon) will map to a different set in the cache. > This means that if you're heavily using a particular icon (or a small > number), it will stay entirely in L1 cache, speeding the program. > > With a 2048x32 organisation, every scan line of an icon would map to > the same cache set. There are only a small number of cache lines in > each set (eight in PPC601 and PPC750, four in PPC604e, PPC604 and PPC603e, > two in PPC603), so you'd only be able to keep two, four or eight scan lines > from a given icon in L1 cache at the same time. This isn't good. > >- if you're using fewer than 8 bits per pixel then you'll get several scan > lines from the same icon into each cache line. With a 2048x32 organisation > you'd need to move 32 cache lines to copy an icon, but a lot of that > space would be wasted. > > >Hope this helps. Of course, this is for PowerPC. The same issues arise with >the 68K, though the actual numbers are different. > >-- Bruce > Really! Do you suppose that tacking advantage of the cache like this would be faster than a long gworld despite the extra address calculations? I think I'll write a test program to tell me. _____________________________________________________________________ Seth Hill | ferris@proaxis.com Troposphere Software | http://www.proaxis.com/~ferris/software/ "What are we going to do tomorrow night, Brain?" "The same thing we do every night, Pinky - Try to take over the world! +++++++++++++++++++++++++++ >From Bruce@hoult.actrix.gen.nz (Bruce Hoult) Date: Sun, 19 Oct 1997 15:41:41 +1300 Organization: (none) Seth Hill writes: > On Tue, Oct 14, 1997 2:32 AM, Bruce Hoult > wrote: > >What I'd recommend, all else being equal, is to use a GWorld that is > >32 pixels wide by 2048 pixels high, rather than the other way around. > >This will store each icon in a continuous region of memory, > >rather than smeared out all over the place. > > Really! Do you suppose that tacking advantage of the cache like this would > be faster than a long gworld despite the extra address calculations? I > think I'll write a test program to tell me. Yes, I think so, for copying icons at random out of the GWorld. Not for copying the whole GWorld -- but then that's not what you're doing. -- Bruce -- 'We have no intention of shipping another bloated operating system and forcing that down the throats of our Windows customers' -- Paul Maritz, Microsoft Group Vice President --------------------------- >From nul@bitbucket.com (Greg Parker) Subject: Audio CD control? Date: Sat, 11 Oct 1997 18:51:06 -0700 Organization: Hamster Emporium I'm looking for information about controlling Audio CD's. On Apple's site I found cd.c and cd.h, which appear to do what I need but they are really old. Also, they don't work. When I run them (or sample programs using them) I get -21 errors everywhere. I also found the CD Toolkit HyperCard stack, which does work, but the code is in XCMD form, which I don't understand. They are also old and unsupported. Is there any up-to-date CD control code or information? I also noticed that Apple's CD Player and the CD Toolkit stack don't quite work on a PowerCenter Pro - repeat mode doesn't work and changing tracks while the CD is stopped sometimes doesn't work properly. Is this a PowerCC problem, or does newer code fix this? I have FWB's CD player, but it doesn't run programs. (And this all started because I wanted to automate part of my .sig :-) -- Greg Parker parker42@stanford.edu "When in danger, when in doubt, run in circles, scream and shout." -- J. MacDonald Current music: "Piano Concerto in A minor, 2nd movement: Adagio", Grieg +++++++++++++++++++++++++++ >From tyen@earthling.net (Tee Yen) Date: Thu, 16 Oct 1997 23:42:59 +0800 Organization: YenCo. In article , nul@bitbucket.com (Greg Parker) wrote: >I'm looking for information about controlling Audio CD's. On Apple's site Try looking at the inCDius source that can be found at an info-mac mirror (in /dev/src/ i think). Also check out the technote on devices #22 (search the apple site for dv_22.pdf if u cant find it), this contains the calls you can make to the apple (dunno bout others) CD drivers. Hope this helps, yen - - tyen@earthling.net http://tyen.home.ml.org/ --------------------------- >From jk0101@medtronic.com (John W. Komp) Subject: Drag 'n drop start up (ie aete resource) Date: 13 Oct 1997 13:41:15 GMT Organization: Medtronic, Inc. I'm trying to create an app that will startup when some files are dropped on it. Following DropShell and David Mark's books I've added the handlers for the required AE hooks (openDoc, openApp, printDoc, quitApp) and set the flags in size but I still can't seem to get things going. One thing I did notice is that programs like DropShell have the resources aete and aeue which are covered by chapters 7 and 8 of IM's interapplication communications book. Is a drag and drop of a file or folder onto an application icon considered an AE event? If so does CodeWarrior create aete resources or am I on my own for those (I'm using CW7)? Am I looking in the wrong place for this documentation (ie maybe its not an AE event)? Thanks, -John -- **************************************************** This morning I shot six holes in my freezer I think I've got cabin fever Somebody sound the alarm - J. Buffett **************************************************** +++++++++++++++++++++++++++ >From DavidO@dascorp.com (David Phillip Oster) Date: Mon, 13 Oct 1997 09:07:49 -0700 Organization: Digital Arts & Sciences Corp. In article <61t8dr$6ma$2@gazette.corp.medtronic.com>, jk0101@medtronic.com (John W. Komp) wrote: >I'm trying to create an app that will startup when some files >are dropped on it. Following DropShell and David Mark's books >I've added the handlers for the required AE hooks (openDoc, >openApp, printDoc, quitApp) and set the flags in size but I >still can't seem to get things going. Did you also create a correct BNDL resource with associated FREF resources to let the Finder know what kind of files can be dropped on your program? Did you also delete any old copies of your application so that the Finder will re-read the resources of your ap. >One thing I did notice is that programs like DropShell have >the resources aete and aeue which are covered by chapters >7 and 8 of IM's interapplication communications book. >Is a drag and drop of a file or folder onto an application icon >considered an AE event? Yes. But, it is a required event, that all applications are required to implement. >If so does CodeWarrior create aete >resources or am I on my own for those (I'm using CW7)? The aete resource is so your application will have a dictionary that can be opened in Script Editor. (Try using Scrpt Editor to open the dictionary of some applications like CodewarriorIDE or Netscape) You don't need an aete for a program to receive and send apple events, but it is helpful if you expect a person to write applescripts to use your program. -- -- 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 drysdallSPAMFREE@waikato.ac.nz (Richard Drysdall) Date: Wed, 15 Oct 1997 10:22:04 +1300 Organization: University of Waikato In article <61t8dr$6ma$2@gazette.corp.medtronic.com>, jk0101@medtronic.com (John W. Komp) wrote: >I'm trying to create an app that will startup when some files >are dropped on it. Following DropShell and David Mark's books >I've added the handlers for the required AE hooks (openDoc, >openApp, printDoc, quitApp) and set the flags in size but I >still can't seem to get things going. > >One thing I did notice is that programs like DropShell have >the resources aete and aeue which are covered by chapters >7 and 8 of IM's interapplication communications book. > >Is a drag and drop of a file or folder onto an application icon >considered an AE event? If so does CodeWarrior create aete >resources or am I on my own for those (I'm using CW7)? Am I >looking in the wrong place for this documentation (ie maybe >its not an AE event)? Hi. You don't need an 'aete' resource to handle the four basic Apple Events. AppleEvents are received as an event in the event loop of your application. Check to make sure that your event loop handles a kHightLevelEvent case, i.e. switch (theEvent.what) { /* etc */ case kHighLevelEvent: HandleHighLevel (&theEvent); break; The HandleHighLevel procedure looks like this: /***************************************************************** * Procedure: HandleHighLevel * * Dispatches all high level events to the AppleEvent handler. *****************************************************************/ void HandleHighLevel (EventRecord *AERecord) { AEProcessAppleEvent (AERecord); } There's a good article about implementing the four basic AppleEvents in the Core Technologies section of the May & June 1995 issues of Byte magazine. -- Richard Drysdall, University of Waikato, New Zealand * 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 "Martin Pawloski" Subject: Drawing Directly To The Screen Date: 5 Oct 1997 22:08:27 GMT Organization: MetaLink Corp. Hey everyone, I am fairly new at Mac Graphics programming, and I have heard at one place or another that one should not draw directly to the screen. What would be the pros and cons of drawing directly to the screen? Where could I get information about how to do this? Thanks! -Jason +++++++++++++++++++++++++++ >From ufo@paston.co.uk (UFO) Date: Wed, 08 Oct 1997 18:31:55 +0000 Organization: Paston Chase Internet In article <61934r$j75@bgtnsc02.worldnet.att.net>, "Martin Pawloski" wrote: > Hey everyone, > > I am fairly new at Mac Graphics programming, and I have heard at one place > or another that one should not draw directly to the screen. What would be > the pros and cons of drawing directly to the screen? Where could I get > information about how to do this? > > Thanks! > > -Jason There are very few cons to drawing direct to the screen, you really should only do it when there is need for speed. You should draw everything you need into an offscreen world(GWorld), then once you're done just use CopyBits() to transfer the information from memory to the screen. If you need extra help e-mail me and I'll send you an online book about it. Alternatively you could visit: http://www.AmbrosiaSW.com/alt.sources.mac/macintosh-c/macintosh-c-mw.html You can download this book in sections or you can download the whole thing in one go, I recommend getting it all! Hope it helps UFO ufo@paston.co.uk +++++++++++++++++++++++++++ >From deelight@usa.net (Deelight) Date: Wed, 8 Oct 1997 20:38:22 +0100 Organization: Hors sujet inc. Martin Pawloski wrote: > I am fairly new at Mac Graphics programming, and I have heard at one place > or another that one should not draw directly to the screen. What would be > the pros and cons of drawing directly to the screen? Where could I get > information about how to do this? You can find information on direct screen drawing (and other demomaking techniques) at: Hope this helps. -- He who has imagination without learning has wings but no feet. ________________________________________________________________________ Deelight (soon) http://www.chez.com/apfelsaft +++++++++++++++++++++++++++ >From cuthbert@no.spam.leeds.ac.uk Date: Wed, 8 Oct 1997 20:28:31 +0100 (BST) Organization: University of Leeds > You should draw everything you need into an offscreen world (GWorld), > then once you're done just use CopyBits() to transfer the information > from memory to the screen. I am probably adding to my reputation for being being picky but... 1) The technique you describe is the correct and probably the fastest one for PowerMacs, and, 2) It is not drawing directly to the screen, you don't know what CopyBits() is doing, it could be using some fancy hardware accelerator for you know (or care). This technique is also virtually future-proof, and, 3) In fact it is just the opposite of drawing to the screen, a technique in which you obtain the base address of the video RAM and set pixels usually by writing 32 bit integers, and, 4) Apart from weird cases in which your screen is accessed over the SCSI bus or something, speaking of transferring from memory to screen is tautology because the screen is memory mapped on the Mac. (You probably meant copying an image from an off-screen GWorld to video RAM), and, 5) You can probably get a PP class to all of this for you. My apologies if any I have offended. Ben. --------------------------- >From Yevgeny Binder Subject: Event Filter Trap Description and Parameters Date: Thu, 16 Oct 1997 22:21:56 -0500 Organization: EarthLink Network, Inc. I'm trying to write an extension to look into the keyDown event and log every keystroke within a specific application. The problem is that I don't have any clue about how the keyDown event is filtered and what trap is executed when one is present. Can anyone please help me with this and completely explain how the keyDown event is processed? Thanks in advance. +++++++++++++++++++++++++++ >From gurgle@iname.com (Pete Gontier) Date: Sun, 19 Oct 1997 18:26:45 -0700 Organization: cellular In article <3446D9C3.F3194243@earthlink.net>, binders@earthlink.net wrote: > I'm trying to write an extension to look into the keyDown event and log > every keystroke within a specific application. The problem is that I > don't have any clue about how the keyDown event is filtered and what > trap is executed when one is present. Can anyone please help me with > this and completely explain how the keyDown event is processed? Thanks > in advance. Typing in the whole story is probably beyond the scope of a Usenet post. You'll want to look at the following web pages, though: Everything you ever wanted to know about the birth, life, and death of an EventRecord: How to filter events: -- Pete Gontier, Integer Poet --------------------------- >From tbenner@aol.com (TBenner) Subject: Graying out an edit field Date: 7 Oct 1997 23:17:41 GMT Organization: AOL http://www.aol.com Hi I would like to gray out an edit field in a dialog box, but am not sure how to do this. Is there a code example of how to do this somewhere? Tim Benner tbenner@aol.com +++++++++++++++++++++++++++ >From bradley@apple.com (Bob Bradley) Date: Tue, 07 Oct 1997 21:56:22 -0700 Organization: Uh huh huh...It says Organ In article <19971007231700.TAA27508@ladder02.news.aol.com>, tbenner@aol.com (TBenner) wrote: > I would like to gray out an edit field in a dialog box, but am not sure how > to do this. Is there a code example of how to do this somewhere? There's example code by James Walker called DimText that shows how to do this. Another option, if your situation allows it, is to just hide the edit text field. +++++++++++++++++++++++++++ >From ronm@teleport.com (Ron W. Miller) Date: 8 Oct 1997 18:29:32 GMT Organization: Twilight Zone Software In article <19971007231700.TAA27508@ladder02.news.aol.com>, tbenner@aol.com (TBenner) wrote: > Hi > > I would like to gray out an edit field in a dialog box, but am not sure how > to do this. Is there a code example of how to do this somewhere? > > Tim Benner > tbenner@aol.com Tim, There is a code example of how to do this, it can be found on about any Apple Tool chest CD. The example is called DialogBits. Ron W. Miller -- =============================== Ron W. Miller Twilight Zone Software ronm@teleport.com Contract Software Developer Macintosh and Microsoft Windows =============================== +++++++++++++++++++++++++++ >From nospam@nospam.kenner.demon.co.uk (Chris Orgill) Date: Sat, 11 Oct 1997 00:40:54 +0100 Organization: (none) In article <19971007231700.TAA27508@ladder02.news.aol.com>, tbenner@aol.com (TBenner) wrote: > Hi > > I would like to gray out an edit field in a dialog box, but am not sure how > to do this. Is there a code example of how to do this somewhere? > > Tim Benner > tbenner@aol.com If you believe that Apple will keep its promise and produce the Appearance extension for MacOS 7.x, making it practical to deliver a MacOS 7.x compatible app with the same GUI as a MacOS 8 app without jumping through a large number of hoops or spending way too much money, then Appearance adoption will give you the nicest 'gray out' . Get the SDK on the Apple developer web site and read the docs. Best, Chris Orgill +++++++++++++++++++++++++++ >From WaterEdgSW@A-O-L.COM (Steve Makohin) Date: Fri, 10 Oct 1997 20:58:49 -0500 Organization: Water's Edge Software In article <19971007231700.TAA27508@ladder02.news.aol.com>, tbenner@aol.com (TBenner) wrote: > I would like to gray out an edit field in a dialog box, but am not sure how > to do this. Is there a code example of how to do this somewhere? Another alternative is to download our Tools Plus libraries from our web site. You can disable a field with one line of code. You can also do thousands of other things with one line of code too! -Steve Makohin | Remove dashes from email Water's Edge Software | address before replying. (Makers of Tools Plus and SuperCDEFs) | (Spam is getting bad) http://www.interlog.com/~wateredg | --------------------------- >From tyen@earthling.net (Tee Yen) Subject: Growing resources Date: Tue, 07 Oct 1997 16:38:08 +0800 Organization: YenCo. Hi, This probably really basic, but i jsut can't figure it, if i get a handle to a resource with a call to GetResource, and then want to increase the amount of data it holds, how would i do that? I've tried SetHandleSize, but then when i write the handle with WriteResource it doesnt show up in the file. I also tried SetResourceSize, but that ended up with major hangs. Any ideas? Thanx in advance, yen - - tyen@earthling.net http://tyen.home.ml.org/ +++++++++++++++++++++++++++ >From slur@world.std.com (Scott Lahteine) Date: Sat, 11 Oct 1997 17:46:23 GMT Organization: Pylon Transit Authority In article , tyen@earthling.net wrote: >Hi, > >This probably really basic, but i jsut can't figure it, if i get a handle >to a resource with a call to GetResource, and then want to increase the >amount of data it holds, how would i do that? > >I've tried SetHandleSize, but then when i write the handle with >WriteResource it doesnt show up in the file. I also tried SetResourceSize, >but that ended up with major hangs. > >Any ideas? You can use the SetResourceSize procedure to change the size of a resource on disk. This procedure is normally used only with ReadPartialResource and WritePartialResource. PROCEDURE SetResourceSize (theResource: Handle; newSize: LongInt); theResource A handle to a resource. newSize The size, in bytes, that you want the resource to occupy on disk. DESCRIPTION Given a handle to a resource, SetResourceSize sets the size field of the specified resource on disk without writing the resource data. You can change the size of any resource, regardless of the amount of memory you have available. If the specified size is smaller than the resource¼s current size on disk, you lose any data from the cutoff point to the end of the resource. If the specified size is larger than the resource¼s current size on disk, all data is preserved, but the additional area is uninitialized (arbitrary data). If you read a partial resource into memory and then change its size, you must use SetResourceSize to change the entire resource¼s size on disk as necessary. For example, suppose the entire resource occupies 1 MB and you use ReadPartialResource to read in a 200 KB portion of the resource. If you then increase the size of this partial resource to 250 KB, you must call SetResourceSize to set the size of the resource on disk to 1.05 MB. Note that in this case you must also keep track of the resource data on disk and move any data that follows the original partial resource on disk. Otherwise, there will be no space for the additional 50 KB when you call WritePartialResource to write the modified partial resource to disk. Under certain circumstances, the Resource Manager overrides the size you set with a call to SetResourceSize. For instance, suppose you read an entire resource into memory by calling GetResource or related routines, then use SetResourceSize successfully to set the resource size on disk, and finally attempt to write the resource to disk using UpdateResFile or WriteResource. In this case, the Resource Manager adjusts the resource size on disk to conform with the size of the resource in memory. If the disk is locked or full, or the file is locked, the SetResourceSize procedure does nothing, and the ResError function returns an appropriate File Manager result code. If the resource is in memory, the Resource Manager tries to set the size of the resource on disk. If the attempt succeeds, ResError returns the result code resourceInMemory, and the Resource Manager does not update the copy in memory. If the attempt fails, ResError returns an appropriate File Manager result code. SPECIAL CONSIDERATIONS The SetResourceSize procedure may move or purge memory blocks in the application heap. Your application should not call this procedure at interrupt time. RESULT CODES noErr 0 No error resourceInMemory ‚188 Resource already in memory writingPastEnd ‚189 Writing past end of file SEE ALSO To check for errors, call the ResError function as described on page 1-51 of Inside Macintosh: More Macintosh Toolbox. -- scott lahteine "being is faster than light" +++++++++++++++++++++++++++ >From BHuey@nospam.att.net (Hugh Johnson) Date: Sat, 11 Oct 1997 20:31:26 -0600 Organization: Semplice In article , tyen@earthling.net wrote: > Hi, > > This probably really basic, but i jsut can't figure it, if i get a handle > to a resource with a call to GetResource, and then want to increase the > amount of data it holds, how would i do that? > > I've tried SetHandleSize, but then when i write the handle with > WriteResource it doesnt show up in the file. I also tried SetResourceSize, > but that ended up with major hangs. > > Any ideas? > After setting Handle size, call ChangedResource(), Check ResError(), then WriteResource() if there's no err. That's all there is to it. SetResourceSize() is used to resource on disk, not in memory. If you want to do it on disk, first get the resource with ResLoad set to FALSE, then use that empty handle in SetResourceSize(), then call WritePartialResource() - although there's no law against writing the whole thing... -- Hugh Johnson Replace "nospam" with "worldnet" +++++++++++++++++++++++++++ >From "Marc Page" Date: 13 Oct 97 09:37:20 -0500 Organization: National Instruments, Austin, TX Try doing the following: SetHandleSize ChangedResource WriteResource If you don't tell it the resource has changed, it won't write it back out. On Tue, Oct 7, 1997 3:38 AM, Tee Yen wrote: Hi, This probably really basic, but i jsut can't figure it, if i get a handle to a resource with a call to GetResource, and then want to increase the amount of data it holds, how would i do that? I've tried SetHandleSize, but then when i write the handle with WriteResource it doesnt show up in the file. I also tried SetResourceSize, but that ended up with major hangs. Any ideas? Thanx in advance, yen - - tyen@earthling.net http://tyen.home.ml.org/ - ------------------------------------------------------------------ - Marc Page http://www.ridgecrest.ca.us/~rpage/pagem/pages.cgi - ------------------------------------------------------------------ This message was created and sent using the Cyberdog Mail System - ------------------------------------------------------------------ --------------------------- >From Shannon Schroeder Subject: Help: Getting and Displaying keys Date: Thu, 02 Oct 1997 00:43:33 -0600 Organization: Internet Direct, Incorporated How do I receive and display keys typed by the user? I mean, like in a game preferences dialog box. How can I tell what key the user typed and then display it in a text edit field? I can understand regular characters and numbers, but what about arrows keys, return , option, etc.? Sincerely, Shannon Schroeder +++++++++++++++++++++++++++ >From killtherat@bigfoot.com (Kill The Rat) Date: Thu, 02 Oct 1997 09:40:55 -0800 Organization: NONE In article <34334292.2C328B3E@txdirect.net>, Shannon Schroeder wrote: > How do I receive and display keys typed by the user? I mean, like in a > game preferences dialog box. How can I tell what key the user typed and > then display it in a text edit field? I can understand regular > characters and numbers, but what about arrows keys, return , option, > etc.? I'd suggest useing the GetKeys function. There's a section on it in the c.s.m.p.games FAQ. You can find it at Kyle -- f u cn rd ths thn y cn gt gd jb prgrmmng cmptrs--------- "Some times when it's quiet enough, and I listen hard enough, I can hear the entire world laughing at me" - ---------------------------------E-mail for public key +++++++++++++++++++++++++++ >From bounce@1.0.0.127 (Alexander Duncan) Date: 2 Oct 1997 21:20:33 GMT Organization: none > How do I receive and display keys typed by the user? I mean, like in a > game preferences dialog box. How can I tell what key the user typed and > then display it in a text edit field? I can understand regular > characters and numbers, but what about arrows keys, return , option, > etc.? Here's a C Function to determine whether a key is down(just make sure you pass it the the virtual key code): Boolean IsDown(char code) { char byte, bit; KeyMap km; GetKeys(km); byte = code >> 3; bit = (1 << (code & 7)); return (((char *) this->km)[byte] & bit); } Here are some keycodes you might use: enum { keyReturn = 0x24, keySpace = 0x31, keyDelete = 0x33, keyESC = 0x35, keyCmd = 0x37, keyShift = 0x38, keyOption = 0x3A, keyControl = 0x3B, keyClear = 0x47, keyEnter = 0x4C, keyLeft = 0x7B, keyRight = 0x7C, keyUp = 0x7E, keyDown = 0x7D }; If this doesn't help mush, check out "Cheese Toast", the source code is great for those wanting to learn how to play games. -Dunkstr -- Replace "bounce@1.0.0.127" with alex@astro.queensu.ca --------------------------- >From andcha@NO-SPAM.nortel.ca (Andrew Chalupka) Subject: How do I control the CD-ROM? Date: Thu, 25 Sep 1997 12:17:36 -0400 Organization: Nortel Technology Pardon the potential ignorance of this question.. I work on a Mac. When I work I like to listen to CDs. Currently I have two methods for controlling the CD-ROM: use AppleCD Audio Player or the CDStrip Control Strip Module. Both work fine, but... Ideally, what I'd like to be able to do is use keyboard shortcuts to control the CD player (i.e. play, stop, pause, skip track, etc.). Is there any shareware avaible which would allow me to do this? Or would I have to write my own script/program? Can I use AppleScript to do this, or would it involve something more complicated? Any available references on how to do such a thing? Thanks for your help, Andrew -- Remove "NO-SPAM." to e-mail me. +++++++++++++++++++++++++++ >From "Christopher Morin" Date: 30 Sep 1997 23:49:57 GMT Organization: Sirius Connections Andrew, I'm not sure if there is a shareware thing to do this, but you could write your own extension to listen for particular keystrokes and send commands to the CD using standard toolbox calls. I have some source code which demonstrates controlling the CD if you would like it. I believe it came from an Apple Developer CD. Mail to chris@eudemonic if you'd like me to send it along. -chris > Is there any shareware avaible which would allow me to do this? > > Or would I have to write my own script/program? +++++++++++++++++++++++++++ >From i'm@not.here (Jeff Clites) Date: Mon, 06 Oct 1997 04:02:54 -0700 Organization: California Institute of Technology, Pasadena In article , andcha@NO-SPAM.nortel.ca (Andrew Chalupka) wrote: >Ideally, what I'd like to be able to do is use keyboard shortcuts to >control the CD player (i.e. play, stop, pause, skip track, etc.). > >Is there any shareware avaible which would allow me to do this? Take a look at PopupCD, at http://www.tiac.net/users/jbrochu/cd/PopupCDAbout.shtml This allows you to define keyboard shortcuts for your CD controls. And, like John Brochu's other product CalcWorks, it has an absolutely beautiful user interface. (He wasn't a finalist in Apple's Human Interface Design Excellence Awards for nothin'.) - ------------------------------------------------------------------------ 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 Guy Subject: How to Assert Serial Port Pins Date: Mon, 13 Oct 1997 14:42:04 -0800 Organization: EarthLink Network, Inc. How do you set the individual pins on the serial ports? I've searched through several Inside Macintosh volumes, and the closest I've gotten is in Devices. However, the description of serial ports contained there is at too high a level for what I want to do. Right now, all I want to do is use the mac to switch on a transistor. So I planned on simply using the serial port, asserting a pin and using its on voltage at the transistor's base. However, all of the information I have found pertains to using the serial port for communications. Could somebody explain how I can accomplish what I want, or point me to an internet or published resource explaining it? Thank you, Guy +++++++++++++++++++++++++++ >From softools@disop.com (Jorge Chamorro Bieling) Date: Thu, 16 Oct 1997 00:34:47 +0100 Organization: Softools Guy wrote: > How do you set the individual pins on the serial ports? I've searched > through several Inside Macintosh volumes, and the closest I've gotten is > in Devices. However, the description of serial ports contained there is > at too high a level for what I want to do. > Right now, all I want to do is use the mac to switch on a transistor. > So I planned on simply using the serial port, asserting a pin and using > its on voltage at the transistor's base. However, all of the information > I have found pertains to using the serial port for communications. > Could somebody explain how I can accomplish what I want, or point me > to an internet or published resource explaining it? > > Thank you, > Guy I spent a whole summer learning how to access and program the zilog 8530 that used to be in every 68k mac's serial port. Although you can do this (and much more) the hard -and illegal- way, that's the -official- way for flipping the lines on and off: First be sure to open the port that you're going to use. If you are not going to xmit anything, you can use the TxD+ or TxD- lines, which can be set/reset by calling SerSetBrk() and SerClrBrk(). If you want to use the HSKo line instead, you first have to be sure that the driver is set-up with a serShk record filled with 0 in the fDTR field, so that the serial driver doesn't use the DTR line (which is in fact HSKo) for handshaking purposes. You do this with a control call with csCode=10, and *not* with SerHShake(), because SerHShake() does ignore the fDTR field of the serHsk record. See IM-Devices/SerialPort/Advanced-control-calls for more info. Then use control-calls to the output serial driver refNum with csCode 17 to assert DTR and csCode 18 to negate DTR. The exact meaning of asserting/negating DTR is better understood with a multimeter or an oscilloscope probe right at the HSKo pin. Keep in mind when coupling these lines to a transistor's base that some Mac's (all?) output close to +/-12v in them... Use a series resistor and clamp afterwards the negative-going signal to ground through a diode when driving a grounded emitter NPN. Most important, if you found this info to be useful, let me know. GOOD LUCK!! (And try not to fry your mac's serial port...) -- In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. - Douglas Adams --------------------------- >From troika@ANTISPAMpanix.com (Mark Coniglio) Subject: How to patch traps under PPC Date: Fri, 26 Sep 1997 23:44:17 -0500 Organization: Troika Ranch I recently converted a Think Class Library application to PowerPlant using the great converter package. This all went well, except for one thing: it removed code that added a head patch to ExitToShell. This patch de-installed a Time Managaer Task at program exit. The cool thing about the ExitToShell patch is that, even if the program crashed, the Time Manager Task was removed. Now, if there is a crash, the system is unstable because the TM task is still jumping to execute code somewhere in memory. Is there a way to have this same functionality under PPC and CFM68K? Thanks in advance, Mark Coniglio Note anti-spammed email address ================================================================= ** Note: Remove ANTISPAM from my email address to send me mail ** ================================================================= Mark Coniglio, Artistic Co-Director | troika@ANTISPAMpanix.com Troika Ranch | http://www.art.net/~troika ================================================================= +++++++++++++++++++++++++++ >From bradley@apple.com (Bob Bradley) Date: 27 Sep 1997 08:56:16 GMT Organization: Uh huh huh...It says Organ In article , troika@ANTISPAMpanix.com (Mark Coniglio) wrote: > I recently converted a Think Class Library application to PowerPlant using > the great converter package. This all went well, except for one thing: it > removed code that added a head patch to ExitToShell. This patch > de-installed a Time Managaer Task at program exit. > > The cool thing about the ExitToShell patch is that, even if the program > crashed, the Time Manager Task was removed. Now, if there is a crash, the > system is unstable because the TM task is still jumping to execute code > somewhere in memory. > > Is there a way to have this same functionality under PPC and CFM68K? You can patch ExitToShell on PowerPC. You just have to create RoutineDescriptor's instead of just passing in a function pointer. A better way to do what you want is to use a CFM termination routine. When the code fragment is terminated, your routine will get called. If you're using CodeWarrior, you can set the CFM termination routine in the PPC Linker panel. +++++++++++++++++++++++++++ >From marssaxman@sprynet.com.antispam (Mars Saxman) Date: Sat, 27 Sep 1997 14:13:16 -0800 Organization: Red Planet Software In article , troika@ANTISPAMpanix.com (Mark Coniglio) wrote: > I recently converted a Think Class Library application to PowerPlant using > the great converter package. This all went well, except for one thing: it > removed code that added a head patch to ExitToShell. This patch > de-installed a Time Managaer Task at program exit. > > The cool thing about the ExitToShell patch is that, even if the program > crashed, the Time Manager Task was removed. Now, if there is a crash, the > system is unstable because the TM task is still jumping to execute code > somewhere in memory. > > Is there a way to have this same functionality under PPC and CFM68K? The best technique for handling a situation like this, where a global system-based handler calls back to a pointer in your app, is to create a mini-routine in a nonrelocatable block in the system heap, and install *that* as your Time Manager task (or jGNEFilter, or Gestalt selector, or whatever you like). This routine would use the Process Manager to determine whether your app was still alive (looping through active processes with GetNextProcess, then checking the app signature with GetProcessInformation is a good way to do it). If not, the stub routine pops the parameters and returns an error (if possible); if the app *is* alive, it calls the actual routine inside your app. Thus even if your app crashes, the routine can detect and compensate for this. The tricky part is "feeding" the routine the pointer it is supposed to call. Way back when, I used to write my stubs out in 68k assembler and poke the values directly in before installing, but that's a little antiquated... -Mars +++++++++++++++++++++++++++ >From shapiro@@aol.com (Eric Shapiro) Date: Sun, 28 Sep 1997 01:32:31 -0400 Organization: Relium Corp. In article , troika@ANTISPAMpanix.com (Mark Coniglio) wrote: > The cool thing about the ExitToShell patch is that, even if the program > crashed, the Time Manager Task was removed. Now, if there is a crash, the > system is unstable because the TM task is still jumping to execute code > somewhere in memory. > > Is there a way to have this same functionality under PPC and CFM68K? The best source that I've seen for fat patching information is the book "A Fragment of Your Imagination" by Joe Zobkiw. But, as Bob said, a CFM termination routine can do the same thing and is easier to do. But if you're not using CFM on the 68K side, the ExitToShell patch can still be used. -Eric +++++++++++++++++++++++++++ >From smfr@santafe.edu (Simon Fraser) Date: Sun, 28 Sep 1997 02:32:06 -0600 Organization: Santa Fe Institute In article , bradley@apple.com (Bob Bradley) wrote: >In article , >troika@ANTISPAMpanix.com (Mark Coniglio) wrote: [snip] >> The cool thing about the ExitToShell patch is that, even if the program >> crashed, the Time Manager Task was removed. Now, if there is a crash, the >> system is unstable because the TM task is still jumping to execute code >> somewhere in memory. >> >> Is there a way to have this same functionality under PPC and CFM68K? > >You can patch ExitToShell on PowerPC. You just have to create >RoutineDescriptor's instead of just passing in a function pointer. > >A better way to do what you want is to use a CFM termination routine. When >the code fragment is terminated, your routine will get called. If you're >using CodeWarrior, you can set the CFM termination routine in the PPC >Linker panel. I'd be careful doing this. "Mac OS Runtime Architectures" states (on page 1-36) that "there is no guarantee that the termination routine will be run if your application crashes or otherwise terminates unnaturally." So I think that patching ExitToShell() is a more reliable solution here. Simon -- Simon Fraser smfr@santafe.edu http://www.santafe.edu/~smfr/ +++++++++++++++++++++++++++ >From bradley@apple.com (Bob Bradley) Date: Mon, 29 Sep 1997 11:53:02 -0700 Organization: Uh huh huh...It says Organ In article , smfr@santafe.edu (Simon Fraser) wrote: > I'd be careful doing this. "Mac OS Runtime Architectures" states > (on page 1-36) that "there is no guarantee that the termination > routine will be run if your application crashes or otherwise > terminates unnaturally." > > So I think that patching ExitToShell() is a more reliable solution > here. ExitToShell calls the CFM termination routine so it'll still get called. -- To get random signatures put text files into a folder called „Random Signatures¾ into your Preferences folder. +++++++++++++++++++++++++++ >From ely@netcom.com (Dave Ely) Date: Wed, 01 Oct 1997 22:43:46 -0700 Organization: notta, zip, zero In article , troika@ANTISPAMpanix.com (Mark Coniglio) wrote: | I recently converted a Think Class Library application to PowerPlant | using the great converter package. This all went well, except for one | thing: it removed code that added a head patch to ExitToShell. This | patch de-installed a Time Managaer Task at program exit. | The cool thing about the ExitToShell patch is that, even if the | program crashed, the Time Manager Task was removed. In this case, you don't need to worry about making the patch yourself. Since you've moved to CodeWarrior, use an LCleanupTask. Make sure the code which manages the task, the task itself or even the application (pick one, or pick another which works for you) inherits from LCleanupTask; implement DoCleanup() and you'll be all set. You'll have to add LCleanupTask and LInterruptSafeList to your project. -- Dave Ely +++++++++++++++++++++++++++ >From gurgle@iname.com (Pete Gontier) Date: Sat, 11 Oct 1997 14:44:28 -0700 Organization: cellular In article , marssaxman@sprynet.com.antispam (Mars Saxman) wrote: > The best technique for handling a situation like this, where a global > system-based handler calls back to a pointer in your app, is to create a > mini-routine in a nonrelocatable block in the system heap, and install > *that* as your Time Manager task (or jGNEFilter, or Gestalt selector, or > whatever you like). Yep. Some day I'll have to update the jGNEFilter sample to do this. Too many things on my list... > This routine would use the Process Manager to > determine whether your app was still alive (looping through active > processes with GetNextProcess, then checking the app signature with > GetProcessInformation is a good way to do it). > > If not, the stub routine pops the parameters and returns an error (if > possible); if the app *is* alive, it calls the actual routine inside your > app. This doesn't sound like the best algorithm. If your app quits and is relaunched after some other app is launched, it will still have the same creator code but will occupy a different spot in memory. Instead, I'd store the ProcessSerialNumber in the code block and verify that the process still exists (coincidentally, with GetProcessInformation) before calling through to the "actual" routine inside the app. For lots of things, though, this won't cut the mustard. If you're a Time Manager task, you can't afford to spend time ditzing around with the Process Manager. Patching ExitToShell can be your best bet. These days, I prefer to attach a thread termination procedure to the main thread, because it involves less hackery and ExitToShell is sometimes called more than once, unlike a thread termination proc. > Thus even if your app crashes, the routine can detect and compensate for > this. The tricky part is "feeding" the routine the pointer it is supposed > to call. Way back when, I used to write my stubs out in 68k assembler and > poke the values directly in before installing, but that's a little > antiquated... Yeah, well, so's jGNEFilter. :-) -- Pete Gontier, Integer Poet --------------------------- >From sorin@gte.net (Sorin) Subject: How to set the desktop pattern? Date: 14 Sep 1997 04:17:53 GMT Organization: gte.net I've been playing with SetDeskCPat and a couple other low memory functions and variables, but I can't seem to set the desktop pattern back to the system default grey.Any help would be appreciated. Thanks, Sorin Please reply to sorin@elwha.evergreen.edu +++++++++++++++++++++++++++ >From i'm@not.here (Jeff Clites) Date: Tue, 23 Sep 1997 15:58:25 -0700 Organization: California Institute of Technology, Pasadena In article <5vfohh$7lh$1@gte1.gte.net>, sorin@gte.net (Sorin) wrote: >I've been playing with SetDeskCPat and a couple other low memory functions >and variables, but I can't seem to set the desktop pattern back to the >system default grey.Any help would be appreciated. This is just a guess, but you might be able to use AppleScript (or send Apple Events) to set the desktop pattern to "none". - ------------------------------------------------------------------------ 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 marssaxman@sprynet.com.antispam (Mars Saxman) Date: Sun, 28 Sep 1997 01:17:28 -0800 Organization: Red Planet Software > In article <5vfohh$7lh$1@gte1.gte.net>, sorin@gte.net (Sorin) wrote: > > >I've been playing with SetDeskCPat and a couple other low memory functions > >and variables, but I can't seem to set the desktop pattern back to the > >system default grey.Any help would be appreciated. I'm afraid I missed the original post, so I may be missing some context here. If so, feel free to correct. (Secondary caveat: all this info is based on my experience developing "Zmac's Mad ppatter!" a couple of years ago; things may have changed slightly under OS8, but as the program still runs fine under 8 I can't imagine the changes are very substantial.) The system default desktop pattern is always 'ppat' resource 16 in the System file. Assuming no other file has a ppat 16, you can get it by simply loading with GetCPattern. Setting the desktop pattern is quite a bit trickier than the SetDeskCPat documentation would suggest. Your pattern must be loaded within the System heap, or the desktop will instantly go fuzzy, and the system may crash, as soon as your app quits. Furthermore, SetDeskCPat does *not* dispose of the previous pattern. You must get the pattern handle and dispose of it yourself. Just make sure to dispose of the pattern *after* setting your new pattern in! On a similar note: Has anyone seen any information on the Desktop Pictures control panel's mechanism for covering the desktop with a single large picture? I'd like to make use of this in a new desktop utility I'm planning, but haven't been able to track down any documentation. -Mars Saxman Red Planet Software developer of Mad ppatter!, Chat Magic, eWorld Aid, Beyond Dunny, and others currently lead programmer on Object Basic +++++++++++++++++++++++++++ >From grobbins@nospam.znet.com (Grobbins) Date: Thu, 02 Oct 1997 02:32:16 -0700 Organization: Skunkworks In article , marssaxman@sprynet.com.antispam (Mars Saxman) wrote: > On a similar note: Has anyone seen any information on the Desktop Pictures > control panel's mechanism for covering the desktop with a single large > picture? I'd like to make use of this in a new desktop utility I'm > planning, but haven't been able to track down any documentation. The Desktop Pictures control panel uses an undocumented hook into the Display Manager to take control of desktop drawing. It's not worth figuring out the hook, since it's not one that can be arbitrated; there's no way to "fall through" to the previous drawer, so any code using the hook has to be responsible for all desktop drawing, always. You can send an Apple event to the Desktop Pictures control panel to tell it to use your picture file, but that solution may not be suitable and requires launching the control panel so it can handle the event. Probably the best approach currently is to do what desktop picture INITs have always done (and what the Desktop Pictures control panel does on systems earlier than 7.6): patch out the QuickDraw routines for drawing patterns (FillRgn/FillCRgn and, depending on the environment you're running in, possibly also FillRect/FillCRect), when you see that the pattern drawing is being done to the desktop, replace it with your own image. That method will coexist fine with Desktop Pictures, though desktop pictures will take precedence, overwriting your picture display. You can tell if Desktop Pictures is currently displaying a picture on any monitor by checking Gestalt, and perhaps give your user the option to turn off Desktop Pictures. Greg Robbins grobbins@znet.com --------------------------- >From uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig) Subject: Installing system-wide AE handler from app? Date: Tue, 7 Oct 1997 00:14:56 +0200 Organization: Completely Disorganized I've naively written an application that installs a system-wide handler for the AppleScript "log" event (ascr/cmnt). On startup I save the current handler and install my own one. On quitting the old handler is reinstalled. I tried to chain handlers, but curiously the old handler UPP referred to my own handler -- non-stopping recursion was the result. The real problem is, that when I quit the app while another app tries to log something that other app crashes. Well, I thought I've done enough to prevent this, but apparently I'm wrong. What did I miss? Michael -- Michael Schuerig Contests between male toads over females are mailto:uzs90z@uni-bonn.de often settled by the depth of the croak. http://www.uni-bonn.de/~uzs90z/ -John Maynard Smith +++++++++++++++++++++++++++ >From gurgle@iname.com (Pete Gontier) Date: Sat, 11 Oct 1997 13:56:23 -0700 Organization: cellular In article <199710070013381835510N@rhrz-isdn3-p27.rhrz.uni-bonn.de>, uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig) wrote: > I've naively written an application that installs a system-wide handler > for the AppleScript "log" event (ascr/cmnt). On startup I save the > current handler and install my own one. On quitting the old handler is > reinstalled. I tried to chain handlers, but curiously the old handler > UPP referred to my own handler -- non-stopping recursion was the result. > > The real problem is, that when I quit the app while another app tries to > log something that other app crashes. Well, I thought I've done enough > to prevent this, but apparently I'm wrong. What did I miss? It shouldn't be possible for the old handler to have the same address as your handler. I'd say figure out why that's happening first before you worry about any of the rest of it. You might want to post the code you're using to obtain the old handler. Chaining the handlers should work. Lots of commercial programs do it. If your code has somehow confused the old handler and the new handler and it restores what it thinks is the old handler but is really the new handler -- whose code is about to go away -- this would explain the crash you are seeing. Another thing to keep in mind is that someone else may have chained YOUR handler -- an app which launches after yours and chains your AppleEvent handler isn't necessarily going to be aware when your app goes away. Same goes for your app in relation to apps which have previously patched the handler. Patching global code from an app is hairy. Perhaps you'd better tell us why you need to do this and maybe we can help you avoid the whole mess. -- Pete Gontier, Integer Poet +++++++++++++++++++++++++++ >From uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig) Date: Sun, 12 Oct 1997 03:24:40 +0200 Organization: Completely Disorganized Pete Gontier wrote: > It shouldn't be possible for the old handler to have the same address as > your handler. I'd say figure out why that's happening first before you > worry about any of the rest of it. You might want to post the code you're > using to obtain the old handler. Here's the init code: gOldLogHandler = nil; AESetInteractionAllowed(kAEInteractWithAll); err = AEGetEventHandler(kASAppleScriptSuite, kASComment, &gOldLogHandler, &gOldLogRefCon, true); if (err == noErr) { gLogHandler = NewAEEventHandlerProc(LogHandler); if (gLogHandler != nil) { err = AEInstallEventHandler(kASAppleScriptSuite, kASComment, gLogHandler, 0, true); } else err = memFullErr; } and here's the (non-working) chaining part: if (gOldLogHandler != nil && gOldLogHandler != gLogHandler) CallAEEventHandlerProc(gOldLogHandler, AE, reply, gOldLogRefCon); I even tried to explicitly make sure that the handlers are different. But apparently the two UPPs are different but point to the same actual function. Now that I think of it, is it possible that the UPP from a previous run of the app was still kept by the system? > Another thing to keep in mind is that someone else may have chained YOUR > handler Oops. I completely ignored that. > Patching global code from an app is hairy. Perhaps you'd better tell us > why you need to do this and maybe we can help you avoid the whole mess. You'll have guessed it, I want to intercept the "log" event from AppleScript. It's intended as a debugging aid and general logging facility for cases where it's impossible or impractical to run the script from Script Editor (et al.). Data Detector Actions are an instance. I think the clean way to deal with the chaining issue is to install the handler from an osax that checks if the logging app is running and then forwards the event. Michael -- Michael Schuerig Nothing helps a bad mood like spreading it. mailto:uzs90z@uni-bonn.de -Calvin http://www.uni-bonn.de/~uzs90z/ --------------------------- >From Yevgeny Binder Subject: MDEF's - Code-based Installation Date: Thu, 16 Oct 1997 21:51:44 -0500 Organization: EarthLink Network, Inc. Call me a beginner, but I'm just a beginner. Here's the thing: I'd like to implement a custom MDEF of mine in most of my menus, but I have one slight problem: I am not using resource-based menus. I tried to manually alter the menuProc field of all the MenuHandle structs in my app, but CodeWarrior gives me a C compiler message after I have this code for a custom Apple Menu MDEF: gMenu.appleMenu->->menuProc=GetResource('MDEF',19999); where gMenu is my global menu structure, appleMenu is the Apple Menu field in that struct, the handle to the menuProc field is needed because of the MenuHandle struct inside the gMenu.appleMenu, and the 19999 is the resource number of my custom MDEF. Please give me any helpful tips on how to fix this, aside from using the good ol' resources for my menus. I would forever be in your debt if I actually got this thing working. Thanks in advance. +++++++++++++++++++++++++++ >From DavidO@dascorp.com (David Phillip Oster) Date: Fri, 17 Oct 1997 12:55:36 -0700 Organization: Digital Arts & Sciences Corp. In article <3446D2B1.DB39BCBC@earthlink.net>, binders@earthlink.net wrote: > gMenu.appleMenu->->menuProc=GetResource('MDEF',19999); The syntax for getting at the fields of a handle is not ->->, it is either (*h)->field or (**h).field . I prefer the latter. Handle h; h = GetResource('MDEF',19999); (**gMenu.appleMenu).menuProc = h; Some compilers used to generate code that would dereference the menuhandle, to get a destination address, then do the right hand side of the assignment statement, then do the store. This was fine, unless GetResource's internal calls on the Memory Manager happened to compress the heap. If that happened, the store would not be into the field of the handle, but into where the field used to be. That is why I use a temporary variable "h", when assigning to the fields of an unlocked handle from a function that might move memory. -- -- Warning: posted from an unlocked cubicle: no guarantee its really me. "A proud member of the International Jewish Conspiracy, since 3760 BCE, the original FAMILY-OWNED international conspiracy." _ zionelders@ijc.org --------------------------- >From willie@pobox.com (Willie Abrams) Subject: PowerPC-CFM Question Date: Thu, 09 Oct 1997 14:58:41 -0500 Organization: IBM.NET I have a couple of questions on the MacOS PowerPC runtime: 1. Is there a way to obtain a pointer to the caller function from inside the called function? I know the LR in CodeWarrior-gen code contains the return address for the blr at the end of the function, but I didn't know if the ABI specified that explicitly. Plus, that takes you back to the point of the function call - is there a way to get an actual pointer to the caller function itself? 2. Given a pointer to a function (or in the case above, a pointer to the "middle" of a function), is there a way to determine what code fragment the caller function resides in? (And for a bonus, the name of the symbol of that function if it is exported...) One other somewhat related question - now that the Motorola C/C++ Plug-in is no longer being developed, what are people doing for final optimized PowerPC builds? (And if those are MPW based, what is the easiest way to go from a CW Pro project file to a MPW makefile?) I know these are a lot of strange questions - thanks for your patience. Willie - -- Willie Abrams pixel dealer, packet pusher * http://pobox.com/~willie/ +++++++++++++++++++++++++++ >From rbarris@quicksilver.com (Rob Barris) Date: Fri, 10 Oct 1997 13:37:14 -0700 Organization: Quicksilver Software, Inc. In article , willie@pobox.com (Willie Abrams) wrote: > I have a couple of questions on the MacOS PowerPC runtime: > > 1. Is there a way to obtain a pointer to the caller function from inside > the called function? > > I know the LR in CodeWarrior-gen code contains the return address for the > blr at the end of the function, but I didn't know if the ABI specified that > explicitly. Plus, that takes you back to the point of the function call - > is there a way to get an actual pointer to the caller function itself? > > 2. Given a pointer to a function (or in the case above, a pointer to the > "middle" of a function), is there a way to determine what code fragment > the caller function resides in? (And for a bonus, the name of the symbol of > that function if it is exported...) Sounds like you are writing a stack crawl! I wrote one once, if you have traceback tables turned on in CW, you can just use the return address, scan ahead one instruction ata time until you find the 'blr' at the end of the *caller*, and the name follows right after that as a p-string or something (was about a year ago, sorry). Fixed length instructions are neat-o. (We used this self-examining stack crawl to track down particularly pernicious memory leaks in some game AI code, where the potential a leak was influenced strongly by the path taken to get to the actual allocation call site... once we started saving four or five-level stack crawl logs (16-20 bytes) tagged onto each memory block, paths that caused leaks stuck out like a sore thumb) Rob Barris Quicksilver Software Inc. rbarris@quicksilver.com * Opinions expressed not necessarily those of my employer * +++++++++++++++++++++++++++ >From gurgle@iname.com (Pete Gontier) Date: Sat, 11 Oct 1997 15:10:13 -0700 Organization: cellular In article , willie@pobox.com (Willie Abrams) wrote: > I have a couple of questions on the MacOS PowerPC runtime: Sadly, this is not my area of expertise, but I did want to chime in about some ancillary issues. > 1. Is there a way to obtain a pointer to the caller function from inside > the called function? > > I know the LR in CodeWarrior-gen code contains the return address for the > blr at the end of the function, but I didn't know if the ABI specified that > explicitly. Plus, that takes you back to the point of the function call - > is there a way to get an actual pointer to the caller function itself? In article , rbarris@quicksilver.com (Rob Barris) wrote: > Sounds like you are writing a stack crawl! > > I wrote one once, if you have traceback tables turned on in CW, you can > just use the return address, scan ahead one instruction ata time until you > find the 'blr' at the end of the *caller*, and the name follows right after > that as a p-string or something (was about a year ago, sorry). > > Fixed length instructions are neat-o. > > (We used this self-examining stack crawl to track down particularly > pernicious memory leaks in some game AI code, where the potential a leak > was influenced strongly by the path taken to get to the actual allocation > call site... once we started saving four or five-level stack crawl logs > (16-20 bytes) tagged onto each memory block, paths that caused leaks stuck > out like a sore thumb) Another way to solve this problem is to abuse the profiler feature of the compiler. The generated profiling code amounts to a sub-routine call on entry to and exit from any user function. This sub-routine is passed the name of the function and a flag indicating whether it is being entered or exited. Or at least this is how it worked the last time I implemented a stack crawl in one of my apps. The only drawback here is that you can't have the stack crawl AND a profiled build unless you figure out a way to call the profiling library from your stack crawl code, which I've never bothered to do. Finally: remember to turn off profiling for the functions which implement your stack crawl or you'll end up in infinite recursion hell infinite recursion hell infinite recursion hell infinite recursion hell infinite recursion hell infinite recursion hell infinite recursion hell infinite recursio Sorry, the application "unknown" has quit unexpectedly due to an error of type 28. -- Pete Gontier, Integer Poet +++++++++++++++++++++++++++ >From Michael Meissner Date: 11 Oct 1997 21:18:12 -0400 Organization: Cygnus Solutions willie@pobox.com (Willie Abrams) writes: > > I have a couple of questions on the MacOS PowerPC runtime: > > 1. Is there a way to obtain a pointer to the caller function from inside > the called function? > > I know the LR in CodeWarrior-gen code contains the return address for the > blr at the end of the function, but I didn't know if the ABI specified that > explicitly. Plus, that takes you back to the point of the function call - > is there a way to get an actual pointer to the caller function itself? I believe the MAC uses the same ABI as AIX, in which case, the answer is that the ABI specifies where the return address is stored in the frame, and that the word the stack pointer points to points to the previous stack frame: Here is an ascii graphic I did as part of the GCC compiler support for various powerpc ABIs: Note that the saved CR and saved LR are for functions called by the current function to use. SP----> +---------------------------------------+ | back chain to caller | 0 +---------------------------------------+ | saved CR | 4 +---------------------------------------+ | saved LR | 8 +---------------------------------------+ | reserved for compilers | 12 +---------------------------------------+ | reserved for binders | 16 +---------------------------------------+ | saved TOC pointer | 20 +---------------------------------------+ | Parameter save area (P) | 24 +---------------------------------------+ | Alloca space (A) | 24+P +---------------------------------------+ | Local variable space (L) | 24+P+A +---------------------------------------+ | Float/int conversion temporary (X) | 24+P+A+L +---------------------------------------+ | Save area for GP registers (G) | 24+P+A+X+L +---------------------------------------+ | Save area for FP registers (F) | 24+P+A+X+L+G +---------------------------------------+ old SP->| back chain to caller's caller | +---------------------------------------+ > 2. Given a pointer to a function (or in the case above, a pointer to the > "middle" of a function), is there a way to determine what code fragment > the caller function resides in? (And for a bonus, the name of the symbol of > that function if it is exported...) Bear in mind, that a "pointer to a function" (as generated by passing the address of a function) isn't quite the same thing as the LR address you see in a stack frame. When you take an address of a function in a high level language, the pointer is actually to a 3 word area. The first word is the actual function address, the second is the TOC address to load in r2, and the third is the static chain to load into r11. > One other somewhat related question - now that the Motorola C/C++ Plug-in > is no longer being developed, what are people doing for final optimized > PowerPC builds? (And if those are MPW based, what is the easiest way to go > from a CW Pro project file to a MPW makefile?) > > I know these are a lot of strange questions - thanks for your patience. Can't help you here. -- Michael Meissner, Cygnus Solutions (East Coast) 4th floor, 955 Massachusetts Avenue, Cambridge, MA 02139, USA meissner@cygnus.com, 617-354-5416 (office), 617-354-7161 (fax) +++++++++++++++++++++++++++ >From willie@pobox.com (Willie Abrams) Date: Mon, 13 Oct 1997 11:10:05 -0500 Organization: IBM.NET In article , Michael Meissner wrote: >I believe the MAC uses the same ABI as AIX, in which case, the answer is that >the ABI specifies where the return address is stored in the frame, and that the >word the stack pointer points to points to the previous stack frame: > >Here is an ascii graphic I did as part of the GCC compiler support for various >powerpc ABIs: Yes, the Mac uses the AIX ABI. The graphic is very helpful. Do you know of anyone doing a GCC PowerPC port to the Mac? >Bear in mind, that a "pointer to a function" (as generated by passing the >address of a function) isn't quite the same thing as the LR address you see in >a stack frame. When you take an address of a function in a high level >language, the pointer is actually to a 3 word area. The first word is the >actual function address, the second is the TOC address to load in r2, and the >third is the static chain to load into r11. Right... Somehow I missed that section in the compiler writers guide. That helps a bunch! Thanks for the info. Willie - -- Willie Abrams pixel dealer, packet pusher * http://pobox.com/~willie/ +++++++++++++++++++++++++++ >From skortze@erols.com (Steven A. Kortze) Date: Mon, 13 Oct 1997 17:13:20 -0400 Organization: Erol's Internet Services In article , willie@pobox.com (Willie Abrams) wrote: >In article , Michael Meissner > wrote: > >>Here is an ascii graphic I did as part of the GCC compiler support for various >>powerpc ABIs: > >Yes, the Mac uses the AIX ABI. The graphic is very helpful. Do you know of >anyone doing a GCC PowerPC port to the Mac? > >Willie Are you referring to CodeWarrior plug-ins or MPW tools? Stan Shebs had worked on the MPW tools some time ago. I believe that they are still available as source or binary from ftp://ftp.cygnus.com/private/mac/. According to Stan, the Mac development at Cygnus has pretty much stopped. It seems his port did not really generate much business. When I last talked to Stan about it in July, he mentioned that nobody had even asked about the PowerMac port for a couple of months. The port was being done for IBM, who supplied some optimizations that were not in the FSF version of GCC. Derrick Aguren of IBM was working on CodeWarrior plug-in. I have sent you an email with Derrick's email address. Good luck, Steve +++++++++++++++++++++++++++ >From trumbull@cs.yale.edu (Ben Trumbull) Date: Mon, 13 Oct 1997 22:14:06 -0500 Organization: Yale University > In article , Michael Meissner > wrote: > > >I believe the MAC uses the same ABI as AIX, in which case, the answer is that > >the ABI specifies where the return address is stored in the frame, and that the > >word the stack pointer points to points to the previous stack frame: > > > >Here is an ascii graphic I did as part of the GCC compiler support for various > >powerpc ABIs: > > Yes, the Mac uses the AIX ABI. The graphic is very helpful. Do you know of > anyone doing a GCC PowerPC port to the Mac? > > >Bear in mind, that a "pointer to a function" (as generated by passing the > >address of a function) isn't quite the same thing as the LR address you see in > >a stack frame. When you take an address of a function in a high level > >language, the pointer is actually to a 3 word area. The first word is the > >actual function address, the second is the TOC address to load in r2, and the > >third is the static chain to load into r11. FYI, the third word in the transition vector (the data in the TOC) is optional/implementation dependent/wysiwyg and r11 is a volatile register. The spec merely allows for there to be more stuff tacked on. In fact, there can be however many words you want in there for whatever you want. Only the first two are required. After all, the compiler and linker create the TOC, so if you're making them, you can put anything you want in the TOC. terminally curious, Ben ___________________________________________________________________ Benjamin Trumbull trumbull@cs.yale.edu Yale University You can't be in hell; you can still read your e-mail --------------------------- >From stoedle@online.no (Daniel St¯dle) Subject: Problems with stereo sound positioning Date: Wed, 08 Oct 1997 21:07:30 +0200 Organization: Telenor Online Public Access Hello everyone, I'm having a problem with my stereo sound positioning algorithm. My problem is that whatever I do, the left channel comes out at a lower volume than the right channel (even when setting the right to zero and the left to full volume and vice versa, the sound is louder in the right channel). Can someone tell me what I am doing wrong? Here is the code I use: void setChannelSoundLevel(short leftVolume, short rightVolume, SndChannelPtr sndChannel) { SndCommand theCmd; if (sndChannel) { theCmd.param1 = 0; theCmd.param2 = (long)((long) rightVolume << 16L |leftVolume); theCmd.cmd = volumeCmd; SndDoImmediate(sndChannel, &theCmd); } } Thanks for any help. - Daniel +++++++++++++++++++++++++++ >From reekes@[nospam]apple.com (Jim Reekes) Date: Wed, 08 Oct 1997 18:09:12 -0700 Organization: Apple Computer, Inc. In article , stoedle@online.no (Daniel St¯dle) wrote: > I'm having a problem with my stereo sound positioning algorithm. My > problem is that whatever I do, the left channel comes out at a lower > volume than the right channel (even when setting the right to zero and the > left to full volume and vice versa, the sound is louder in the right > channel). > > Can someone tell me what I am doing wrong? Here is the code I use: > > void setChannelSoundLevel(short leftVolume, short rightVolume, > SndChannelPtr sndChannel) > { > SndCommand theCmd; > > if (sndChannel) > { > theCmd.param1 = 0; > theCmd.param2 = (long)((long) rightVolume << 16L |leftVolume); > theCmd.cmd = volumeCmd; > SndDoImmediate(sndChannel, &theCmd); > } > } This code is right. You may have your hardware balance set differently. Check the Monitors & Sound control panel for the balance. You can also check the Get Info dialogs of a movie while using Movie Player. Go to the volume panel and change the balance there to verify the results. Also the volumeCmd only works with Sound Mgr 3.0 or later, and you didn't check for errors in the above code. Jim -- Jim Reekes, Polterzeitgeist Sound Manager Expert, QuickTime Products R&D Sound Manager Web Page can be found at: http://quicktime.apple.com/dev/devsnd.html "All opinions expressed are mine, and do not necessarily represent those of my employer, Apple Computer Inc." +++++++++++++++++++++++++++ >From nospam@nospam.net.com.edu (Darrin Cardani) Date: Fri, 10 Oct 1997 13:32:31 -0500 Organization: Total Integration, Inc. In article , stoedle@online.no (Daniel St¯dle) wrote: > Hello everyone, > > I'm having a problem with my stereo sound positioning algorithm. My > problem is that whatever I do, the left channel comes out at a lower > volume than the right channel (even when setting the right to zero and the > left to full volume and vice versa, the sound is louder in the right > channel). > > Can someone tell me what I am doing wrong? Here is the code I use: What machine are you testing this on? Some older machines always send sound out of one channel or both channels, if I recall correctly. You might try looking through any Sound Manager Tech Notes on devworld.apple.com (I think), if you think that might be your problem. Darrin --------------------------- >From frank.vyncke@barco.com (Frank Vyncke) Subject: Progress Bar in OS8 and 7.5 Date: Fri, 17 Oct 1997 15:53:43 +0200 Organization: Barco Graphics Does anybody know whether one can access the 'standard progressbar' of the finder ? Is this part of the system software, or do I need to include some custom CDEF in my code. If so, where can I get it. Does anybody know if there is a difference there for 8 versus 7.5 ? Regards Frank -- _______________________f_r_a_n_k___v_y_n_c_k_e__________________ an optimist saying: always remember the good things. a pessimist saying: try to forget the bad things. I do nothing but remember ... Antrax +++++++++++++++++++++++++++ >From scorpio@niu.edu (Brian Bergstrand) Date: Fri, 17 Oct 1997 22:58:05 -0500 Organization: Northern Illinois University In article , frank.vyncke@barco.com (Frank Vyncke) wrote: >Does anybody know whether one can access the 'standard progressbar' >of the finder ? >Is this part of the system software, or do I need to include some custom >CDEF in my code. If so, where can I get it. >Does anybody know if there is a difference there for 8 versus 7.5 ? > In System versions prior to 8, there is no std progress bar, you have to write your own code (or use one of the many examples on the net). For 8, the Appearance Mgr includes a progress bar as a std control, and takes care of 95% of the code for you. With Appearance 1.1 (in System 8.1), the Appearance extension will be officially supported in System 7.5 and above. >Regards >Frank Brian PS. If you have Think Ref, it has some great code, that shows you how to write your own progress bar. > Brian Bergstrand http://www.pair.com/dmoll/ +++++++++++++++++++++++++++ >From WaterEdgSW@A-O-L.COM (Steve Makohin) Date: Sun, 19 Oct 1997 10:52:45 -0500 Organization: Water's Edge Software In article , frank.vyncke@barco.com (Frank Vyncke) wrote: >Does anybody know whether one can access the 'standard progressbar' >of the finder ? >Is this part of the system software, or do I need to include some custom >CDEF in my code. If so, where can I get it. >Does anybody know if there is a difference there for 8 versus 7.5 ? MacOS 8's Appearance Manager contains the progress bar. It is not part of the OS in previos MacOS versions so you must roll your own progress bar CDEF or write it within your app's code. If you don't want to write your own CDEFs, visit our web site at and take the SuperCDEFs Guided Tour. It shows you a collection of professionally crafted 3D and flat controls. One of them is a System 7 styled progress bar. With SuperCDEFs, you can give your System 7 (or System 6) app 3D and flat buttons, tabs and sliders, as well as an easy way of implementing the progress bar (it's even compatible with Aaron, the MacOS 8 appearance simulator). When your app runs on MacOS 8's Appearance Manager, use the native controls for a consistent "Platinum Appearance." -Steve Makohin | Remove dashes from email Water's Edge Software | address before replying. (Makers of Tools Plus and SuperCDEFs) | (Spam is getting bad) http://www.interlog.com/~wateredg | --------------------------- >From adb@ct.heise.de (Andreas Beier) Subject: Q: CM plug-in example code Date: Tue, 14 Oct 1997 18:09:13 +0200 Organization: c't - Magazin f¸r Computertechnik Hi, where can I find example code for a plug-in for the context-sensitive Finder menu? Any idea is appreciated. TIA, Andreas +++++++++++++++++++++++++++ >From i'm@not.here (Jeff Clites) Date: Tue, 14 Oct 1997 13:25:53 -0700 Organization: California Institute of Technology, Pasadena In article , adb@ct.heise.de (Andreas Beier) wrote: >where can I find example code for a plug-in for the context-sensitive >Finder menu? If you download the Contextual Menus package from Apple's site it comes with an example. (I don't recall the exact URL, but in with their other OS 8 dev stuff). Also, Trygve Isaacson (the person with the world's most unpronounceable and unspellable name) has a little framework for writing them, and comes with two examples. You can get this from: http://www.bombaydigital.com/cmms/cmm-framework-10.sit.hqx (As a side-note, the plugins will work within any app that supports CMs, not just the Finder. But I think that BBEdit is the only such app at present.) - ------------------------------------------------------------------------ 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 trygve@bombaydigital.com (Trygve Isaacson) Date: Wed, 15 Oct 1997 23:03:59 -0700 Organization: Bombay Digital In article , i'm@not.here (Jeff Clites) wrote: >In article , adb@ct.heise.de >(Andreas Beier) wrote: > >>where can I find example code for a plug-in for the context-sensitive >>Finder menu? > >If you download the Contextual Menus package from Apple's site it comes >with an example. (I don't recall the exact URL, but in with their other OS >8 dev stuff). Also, Trygve Isaacson (the person with the world's most >unpronounceable and unspellable name) has a little framework for writing >them, and comes with two examples. You can get this from: > > http://www.bombaydigital.com/cmms/cmm-framework-10.sit.hqx [snip] Unpronounceable...I'll bet the Norwegians would disagree with you :) Trygve is actually a common name in Norway. And you spelled it right.... The Trygves that I know of: Trygve Lie ("lee"), a Norwegian, was the first Secretary General of the U.N. When I took a couple of quarters of Norwegian language in college at UCLA, the very first character to appear in the Haugen textbook was named Trygve Christensen. When I worked at Apple, there was another Trygve in the company phone directory. And of course my namesake great-grandfather Trygve Dreyer. A native Norwegian would pronounce it treeg-veh. But since I'm a couple of generations removed from the land of the midnight sun, I learned it as trig-vee, and many people still call me Trig for short. OK, end of off-topic trivia. You axed for it. Roland the Headless Thompson Gunner, Trygve --------------------------- >From drysdallSPAMFREE@waikato.ac.nz (Richard Drysdall) Subject: Q: How to use AppearanceLib with 68K app? Date: Wed, 08 Oct 1997 00:58:39 +1300 Organization: University of Waikato Hi. I've been using the AppearanceLib in my PPC project with no problems. However, when I try to compile my 68K app with this library, I get the error message 'Link Error : AppearanceLib: Cannot use CFM68K library.' What does this mean? Is the AppearanceLib for PPC only? Can I add the 'Appearance.h', 'Appearance.p' and 'Appearance.r' to my 68K app and use them instead of the AppearanceLib? Thanks very much for any help. -- Richard Drysdall, University of Waikato, New Zealand * 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 DavidO@dascorp.com (David Phillip Oster) Date: Wed, 08 Oct 1997 13:54:37 -0700 Organization: Digital Arts & Sciences Corp. In article , drysdallSPAMFREE@waikato.ac.nz wrote: >Hi. > >I've been using the AppearanceLib in my PPC project with no problems. >However, when I try to compile my 68K app with this library, I get the >error message 'Link Error : AppearanceLib: Cannot use CFM68K library.' >What does this mean? It means you are writing a tradional 68k application, not a CFM68K project. >Is the AppearanceLib for PPC only? Yes. >Can I add the 'Appearance.h', 'Appearance.p' and 'Appearance.r' to >my 68K app and use >them instead of the AppearanceLib? You wouldn't want to. If you actually read Appearance.h, you'll see that it uses the INLINE macro to directly define all of the new system calls, when included in source code for 68K. You need to include Appearance.h the new calls, and having included it, you don't need to do anything else to make your 68k program link. (At least that is how it works for most OS include files.) Appearance.r defines the resource format, for Rez, of the new data structure resources. Appearance.p is a pascal include file. -- -- Warning: posted from an unlocked cubicle: no guarantee its really me. "A proud member of the International Jewish Conspiracy, since 3760 BCE, the original FAMILY-OWNED international conspiracy." _ zionelders@ijc.org +++++++++++++++++++++++++++ >From gurgle@iname.com (Pete Gontier) Date: Sat, 11 Oct 1997 14:04:03 -0700 Organization: cellular In article , DavidO@dascorp.com (David Phillip Oster) wrote: > In article , > drysdallSPAMFREE@waikato.ac.nz wrote: > > >Is the AppearanceLib for PPC only? > > Yes. Well, no. It's CFM-only. It's for PowerPC or CFM-68K. Appearance also has support for the classic 68K application model, but you don't need to link with anything to get it. The headers take care of it all for you. -- Pete Gontier, Integer Poet --------------------------- >From drysdallSPAMFREE@waikato.ac.nz (Richard Drysdall) Subject: RegisterAppearanceClient questions (Appearance manager) Date: Tue, 07 Oct 1997 22:41:53 +1300 Organization: University of Waikato Hi. According to the Appearance docs, we should call RegisterAppearanceClient "at the very beginning of our application...". Does this mean we should call it even before we initialise the toolbox? (InitGraf, InitFonts etc) Should we call RegisterAppearanceClient on non-Appearance manager machines (i.e. system 7), or should we use the GestaltAppearanceExists Gestalt Selector to determine if the Appearance manager is present? Thanks very much for any help. -- Richard Drysdall, University of Waikato, New Zealand * 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 magesteve@aol.com (Mage Steve) Date: 8 Oct 1997 03:24:53 GMT Organization: AOL http://www.aol.com Richard, Call RegisterAppearanceClient after you initialise the toolbox (InitGraf, InitFonts, etc), only when checking the GestaltAppearanceExists Gestalt Selector. Steve Sheets Mageware +++++++++++++++++++++++++++ >From nospam@nospam.kenner.demon.co.uk (Chris Orgill) Date: Sat, 11 Oct 1997 00:31:53 +0100 Organization: (none) In article <19971008032400.XAA21006@ladder02.news.aol.com>, magesteve@aol.com (Mage Steve) wrote: > Richard, > Call RegisterAppearanceClient after you initialise the toolbox (InitGraf, > InitFonts, etc), only when checking the GestaltAppearanceExists Gestalt > Selector. > but before drawing the menubar... Chris Orgill --------------------------- >From srh@iname.killspam.com (Stephen R Holmes) Subject: ResEdit 'hdlg' resource editor? Date: Thu, 25 Sep 1997 17:18:44 -0500 Organization: TNS, Inc Can anyone point me to a good 'hdlg' resource editor (to paste into my ResEdit "prefs" file)? I'd like to add balloon help to a dialog in a quick hack I've put together, believe I understand what's needed in order to use STR#s for the text, and have read the entries in the old "Inside Mac VI" on the subject, but rather than create the resources at run-time I'd rather hack the project resource file with ResEdit, if possible, and the only "tool" I have at the moment is the standard raw-hex editor... Replies to the group are fine; thanks in advance for any tips. /s.holmes -- Stephen R. Holmes | srh@iname.killspam.com TNS, Inc. | (remove the middle part of the domain name Reston, VA USA | to form my actual e-mail address) +++++++++++++++++++++++++++ >From oster@netcom.com (David Phillip Oster) Date: Sun, 28 Sep 1997 00:37:10 GMT Organization: Mosaic Codes In article , srh@iname.killspam.com (Stephen R Holmes) wrote: >Can anyone point me to a good 'hdlg' resource editor (to paste into >my ResEdit "prefs" file)? I'd like to add balloon help to a dialog in >a quick hack I've put together, believe I understand what's needed in >order to use STR#s for the text, and have read the entries in the old >"Inside Mac VI" on the subject, but rather than create the resources >at run-time I'd rather hack the project resource file with ResEdit, >if possible, and the only "tool" I have at the moment is the standard >raw-hex editor... > >Replies to the group are fine; thanks in advance for any tips. My freeware "balloony" lets you drop an application on to it, and it creates a boiler-plate .r file out of the menus and dialogs. just type in the help text, add it to your project, and compile it. It is also really easy to do by hand: just look at the definition of 'hdlg' in the system .r file. You really should be maintinaing any resource that contains text in textual form, for compiling with the Rez language compiler. Keeping it in textual form makes spell checking and internationalization much easier. - ------- oster@netcom.com ---------- "A man hears what he wants to hear and misremembers the rest." -- Paul Simon, ("The Boxer") +++++++++++++++++++++++++++ >From i'm@not.here (Jeff Clites) Date: Mon, 13 Oct 1997 00:29:04 -0700 Organization: California Institute of Technology, Pasadena In article , srh@iname.killspam.com (Stephen R Holmes) wrote: >Can anyone point me to a good 'hdlg' resource editor (to paste into >my ResEdit "prefs" file)? I'd like to add balloon help to a dialog in >a quick hack I've put together, believe I understand what's needed in >order to use STR#s for the text, and have read the entries in the old >"Inside Mac VI" on the subject, but rather than create the resources >at run-time I'd rather hack the project resource file with ResEdit, >if possible, and the only "tool" I have at the moment is the standard >raw-hex editor... Peter Lewis wrote a balloon help compiler as a CW plugin. I believe that it's included with the CodeWarrior distribution, but you can also get it through http://www.stairways.com/ - ------------------------------------------------------------------------ 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 andersoe@freene@@@t.msp.mn.us (Greg T. Anderson) Subject: Serial port help Date: Fri, 03 Oct 1997 21:24:22 -0500 Organization: Torgo Enterprises I need to talk to a custom-made board via the serial port, using RS422. What we need to do (I'm not a hardware person, so my description is appropriately vague) is have one line toggle (for timing), and then I need to toggle a line to send our data or listen to a line being toggled to receive data. My original "plan" was to use the DTR line for the timing (using the device manager's Control() call, and the Assert/NegateDTR control values), but I'm not sure what else I can use for the actual data transmission. Is there an easy way to get access to the individual lines on the serial port? Do I have to go through all the "fun" of writing my own driver and/or delving into assembly code, or is there a way to use the provided device calls to pull this off? Any help and/or informtation is greatly appreciated. Greg -- andersoe@free@@@net.msp.mn.us Remove extra "@"s for real email PGP 5.0 Public key available via finger - ---BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS d- s+: a-- C+++$ UVHISX++$ P+++ L>+++ E+$ W++ N++ o+ K w---$ !O M++$ !V-- PS PE !Y+ PGP++ t+ !5-- X++ !R tv+ b++ DI++++ D++ G++ e h-() r--* y+* - ----END GEEK CODE BLOCK------ ======http://www.pclink.com/torgo====== +++++++++++++++++++++++++++ >From "Thomas L. Ferrell" <"bounce"@[127.0.0.1]> Date: Sat, 04 Oct 1997 01:58:46 -0400 Organization: Oak Ridge National Lab, Oak Ridge, TN Greg T. Anderson wrote: > I need to talk to a custom-made board via the serial port, using > RS422. What we need to do (I'm not a hardware person, so my description > is appropriately vague) is have one line toggle (for timing), and then I > need to toggle a line to send our data or listen to a line being toggled > to receive data. My original "plan" was to use the DTR line for the > timing (using the device manager's Control() call, and the > Assert/NegateDTR control values), but I'm not sure what else I can use for > the actual data transmission. > Is there an easy way to get access to the individual lines on the > serial port? Do I have to go through all the "fun" of writing my own > driver and/or delving into assembly code, or is there a way to use the > provided device calls to pull this off? > Any help and/or informtation is greatly appreciated. > > Greg > -- > andersoe@free@@@net.msp.mn.us Remove extra "@"s for real email > PGP 5.0 Public key available via finger > -----BEGIN GEEK CODE BLOCK----- > Version: 3.1 > GCS d- s+: a-- C+++$ UVHISX++$ P+++ L>+++ E+$ W++ N++ o+ K w---$ !O > M++$ !V-- PS PE !Y+ PGP++ t+ !5-- X++ !R tv+ b++ DI++++ D++ G++ e h-() r--* y+* > ------END GEEK CODE BLOCK------ > > ======http://www.pclink.com/torgo====== See http://www.mindspring.com/~jc1/serial/main.html Everything is there for RS 422 stuff. tom Please use f44 "at" ornl "dot" gov to reply. DO NOT use the posted address in the header--this is meant to bounce email back to SPAMMERS. Sorry, but these automated junk mailers have been bombarding my email. --------------------------- >From yairs@zoomorama.com (Yair Sageev) Subject: Speeding up concave polygon drawing... Date: Tue, 14 Oct 1997 16:49:22 -0400 Organization: Sony Research Labs We have found that the Mac polygon drawing routines are very, very slow. In fact the Windows 95 Poly routines are significantly faster than the Mac equivalents. Does anyone have any suggestions for improving polygon drawing speed? I have searched and have not been able to locate an algorithm that scan converts concave, self-intersecting polygons -- nor have I found a library that I can purchase to do so. Is it possible to fill in the Polygon structure manually? I suspect the main reason that the Mac poly routines are slower than the Windows counterparts is the whole OpenPoly():LineTo(),....:ClosePoly() approach. In Windows you merely pass the array of points to the API. I would be very happy to even avoid the LineTo() trap. Thanks, Yair -- Yair Sageev ___________ Macintosh C++ Developer Sony Research Laboratories +++++++++++++++++++++++++++ >From DavidO@dascorp.com (David Phillip Oster) Date: Tue, 14 Oct 1997 16:22:34 -0700 Organization: Digital Arts & Sciences Corp. In article , yairs@zoomorama.com (Yair Sageev) wrote: >Is it possible to fill in the Polygon structure manually? I suspect the >main reason that the Mac poly routines are slower than the Windows >counterparts is the whole OpenPoly():LineTo(),....:ClosePoly() approach. >In Windows you merely pass the array of points to the API. I don't think so. I am under the impression that Mac polygons are slow because the Mac converts all polygons to regions, processes the regions, then discards them, and does it again when you do your next polygon operation. Scan conversion of concave, self-intersecting polygons is in either Folly & van Dam, or Graphic Gems. Use Regions. Also, check out QuickDraw 3D, which is more polygon oriented than Quickdraw. -- -- 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 ram Subject: VBL programming Date: Wed, 15 Oct 1997 00:03:47 -0400 Organization: UMASS-Boston Computer Science Inside Macintosh Volume V says (p 566) "When [slot] interrupts occur for a particular video slot, the Vertical Retrace Manager executes any tasks in the queue for that slot" and later on the same page says "Slot interrupt handlers for video cards need to call the DoVBLTask function; this causes the Vertical Retrace Manager to execute any tasks in the queue for that slot." When I install a task with SlotVInstall, it seems to execute correctly without any call to DoVBLTask(). Is this an accident of my configuration (PowerMac 6100/60, System 7.5, built-in video) or do I really need to call DoVBLTask() within my task. (Perhaps the word "cards" is significant?) email replies would be appreciated. Bob Morris ram@cs.umb.edu +++++++++++++++++++++++++++ >From bradley@apple.com (Bob Bradley) Date: 15 Oct 1997 07:31:54 GMT Organization: Uh huh huh...It says Organ In article <344440A3.2E7F98EB@cs.umb.edu>, ram wrote: > Inside Macintosh Volume V says (p 566) "When [slot] interrupts occur for > a particular video slot, the Vertical Retrace Manager executes any tasks > in the queue for that slot" and later on the same page says "Slot > interrupt handlers for video cards need to call the DoVBLTask function; > this causes the Vertical Retrace Manager to execute any tasks in the > queue for that slot." > > When I install a task with SlotVInstall, it seems to execute correctly > without any call to DoVBLTask(). Is this an accident of my configuration > (PowerMac 6100/60, System 7.5, built-in video) or do I really need to > call DoVBLTask() within my task. (Perhaps the word "cards" is > significant?) SlotVInstall installs a VBL task, not an interrupt handler so you don't need to call DoVBLTask(). The note about calling DoVBLTask() was for those handling interrupts from a video card. When an interrupt occurred, the interrupt handler would call DoVBLTask() to execute any tasks (eg. your VBL task) in the VBL task queue. --------------------------- >From jaeho@xs4all.nl (Jae Ho Chang) Subject: Window Size Date: Tue, 07 Oct 1997 01:08:25 +0200 Organization: XS4ALL, networking for the masses The normal window in MacOS 8 has been changed also in its size (it is wider than before), since it has now draggable areas at the left, the right, and the bottom edges. This causes a small problem: My window class has a method that places a window to the right or to the bottom of another window. This method does not exactly calculate the window size, but instead, uses constants set for MacOS 7.x.x. So, this method does not place the window properly if the window is different from the normal window of MacOS 7. So I realized that I need to calculate the window size by refering the 'strucRgn' field of WindowRecord structure, for new windows in MacOS 8. It works quite well, as long as the window is visible(!). But mostly, it needs to be placed before the window is visible. In this situation, the method does not work at all. It seems that 'strucRgn' is built after the window gets visible. Do you have any idea how I can make this work? Thanks in advance, Jae Ho Chang =) -- http://www.xs4all.nl/~jaeho Institute of Sonology Royal Conservatory, The Hague +++++++++++++++++++++++++++ >From BHuey@nospam.att.net (Hugh Johnson) Date: Mon, 06 Oct 1997 21:35:02 -0600 Organization: Semplice In article , jaeho@xs4all.nl (Jae Ho Chang) wrote: > > So I realized that I need to calculate the window size by refering the > 'strucRgn' field of WindowRecord structure, for new windows in MacOS 8. It > works quite well, as long as the window is visible(!). > > But mostly, it needs to be placed before the window is visible. In this > situation, the method does not work at all. It seems that 'strucRgn' is > built after the window gets visible. > > Do you have any idea how I can make this work? This has been a problem with title bars for years, since some script use different system font point sizes and so some countries have wider title bars than others. So it's nothing new. The best solution has always been to create a visible window off in nowhere-land, like QuickDraw coordinates around 31000 by 31000. Just create a tiny window during your application's startup, tehn subtact the portRect from the bbox of the structRgn. Do this for each different window def that's important to you, and keep the info handy in globals. It's the only way. -- Hugh Johnson Replace "nospam" with "worldnet" --------------------------- >From briank@ctdnet.acns.nwu.edu (Guy Gizmo) Subject: [Q] Drawing regions really quickly. Date: Sat, 04 Oct 1997 11:49:09 -0400 Organization: I do computer work. Hi. Is there a way to draw regions really quickly? So far, it's only fast enough if the region is a rectangle. The less rectangular it is, the slower it takes to draw. And many of my regions that I need to draw quickly aren't rectangular. How could I get by this without buying a faster computer? Thanks in advance. Brian K. briank@ctdnet.acns.nwu.edu +++++++++++++++++++++++++++ >From "Seth Hill" Date: 4 Oct 97 12:36:09 -0700 Organization: All USENET -- http://www.Supernews.com On Sat, Oct 4, 1997 8:49 AM, Guy Gizmo wrote: > >Hi. > >Is there a way to draw regions really quickly? So far, it's only fast >enough if the region is a rectangle. The less rectangular it is, the >slower it takes to draw. And many of my regions that I need to draw >quickly aren't rectangular. How could I get by this without buying a >faster computer? > >Thanks in advance. > >Brian K. >briank@ctdnet.acns.nwu.edu > You could draw them into a gworld, then CopyBits() them where they need to go. I'd almost wager that this method would be faster than just drawing them to the screen (especially if you used a 1-bit gworld... RAM is faster than VRAM on my computer). It would definitely be faster if you had to draw the regions more than once, or if you had to do any scaling or colorizing (using CopyBits). _____________________________________________________________________ Seth Hill | ferris@proaxis.com Troposphere Software | http://www.proaxis.com/~ferris/software/ "What are we going to do tomorrow night, Brain?" "The same thing we do every night, Pinky - Try to take over the world!" -Pinky & the Brain --------------------------- >From mookie@best.com (Amandeep Jawa) Subject: [Q] How to Hide Applications Programmatically Date: Mon, 13 Oct 1997 02:34:56 -0700 Organization: Worker Bee software Hi folks, this should be simple but I'm not finding the answer in IM or on Devworld so I thought I'd ask here: How do I hide an application just like the Finder does when you choose "Hide XXXX" or "Hide Others" in the Finder's Process Menu? I'm sure there is an Apple Event I could send the Finder somewhere or a Process Manager call, but I can't find them. Any ideas? Thanks 'deep .ps Please email as well as post.... Thanks again.... - -- Amandeep Jawa Worker Bee Software 400 Dolores St. #2 San Francisco, CA 94110 for a complete waste of time: http://www.best.com/~mookie/ +++++++++++++++++++++++++++ >From gurgle@iname.com (Pete Gontier) Date: Sun, 19 Oct 1997 18:35:11 -0700 Organization: cellular In article , mookie@best.com (Amandeep Jawa) wrote: > How do I hide an application just like the Finder does when you choose > "Hide XXXX" or "Hide Others" in the Finder's Process Menu? I'm sure there > is an Apple Event I could send the Finder somewhere or a Process Manager > call, but I can't find them. Any ideas? Right now, the easiest way is AppleScript: tell application "Finder" set the visible of application process "Script Editor" to false end tell Translate this to C (or whatever you're writing in) and you're golden. I've been trying to get some whizzy new APIs released to the public for a few weeks now (I made some progress -- see the updated Mac OS 8 Technote) but a key individual in Engineering is concerned they might not be supportable into the indefinite future. Grrr. -- Pete Gontier, Integer Poet +++++++++++++++++++++++++++ >From sbryan@vendorsystems.com (Steve Bryan) Date: Mon, 20 Oct 1997 15:41:12 -0500 Organization: VSI In article , gurgle@iname.com (Pete Gontier) wrote: > In article , > mookie@best.com (Amandeep Jawa) wrote: > > > How do I hide an application just like the Finder does when you choose > > "Hide XXXX" or "Hide Others" in the Finder's Process Menu? I'm sure there > > is an Apple Event I could send the Finder somewhere or a Process Manager > > call, but I can't find them. Any ideas? > > Right now, the easiest way is AppleScript: > > tell application "Finder" > set the visible of application process "Script Editor" to false > end tell > > Translate this to C (or whatever you're writing in) and you're golden. > > I've been trying to get some whizzy new APIs released to the public for a > few weeks now (I made some progress -- see the updated Mac OS 8 Technote) > but a key individual in Engineering is concerned they might not be > supportable into the indefinite future. Grrr. > I've added source to my programs that allows AppleScript resources to be loaded and run. That makes Script Editor a useful adjunct for program development. The code is just adapted from some articles in 'develop': static ComponentInstance gScriptingComponent = NULL; #define kComponentNotFound -1 /********************************************************************** ** CheckGestaltOSA: return false if we can't load ***********************************************************************/ Boolean CheckGestaltOSA(void) { OSErr err = 0; long ascrAttr = 0; long ascrVers = 0; char ascrVersStr[24]; err = Gestalt('ascr', &ascrAttr); if (!err) { err = Gestalt('ascv', &ascrVers); } return (err == 0); } OSAError InitOSAScripting(void) { OSAError err = 0; ComponentDescription descr; Component aComponent; ProcessSerialNumber aSelfPSN; ComponentInstance aScriptingComponent; aSelfPSN.highLongOfPSN = 0; aSelfPSN.lowLongOfPSN = kCurrentProcess; //* Use this instead of GetCurrentProcess *// descr.componentType = kOSAComponentType; descr.componentSubType = (OSType) 0; descr.componentManufacturer = (OSType) 0; descr.componentFlags = kOSASupportsEventHandling; descr.componentFlagsMask = descr.componentFlags; aComponent = FindNextComponent(nil, &descr); if (!aComponent) return(kComponentNotFound); else { aScriptingComponent = OpenComponent(aComponent); if (!aScriptingComponent) return(kComponentNotFound); } gScriptingComponent = aScriptingComponent; return err; } /* Name : CloseOSAScripting Purpose : Shutdown of OSA scripting capabilities */ OSAError CloseOSAScripting(void) { OSAError err = noErr; if (gScriptingComponent) { err = CloseComponent(gScriptingComponent); gScriptingComponent = NULL; } return err; } // We are storing scripts in resource ID's 128 and 129 which turn on and off the listeners OSErr RunScript(short resID) { Handle h; AEDesc scriptData; OSErr err; OSAID theScriptID; OSAID resultID; h = GetResource(kOSAScriptResourceType, resID); err = ResError(); if (err == noErr) { scriptData.descriptorType = typeOSAGenericStorage; scriptData.dataHandle = h; err = OSALoad(gScriptingComponent, &scriptData, kOSAModeNull, &theScriptID); ReleaseResource(h); } if (err == noErr) err = OSAExecute(gScriptingComponent, theScriptID, kOSANullScript, kOSAModeNull, &resultID); return(err); } -- Steve Bryan sbryan@vendorsystems.com +++++++++++++++++++++++++++ >From jeremyr@0.0.0.0 (jeremyr) Date: 20 Oct 1997 20:31:09 GMT Organization: Queen Mary & Westfield College In article gurgle@iname.com (Pete Gontier) writes: > In article , > mookie@best.com (Amandeep Jawa) wrote: > > > How do I hide an application just like the Finder does when you choose > > "Hide XXXX" or "Hide Others" in the Finder's Process Menu? I'm sure there > > is an Apple Event I could send the Finder somewhere or a Process Manager > > call, but I can't find them. Any ideas? > > Right now, the easiest way is AppleScript: > > tell application "Finder" > set the visible of application process "Script Editor" to false > end tell > > Translate this to C (or whatever you're writing in) and you're golden. > But bear in mind that if the application you are trying to hide is the Finder itself, you need to alter the message to tell application "Finder" set visible to false end A small and subtle point, but important! Jeremy --------------------------- >From kennedy@cs.ucdavis.edu (Brian Kennedy) Subject: [Q] Modem or Printer Port ? Date: 9 Oct 1997 18:55:06 GMT Organization: UC Davis Hi All, I was wondering if someone could help me with a (hopefully :) simple question I have. Is there a way, programmatically ( is that the right spelling?) to determine if the modem is on the modem or printer port. Any help would be appreciated. Thanks a lot. Brian Kennedy +++++++++++++++++++++++++++ >From gurgle@iname.com (Pete Gontier) Date: Sat, 11 Oct 1997 14:55:07 -0700 Organization: cellular In article <61j9aa$44a$1@mark.ucdavis.edu>, kennedy@cs.ucdavis.edu (Brian Kennedy) wrote: > I was wondering if someone could help me with a (hopefully :) > simple question I have. Is there a way, programmatically ( is that the > right spelling?) to determine if the modem is on the modem or printer > port. Any help would be appreciated. Thanks a lot. One part of the Communications Toolbox is absolutely vital to serial programmers, and that is the Communications Resource Manager. It allows you to enumerate all the serial drivers in the system and get their names and icons so that the user can choose which port to use. Unfortunately, "Inside The Macintosh Communications Toolbox" was never turned into a "soft" version which could be posted onto the web, and, despite my pointed investigations internally, probably never will be. Your only choice is to find a copy of it printed on paper. Here's one retail source of the paper version: After you deal with the list of available ports, you're pretty much on your own. I'd start by sending an "ATZ" command to the (potential) modem to see if anybody is out there and willing to respond with an "OK". If not, try "AT&F" and see if that produces any jollies. If you want to detect modems which might already have a connection, you might need to mess with "+++". What a pain modems are... -- Pete Gontier, Integer Poet +++++++++++++++++++++++++++ >From DavidO@dascorp.com (David Phillip Oster) Date: Tue, 14 Oct 1997 16:40:13 -0700 Organization: Digital Arts & Sciences Corp. In article , gurgle@iname.com (Pete Gontier) wrote: >One part of the Communications Toolbox is absolutely vital to serial >programmers, and that is the Communications Resource Manager. It allows >you to enumerate all the serial drivers in the system and get their names >and icons so that the user can choose which port to use. > >Unfortunately, "Inside The Macintosh Communications Toolbox" was never >turned into a "soft" version which could be posted onto the web, and, >despite my pointed investigations internally, probably never will be. Your >only choice is to find a copy of it printed on paper. Here's one retail >source of the paper version: > > gtsumt?source=&isbn=0201577755> Here is all you need to know from Communications Resource Manager. Enclosed is a complete sample program to find the names, suitable for passing to OpenDriver(), of all the serial ports on your system. Other fields of the record give names and icons suitable for showing to a user. /* main.c - Using Connection Resource Manager, print all the portnames. */ #include #include #include #define Length(s) ((int) (s)[0]) main() { CRMRecPtr crp; CRMRec crm; CRMSerialPtr csp; StringPtr s; FILE *out; InitCRM(); crm.qLink = NULL; crm.qType = crmType; crm.crmVersion = crmRecVersion; crm.crmPrivate = 0; crm.crmReserved = 0; crm.crmDeviceType = crmSerialDevice; crm.crmDeviceID = 0; crm.crmAttributes = 0; crm.crmStatus = 0; crm.crmRefCon = 0; crp = &crm; if(NULL == (out = fopen("log", "w"))){ return -1; } while(NULL != (crp = CRMSearch(crp))){ if(NULL != (csp = (CRMSerialPtr) crp->crmAttributes)){ if(NULL != (s = *csp->inputDriverName)){ fprintf(out, "\"%.*s\"\n", Length(s), &s[1]); } if(NULL != (s = *csp->outputDriverName)){ fprintf(out, "\"%.*s\"\n", Length(s), &s[1]); } } } return 0; } -- -- Warning: posted from an unlocked cubicle: no guarantee its really me. "A proud member of the International Jewish Conspiracy, since 3760 BCE, the original FAMILY-OWNED international conspiracy." _ zionelders@ijc.org --------------------------- >From lantos@ecf.toronto.edu (David Lantos) Subject: communicating with internal PB modem Date: Sun, 12 Oct 1997 23:13:53 GMT Organization: University of Toronto, Engineering Computing Facility How can I write code that communicates with my internal PowerBook modem? I've looked through the 'Inside Macintosh' Device Manager routines, and the description of 'OpenDriver()' says: " ...Refer to a device driver's documentation to determine the driver name..." My PowerBook has the "Apple PowerBook Modem Tool" installed on it (I think this is a driver), and that's the software I'd like to talk with. How can I find documentation on it? Apple must've already written high-level modem routines which I could use, but I don't know where to look. I'm quite new to this, so sorry if this is a dumb question... - lantos +++++++++++++++++++++++++++ >From DavidO@dascorp.com (David Phillip Oster) Date: Tue, 14 Oct 1997 16:42:58 -0700 Organization: Digital Arts & Sciences Corp. In article , ronm@teleport.com (Ron W. Miller) wrote: >In article , lantos@ecf.toronto.edu (David >Lantos) wrote: > >> How can I write code that communicates with my internal PowerBook modem? >> I've looked through the 'Inside Macintosh' Device Manager routines, and >> the description of 'OpenDriver()' says: >> >> " ...Refer to a device driver's documentation to determine >> the driver name..." >> >> My PowerBook has the "Apple PowerBook Modem Tool" installed on it (I think >> this is a driver), and that's the software I'd like to talk with. How can >> I find documentation on it? Apple must've already written high-level >> modem routines which I could use, but I don't know where to look. I'm >> quite new to this, so sorry if this is a dumb question... >> >Yes, > >Apple has written a high-level API called "Communications Toolbox". It >doesn't have an IM volume dedicated to it, but a printed copy can be >purchased somewhere online( I saw a URL for it somewhere, anyone have the >URL? ). Using the Commtoolbox will make it easier for you to write your >code with a lower level of knowledge for the internal workings of the >serial ports. Here is how you use Comm Toolbox to find out the names of the serial ports to pass to OpenDriver(): /* main.c - Using Connection Resource Manager, print all the portnames. */ #include #include #include #define Length(s) ((int) (s)[0]) main() { CRMRecPtr crp; CRMRec crm; CRMSerialPtr csp; StringPtr s; FILE *out; InitCRM(); crm.qLink = NULL; crm.qType = crmType; crm.crmVersion = crmRecVersion; crm.crmPrivate = 0; crm.crmReserved = 0; crm.crmDeviceType = crmSerialDevice; crm.crmDeviceID = 0; crm.crmAttributes = 0; crm.crmStatus = 0; crm.crmRefCon = 0; crp = &crm; if(NULL == (out = fopen("log", "w"))){ return -1; } while(NULL != (crp = CRMSearch(crp))){ if(NULL != (csp = (CRMSerialPtr) crp->crmAttributes)){ if(NULL != (s = *csp->inputDriverName)){ fprintf(out, "\"%.*s\"\n", Length(s), &s[1]); } if(NULL != (s = *csp->outputDriverName)){ fprintf(out, "\"%.*s\"\n", Length(s), &s[1]); } } } return 0; } -- -- Warning: posted from an unlocked cubicle: no guarantee its really me. "A proud member of the International Jewish Conspiracy, since 3760 BCE, the original FAMILY-OWNED international conspiracy." _ zionelders@ijc.org +++++++++++++++++++++++++++ >From ronm@teleport.com (Ron W. Miller) Date: 14 Oct 1997 00:58:37 GMT Organization: Twilight Zone Software In article , lantos@ecf.toronto.edu (David Lantos) wrote: > How can I write code that communicates with my internal PowerBook modem? > I've looked through the 'Inside Macintosh' Device Manager routines, and > the description of 'OpenDriver()' says: > > " ...Refer to a device driver's documentation to determine > the driver name..." > > My PowerBook has the "Apple PowerBook Modem Tool" installed on it (I think > this is a driver), and that's the software I'd like to talk with. How can > I find documentation on it? Apple must've already written high-level > modem routines which I could use, but I don't know where to look. I'm > quite new to this, so sorry if this is a dumb question... > > - lantos Yes, Apple has written a high-level API called "Communications Toolbox". It doesn't have an IM volume dedicated to it, but a printed copy can be purchased somewhere online( I saw a URL for it somewhere, anyone have the URL? ). Using the Commtoolbox will make it easier for you to write your code with a lower level of knowledge for the internal workings of the serial ports. Ron W. Miller -- =============================== Ron W. Miller Twilight Zone Software ronm@teleport.com Contract Software Developer Macintosh and Microsoft Windows =============================== --------------------------- >From Tim Lovelock Subject: copying from serial port Date: Wed, 01 Oct 1997 02:38:12 -0400 Organization: Yale University Hi, I was looking for an application (hopefully) or a hint on how to go about scripting or programing something that would monitor the serial port for and automatically copy any text strings that came in through the serial port so that they could be easily pasted into another application. Any thoughts would be great. Thanks, Tim +++++++++++++++++++++++++++ >From sdm7g@elvis.med.Virginia.EDU (Steven D. Majewski) Date: 2 Oct 1997 19:49:28 GMT Organization: University of Virginia In article <3431EFD3.21B5CD7B@panetheon.yale.edu>, Tim Lovelock wrote: >Hi, > >I was looking for an application (hopefully) or a hint on how to go >about scripting or programing something that would monitor the serial >port for and automatically copy any text strings that came in through >the serial port so that they could be easily pasted into another >application. > >Any thoughts would be great. There is a communications toolbox module for Python. I've never used the communications toolbox, so I don't know exactly how to do this, but it should be able to be done. There is also AppleEvents support in MacPython, so you may be able to do the pasting into a scriptable application. - - I've also got a very crude first hack at a device mgr. module for Python. It supports the high-level routines: OpenDriver,CloseDriver,Status,Control,KillIO*,FSRead,FSWrite (* I have been able to crash my Mac into the macsbug by doing a KillIO under certain circumstances, but I'm thinking that may be because KillIO is an Immediate driver call and the driver may not be reentrant. ) And experimentally, a StatusImmed & ControlImmed call. PBRead and PBWrite are in there, but I haven't wrapped up a parameter block struct interface yet. ( Should have async reads and write when that's done. ) I'm doing this for an interface to a custom device, but I'm starting with generic device support so I can test the code without that board in my Mac. Without the async support, the best you can do is to poll for chars available with csCode=2. The following seems to work. import struct def toint( str ): return struct.unpack( 'i', str[:4] )[0] def charsAvail( refno ): return toint( Status( refno, 2 )) ain = OpenDriver( '.Ain' ) while 1: n = charsAvail( ain ) if n: data = FSRead( ain, n ) # do something with data I'll post the sources and a plugin when it's finished, but if you're desperate for it immediately ( or like living dangerously ), let me know. BTW: SWIG is a nice tool to help automate the glue-code generation needed to make arbitrary C code into Python/Perl/Tcl/et.al. callable extensions. - -| Steven D. Majewski (804-982-0831) |--- - -| Department of Molecular Physiology and Biological Physics |--- - -| University of Virginia Health Sciences Center |--- - -| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- All power corrupts and obsolete power corrupts obsoletely." - Ted Nelson --------------------------- >From jstrout@ucsd.edu (Joseph J. Strout) Subject: custom boot disk-micro OS? Date: Wed, 15 Oct 1997 08:16:31 -0700 Organization: UCSD In the old days of the Apple II and IIGS, clever developers used to ship their wares (especially games) on a bootable disk with a custom DOS. You'd put the disk in, turn the computer on, and poof! it would load instantly, and work flawlessly, because the programmers didn't have to worry about your software configuration. You pretty much never see this in the Mac world, but it should still be doable in principle. It's a bit trickier because hardware varies a bit, but it shouldn't be impossible. What would it take to make a CD-ROM that could be inserted into any PowerMac (or at least, a certain class of PowerMacs), and upon booting the machine, would take control of the monitor, keyboard, and CPU without any MacOS (or BeOS) in sight? Has anyone (besides Be) ever tried this, or considered trying it? Thanks, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Department of Neuroscience, UCSD | | jstrout@ucsd.edu http://www-acs.ucsd.edu/~jstrout/ | `------------------------------------------------------------------' +++++++++++++++++++++++++++ >From shanks@yallara.cs.rmit.edu.au (Vaughan) Date: 16 Oct 1997 03:31:38 GMT Organization: Comp Sci, RMIT University, Melbourne, Australia. Joseph J. Strout (jstrout@ucsd.edu) wrote: : : What would it take to make a CD-ROM that could be inserted into any : PowerMac (or at least, a certain class of PowerMacs), and upon booting the : machine, would take control of the monitor, keyboard, and CPU without any : MacOS (or BeOS) in sight? Has anyone (besides Be) ever tried this, or : considered trying it? There's an OS called QNX, (which as far as I'm aware only runs on i386 family machines), which fits on a 1.4Mb floppy and has a complete windowing system, an editor and a web browser. I know a guy who has a copy of this, but being a Mac man myself, have not tried it out. This is possibly irrelevant to your question, but I thought I'd share it with you anyway. Vaughan :-) +++++++++++++++++++++++++++ >From Ansgar Esztermann Date: Thu, 16 Oct 1997 11:10:03 +0200 Organization: Heinrich Heine Universitaet Duesseldorf Joseph, > What would it take to make a CD-ROM that could be inserted into any > PowerMac (or at least, a certain class of PowerMacs), and upon booting the > machine, would take control of the monitor, keyboard, and CPU without any > MacOS (or BeOS) in sight? Has anyone (besides Be) ever tried this, or > considered trying it? There are rumours of a certain "Crypto-OS" which is cheap, reliable, and is certified by the US FDD (I am not quite sure, though) as being quite safe against hacking. This sounds a bit incredible, but there is a short notice in the "c't", a serious computer journal that usually publishes only reliable information. Ansgar --------------------------- >From dougn@agilent.com (Doug Norton) Subject: network PBRead slow in OS8 Date: Fri, 10 Oct 1997 13:41:19 -0500 Organization: Agile I am wondering if anyone else has noticed a speed difference in sync PBReads over a network. I have measured the difference running on the same machine using 7.5.3 and 8.0 and I have measured anywhere from 2 - 3 times slow down. These are random file pos reads within a single file. Thanks for any info. -doug - ---------------------- Doug Norton Agile Enterprise, Inc 402 Amherst St Nashua, NH 03063 dougn@agilent.com +++++++++++++++++++++++++++ >From jum@anubis.han.de (Jens-Uwe Mager) Date: Sat, 11 Oct 1997 23:17:00 GMT Organization: At Home In article , dougn@agilent.com (Doug Norton) wrote: > I am wondering if anyone else has noticed a speed difference in sync > PBReads over a network. I have measured the difference running on the > same machine using 7.5.3 and 8.0 and I have measured anywhere from 2 - 3 > times slow down. These are random file pos reads within a single file. This should be fixed in the AppleShare client 3.7.2, you can find a beta at appleshareip.apple.com. -- Jens-Uwe Mager --------------------------- End of C.S.M.P. Digest **********************