From: owner-csmp@ugrad.ece.mcgill.ca Subject: csmp digest Vol 4 No 050 C.S.M.P. Digest Sat, 07 Mar 98 Volume 4 : Issue 50 Today's Topics: 32K Limit, Any work arounds? Appearance Manager Floating Windows with TransSkel? Hacking PowerPC block in application heap ->" Joy!peffpwpc"... Help! I am trying to launch another app from my app Mac SCSI Trap? Making Plug-Ins Safe way to set orientation in print record? local volume or mounted volume? 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 ae897@FreeNet.Carleton.CA (Jeremy Wise) Subject: 32K Limit, Any work arounds? Date: 20 Feb 1998 01:23:38 GMT Organization: The National Capital FreeNet Are there any work arounds to get around the 32K tlimit enforced by Apple's TextEdit??? Is this a simple thing to do, or does it involve a complete rewrite? -- Jeremy Wise +++++++++++++++++++++++++++ >From dtp@pluto.njcc.com (David T. Pierson) Date: Fri, 20 Feb 1998 00:12:27 -0500 Organization: New Jersey Computer Connection, Lawrenceville, NJ In article <6ciluq$4q8@freenet-news.carleton.ca>, ae897@FreeNet.Carleton.CA (Jeremy Wise) wrote: > Are there any work arounds to get around the 32K tlimit enforced by > Apple's TextEdit??? Use WASTE http://www.boingo.com/waste/ HTH, David +++++++++++++++++++++++++++ >From spam@blah.blah.blah.in.sig (John C Daub) Date: Fri, 20 Feb 1998 10:24:57 -0600 Organization: Metrowerks Corporation In article <6ciluq$4q8@freenet-news.carleton.ca>, ae897@FreeNet.Carleton.CA (Jeremy Wise) wrote: >Are there any work arounds to get around the 32K tlimit enforced by >Apple's TextEdit??? > >Is this a simple thing to do, or does it involve a complete rewrite? Yea, don't use TextEdit ;-) CHeck out something like WASTE, freeware from Marco Piovanelli. I think :) WASTE is fabulous, and for the price, can't be beat. And it tries to stay close to the TextEdit model, so it's not too hard to convert your TextEdit-based code over. And there is a mailing list for WASTE users that can help out with any problems you can have. There are other TextEdit replacements... but well, I like the free ones ;-) -- - -------------------------------------------------------------------- John C. Daub Metrowerks Engineering Operations --------------------------- >From Kim Foo-Jones Subject: Appearance Manager Date: Thu, 19 Feb 1998 13:17:13 +0000 Organization: (none) I tried to use the call RegisterAppearanceClient in my PPC project but I get a link error: undefined:RegisterAppearanceClient (). I have included I rememeber having a similar problem tying to use SBControlStripIsVisible a while ago and someone pointed me to controlStripGlue.h which fixed the problem. Do I need something similar and where can I get it? Also, I'm guessing that SBControlStripIsVisible will fail on machines that don't have the control strip control panel installed. Should I use a gestalt call or check for an undefined trap to test for the availability of the call? Thanks for any help, -Kim +++++++++++++++++++++++++++ >From ammon@cs.byu.edu (Ammon Skidmore) Date: Thu, 19 Feb 1998 09:32:41 -0700 Organization: Brigham Young University In article <34EC30D6.C1E8FD3E@foo-jones.demon.co.uk>, Kim Foo-Jones wrote: > I tried to use the call RegisterAppearanceClient in my PPC project but I > get a link error: undefined:RegisterAppearanceClient (). Sounds like you need a shared library, but I dunno which one. > I rememeber having a similar problem tying to use > SBControlStripIsVisible a while ago and someone pointed me to > controlStripGlue.h which fixed the problem. Do I need something similar > and where can I get it? > > Also, I'm guessing that SBControlStripIsVisible will fail on machines > that don't have the control strip control panel installed. Should I use > a gestalt call or check for an undefined trap to test for the > availability of the call? To see if COntrol Strip is running check if the following returns noErr: Gestalt(gestaltControlStripAttr, &response) -Ammon +++++++++++++++++++++++++++ >From aard@shell5.ba.best.com (Anthony C. Ard) Date: 19 Feb 1998 11:46:12 -0800 Organization: (none) Kim Foo-Jones writes: > > I tried to use the call RegisterAppearanceClient in my PPC project but I > get a link error: undefined:RegisterAppearanceClient (). > > I have included > [...] > > Thanks for any help, > > -Kim You also need to link with "AppearanceLib". If you're using MPW it'll be "{SharedLibraries}AppearanceLib". If you're using the other development environment it'll be in ":Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:". I suggest getting the Appearance 1.0.2 SDK from , though, to make sure you've got the newest version. By they way, you can get updated Appearance Manager documentation from ---it was just posted this week. If you plan on using contextual menus, beware. You'll need the contextual menu SDK which, last time I checked, was not available along with the other SDKs on . It was a little tricky to find, and now I can't remember where I did find it! The Appearance Manager documentation (ToolBoxRefBook.pdf) seems to imply that the contextual menu functions are in AppearanceLib. They aren't. Good luck! -- Anthony C. Ard "Wouldn't you rather be involved in a series of colorful, time-wasting trends?" -- Frank Zappa, Greggery Peccary. +++++++++++++++++++++++++++ >From drysdallSPAMFREE@waikato.ac.nz (Richard Drysdall) Date: Fri, 20 Feb 1998 10:43:41 +1200 Organization: University of Waikato In article <59g1lfidiz.fsf@shell5.ba.best.com>, aard@shell5.ba.best.com (Anthony C. Ard) wrote: [ snip ] >By they way, you can >get updated Appearance Manager documentation from >---it was just posted this week. I must be thick or something - I can't find these docs. Can anyone post a complete URL? Thanks. -- 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 aard@shell5.ba.best.com (Anthony C. Ard) Date: 19 Feb 1998 15:50:32 -0800 Organization: (none) Greetings, drysdallSPAMFREE@waikato.ac.nz (Richard Drysdall) writes: > [...] > I must be thick or something - I can't find these docs. Can anyone post a > complete URL? > > Thanks. > > -- > Richard Drysdall, University of Waikato, New Zealand No, you're not thick---all of the Apple Developer stuff is somewhat scattered around Apple's servers. It just takes some hunting. :-) You can get to the new Appearance documentation via . Also, technotes #1102 (MacOS 8) and #1121 (MacOS 8.1) are pretty handy and are at . -- Anthony C. Ard "Wouldn't you rather be involved in a series of colorful, time-wasting trends?" -- Frank Zappa, Greggery Peccary. +++++++++++++++++++++++++++ >From online@mactech.com (Jeff at MacTech) Date: Thu, 19 Feb 1998 19:39:21 -0700 Organization: MacTech Magazine In article <34EC30D6.C1E8FD3E@foo-jones.demon.co.uk>, Kim Foo-Jones wrote: >I tried to use the call RegisterAppearanceClient in my PPC project but I >get a link error: undefined:RegisterAppearanceClient (). > >I have included > >I rememeber having a similar problem tying to use >SBControlStripIsVisible a while ago and someone pointed me to >controlStripGlue.h which fixed the problem. Do I need something similar >and where can I get it? An important point is that headers contain prototypes and libraries contain code (which you probably already know). The upshot is that if you've forgotten to #include a header, then you'll get an "undefined function" error (compiler error) and if you've forgotten to include the right library in your project you'll get an error complaining about missing code (linker error). I just thought I'd point this out because it confused me once also. >Also, I'm guessing that SBControlStripIsVisible will fail on machines >that don't have the control strip control panel installed. Should I use >a gestalt call or check for an undefined trap to test for the >availability of the call? Not only will it fail--it will probably crash. (I think someone else posted the necessary gestalt call.) I hope this helps. -- __________________________________________________________________________ Jeff Clites Online Editor http://www.MacTech.com/ online@MacTech.com MacTech Magazine __________________________________________________________________________ +++++++++++++++++++++++++++ >From jayfar@netaxs.com (Jayfar) Date: Thu, 19 Feb 1998 23:34:15 -0500 Organization: Jayfar's Original Virtual Macintosh In article , drysdallSPAMFREE@waikato.ac.nz wrote: | In article <59g1lfidiz.fsf@shell5.ba.best.com>, aard@shell5.ba.best.com | (Anthony C. Ard) wrote: | | [ snip ] | | >By they way, you can | >get updated Appearance Manager documentation from | >---it was just posted this week. | | I must be thick or something - I can't find these docs. Can anyone post a | complete URL? Jayfar -- Jay Farrell Jayfar's Original Virtual Macintosh jayfar@netaxs.com * Your Favorite Mac Site * Now Updated Daily * Philadelphia, USA --------------------------- >From cps@access.digex.net (Chris Smolinski) Subject: Floating Windows with TransSkel? Date: Sun, 15 Feb 1998 17:49:49 -0500 Organization: DIGEX, Inc. Anyone have some source code that shows how to implement floating windows when using the TransSkel skeleton? Thanks, Chris -- Check out my web pages for radio (pirate, spy numbers) and Mac software. http://www.access.digex.net/~cps "One if by land, two if by sea" -- Paul Revere, encryption 1775 +++++++++++++++++++++++++++ >From ejensen@unbc.ca (Erik Jensen) Date: Sun, 15 Feb 1998 21:34:38 -0800 Organization: University of Northern B.C. In article , cps@access.digex.net (Chris Smolinski) wrote: >Anyone have some source code that shows how to implement floating windows >when using the TransSkel skeleton? > >Thanks, > >Chris > Hi, I don't think that there is an easy way to do this. The current implementation of TransSkel doesn't have the necessary window management features to easily allow floating windows. It would not be impossible to add these features given some floating window schemes (eg. the one outlined in Develop). If I was a C programmer I might have a go at it. This was one reason I opted to change over to ToolsPlus for an easy to use application framework. There are other frameworks out there and some may do floating windows (most these days seem to be of the C++ variety though). Erik. _________________________________________________________________________ Dr. Erik Jensen email: ejensen@unbc.ca Physics Programme tel.: (250) 960-6463 University of Northern B.C. fax: (250) 960-5545 3333 University Way Prince George B.C. Canada _________________________________________________________________________ +++++++++++++++++++++++++++ >From online@mactech.com (Jeff at MacTech) Date: Mon, 16 Feb 1998 01:39:04 -0700 Organization: MacTech Magazine In article , ejensen@unbc.ca (Erik Jensen) wrote: >In article , >cps@access.digex.net (Chris Smolinski) wrote: > >>Anyone have some source code that shows how to implement floating >>windows when using the TransSkel skeleton? > >I don't think that there is an easy way to do this. The current >implementation of TransSkel doesn't have the necessary window management >features to easily allow floating windows. It would not be impossible to >add these features given some floating window schemes (eg. the one >outlined in Develop). If I was a C programmer I might have a go at it. >This was one reason I opted to change over to ToolsPlus > for an easy to use application >framework. There are other frameworks out there and some may do floating >windows (most these days seem to be of the C++ variety though). MacZoop is C++ but it is free and does floating windows effortlessly: http://www.warwick.ac.uk/~corbe/MacZoop/MacZoop.html (Effortlessly = use ResEdit to choose the window style which looks like a floater and they will float automatically.) __________________________________________________________________________ Jeff Clites Online Editor http://www.MacTech.com/ online@MacTech.com MacTech Magazine __________________________________________________________________________ --------------------------- >From abz@videotron.ca (Alain Birtz) Subject: Hacking PowerPC block in application heap ->" Joy!peffpwpc"... Date: Sun, 15 Feb 1998 14:07:54 GMT Organization: Cegep St-Hyacinthe College After some look in the block of application heap, I found this: A block of PowerPC code in the application zone begin by "Joy!peffpwpc" The long word at the offset 48 (0x30) from the beginning of the block is the size of the code. This size is repeated 3 time (at offset 48, 52, 56). Just after that, at offset 60 (0x3C), there is a long word that is the offset (from the beginning of the block) where the PowerPC code begin. Where can I get information about the other fields in PowerPC block ? Please, send me a copy of your answer by email. Thank you. -- Alain Birtz Cegep St-Hyacinthe College CompuServe [72467,2770] Internet abz@prisco.net +++++++++++++++++++++++++++ >From rang@trillium.adaptec.com (Anton Rang) Date: Wed, 18 Feb 1998 14:24:02 -0600 Organization: Adaptec Trillium Development Center In article , abz@videotron.ca (Alain Birtz) wrote: > After some look in the block of application heap, I found this: > > A block of PowerPC code in the application zone begin by "Joy!peffpwpc" > The long word at the offset 48 (0x30) from the beginning of the block > is the size of the code. This size is repeated 3 time (at offset 48, 52, 56). > Just after that, at offset 60 (0x3C), there is a long word that is the > offset (from the beginning of the block) where the PowerPC code begin. > > Where can I get information about the other fields in PowerPC block ? > > Please, send me a copy of your answer by email. Somewhere on Apple's developer world site is a document describing the PEF (PowerPC Executable Format). I think you need to go through a license page to get to it (agreeing to proper uses, or some such). If you go to and search for PEF or Executable Format, hopefully it will become obvious. Hope this helps, Anton +++++++++++++++++++++++++++ >From jayfar@netaxs.com (Jayfar) Date: Thu, 19 Feb 1998 02:54:08 -0500 Organization: Jayfar's Original Virtual Macintosh In article , rang@trillium.adaptec.com (Anton Rang) wrote: | In article , | wrote: | > After some look in the block of application heap, I found this: | > | > A block of PowerPC code in the application zone begin by "Joy!peffpwpc" | > The long word at the offset 48 (0x30) from the beginning of the block | > is the size of the code. This size is repeated 3 time (at offset 48, 52, 56). | > Just after that, at offset 60 (0x3C), there is a long word that is the | > offset (from the beginning of the block) where the PowerPC code begin. | > | > Where can I get information about the other fields in PowerPC block ? | > | > Please, send me a copy of your answer by email. | | Somewhere on Apple's developer world site is a document describing the PEF | (PowerPC Executable Format). I think you need to go through a license | page to get to it (agreeing to proper uses, or some such). If you go to | and search for PEF or Executable Format, | hopefully it will become obvious. It used to be confidential stuff, but the PEF specs are now freely available in a PDF document, "Mac OS Runtime Architectures." Cheers, Jayfar -- Jay Farrell Jayfar's Original Virtual Macintosh jayfar@netaxs.com * Your Favorite Mac Site * Now Updated Daily * Philadelphia, USA --------------------------- >From Robert Ciacchella Subject: Help! I am trying to launch another app from my app Date: Sun, 15 Feb 1998 21:05:42 -0800 Organization: IDT HI, I am trying to launch an app from my application but with the addition of having that other application start with a particular document opened. For example, my application wants to luanch another app named "MyApp" with the document "MyApp's document" opened. (The effect would be like double clicking on MyApp's document", where MyApp starts up and then opens "MyApp's document") I have gotten to a point where my app can launch another app using the LaunchApplication() function. The only problem is that I do not know how to launch this application where it loads a specified document upon starting. I have a strong feeling I need to be using Apple Events. ???? Thanks for the help -rac +++++++++++++++++++++++++++ >From dtp@pluto.njcc.com (David T. Pierson) Date: Mon, 16 Feb 1998 11:17:55 -0500 Organization: New Jersey Computer Connection, Lawrenceville, NJ It is easier to simply send the finder an open document event with "MyApp's document" as the direct object. This assumes that the document has MyApp's creator code. When the finder gets this event, it behaves exactly as if the document's icon had been double-clicked, as you would like. No need to mess with LaunchApplication. Here is some code that will send the AE to the Finder. You supply it with a valid Alias. See Ch 4 of IM:Files http://devworld.apple.com/dev/techsupport/insidemac/Files/Files-340.html#HEADING340-0 to learn how to create an AliasHandle from a FSSpec or a full path. HTH, David Here's the code: >>>>> void SendAliasToFinder( AliasHandle inAliasHandle ) { AEDesc theAliasDesc = {typeNull, NULL}; AEAddressDesc targetDesc = {typeNull, NULL}; AppleEvent event = {typeNull, nil}; AppleEvent reply = {typeNull, nil}; OSErr err = noErr; //create a desc for the alias err = ::AECreateDesc( typeAlias, *inAliasHandle, (**inAliasHandle).aliasSize, &theAliasDesc ); if ( err ) goto CLEANUP_SendAlias; //create a desc for the target app OSType appSignature = 'MACS'; //finder's signature err = ::AECreateDesc( typeApplSignature, &appSignature, sizeof( OSType ), &targetDesc ); if ( err ) goto CLEANUP_SendAlias; //create apple event err = ::AECreateAppleEvent( kCoreEventClass, kAEOpenDocuments, &targetDesc, kAutoGenerateReturnID, kAnyTransactionID, &event ); if ( err ) goto CLEANUP_SendAlias; //insert direct object into ae err = ::AEPutParamDesc( &event, keyDirectObject, &theAliasDesc ); if ( err ) goto CLEANUP_SendAlias; //send ae err = ::AESend( &event, &reply, kAENoReply + kAENeverInteract + kAECanSwitchLayer, kAENormalPriority, kAEDefaultTimeout, kNoIdleProc, kNoFilterProc ); //dispose descriptors CLEANUP_SendAlias:; ::AEDisposeDesc (&event); ::AEDisposeDesc (&reply); ::AEDisposeDesc (&theAliasDesc); ::AEDisposeDesc (&targetDesc); } //end SendAliasToFinder function +++++++++++++++++++++++++++ >From online@mactech.com (Jeff at MacTech) Date: Mon, 16 Feb 1998 08:53:35 -0700 Organization: MacTech Magazine In article <34E7C91F.73AD@pop3.idt.net>, rac9@idt.net wrote: >I am trying to launch an app from my application but with the addition >of having that other application start with a particular document >opened. For example, my application wants to luanch another app named >"MyApp" with the document "MyApp's document" opened. (The effect would >be like double clicking on MyApp's document", where MyApp starts up and >then opens "MyApp's document") > >I have gotten to a point where my app can launch another app using the >LaunchApplication() function. The only problem is that I do not know how >to launch this application where it loads a specified document upon >starting. I have a strong feeling I need to be using Apple Events. ???? Apple has a technote called something like "On Launching an Application with a Document" which will tell you all you need to know. The short of it is that you still use LaunchApplication but you stuff in another parameter describing the doc to open upon launch; this parameter gets built from an AppleEvent-related data structure. If you have trouble finding the technote, email me and I will see if I can find a specific reference. __________________________________________________________________________ Jeff Clites Online Editor http://www.MacTech.com/ online@MacTech.com MacTech Magazine __________________________________________________________________________ --------------------------- >From Nima Montaser Subject: Mac SCSI Trap? Date: Wed, 11 Feb 1998 15:58:14 -0500 Organization: Nortel Hi, I am trying to find the address of Mac's SCSI dispatcher routine. So far, I have been able to find the following: SCSI dispatcher is instruction 000AD902, which the first low word translates to an illegal instruction (ori.b on a register) which I assume causes an exception, hence the trap. I am not sure if I am off, but I have no mac programming experience (today is my second day!) So, now I would like to know how this gets handled: i.e., what is the SCSI Dispatcher service routine address or how to find it? I need to apply a patch, so if anybody has already done so, I would appreciate it if you could tell me. Basically, I need to find out each SCSI command that is sent to the SCSI bus/dispatcher. Thank you in advance. -- NOTE: Remove DEATHTOSPAM at the end of the email address in order to reply. Thank you. ******************************************************************* My opinions are strictly my own, and not that of my employer! ******************************************************************* +++++++++++++++++++++++++++ >From bradley@apple.com (Bob Bradley) Date: Wed, 11 Feb 1998 17:06:55 -0800 Organization: Uh huh huh...It says Organ In article <34E210E6.2315@nortel.ca.DEATHTOSPAM>, Nima Montaser wrote: > I am trying to find the address of Mac's SCSI dispatcher routine. > So far, I have been able to find the following: > SCSI dispatcher is instruction 000AD902, which the first low word > translates to an illegal instruction (ori.b on a register) which I > assume causes an exception, hence the trap. The trap is: _SCSIAtomic = 0xA089 +++++++++++++++++++++++++++ >From larrysb@aol.com (LarrySB) Date: 12 Feb 1998 17:50:46 GMT Organization: AOL http://www.aol.com <<<< Hi, I am trying to find the address of Mac's SCSI dispatcher routine. So far, I have been able to find the following: SCSI dispatcher is instruction 000AD902, which the first low word translates to an illegal instruction (ori.b on a register) which I assume causes an exception, hence the trap. I am not sure if I am off, but I have no mac programming experience (today is my second day!) So, now I would like to know how this gets handled: i.e., what is the SCSI Dispatcher service routine address or how to find it? I need to apply a patch, so if anybody has already done so, I would appreciate it if you could tell me. Basically, I need to find out each SCSI command that is sent to the SCSI bus/dispatcher. >>>>>> Whooooa. Slow down. You are going to get yourself in deep doodoo pretty quick. First off, the trap dispatch system is a feature of the 68k runtime. Those patches you are going to apply will probably get in the way of the PowerPC runtime call dispatch. At the very least it is going to slow you down. What are you are trying to intercept? -- Dr. Nuketopia Read the Blue Glow in Tubes FAQ at http://www.persci.com/~larrysb for all you spammers: Chair: Reed Hundt, rhundt@fcc.gov; Commissioners: James Quello, jquello@fcc.gov; Susan Ness, sness@fcc.gov; Rachelle Chong, rchong@fcc.gov +++++++++++++++++++++++++++ >From bhahn@spam-spam.go-away.com (Brendan Hahn) Date: Fri, 20 Feb 1998 11:17:21 -0800 Organization: Transoft Corp Nima Montaser wrote: >Hi, > I am trying to find the address of Mac's SCSI dispatcher routine. >So far, I have been able to find the following: >SCSI dispatcher is instruction 000AD902, which the first low word >translates to an illegal instruction (ori.b on a register) which I >assume causes an exception, hence the trap. >I am not sure if I am off, but I have no mac programming experience >(today is my second day!) >So, now I would like to know how this gets handled: >i.e., what is the SCSI Dispatcher service routine address or how >to find it? >I need to apply a patch, so if anybody has already done so, I would >appreciate it if you could tell me. >Basically, I need to find out each SCSI command that is sent to the >SCSI bus/dispatcher. Trap patching is a somewhat complicated issue, because of the interaction between the 68k and PowerPC environments, but there are some system services that should do what you need. The Trap Manager will allow you to get and set information in the trap dispatch table; the functions you'll be interested in are GetOSTrapAddress and SetOSTrapAddress. Basically, to install a patch you get the current address, save it somewhere, and set the new address to be your patch code, which of course will eventually pass control to the old saved entry point. If you're writing 68k code (which runs in the emulated environment on PPC machines), it's pretty straightforward--GetOSTrapAddress will give you a value you can treat as a function pointer of the appropriate sort and just call straight from your patch code. If you're writing PPC, it's a bit more complicated--the "addresses" you get are actually "universal procedure pointers," which are a special construct used for transferring control between the PPC and 68k environments. You cannot treat these as simple function pointers, but must instead use the mixed-mode services to call them. There's a special function just for trap patching, CallOSTrapUniversalProc, that you can use to transfer control to an entry point returned by GetOSTrapAddress. There are some other things to know about mixed-mode patching, but in your case they're not really relevant, because the SCSI Manager entry point is a selector-based trap, which is a special case that requires your patch code to be 68k. The reason is a little esoteric, but it's basically a limitation of the mixed-mode services. So while you can still write the body of your app or extension or whatever as PPC, the patch itself must be 68k, and the address you give to SetOSTrapAddress must be a 68k function pointer. This does have the benefit of avoiding the mixed-mode junk and allowing your patch to call the old trap address directly, but it might be a significant performance issue. The relevant documentation for all this stuff can be browsed or downloaded via http://devworld.apple.com in the Inside Macintosh area. The Trap Manager is in the OS Utilities book, and mixed-mode stuff is in PowerPC System Software (though you may not need the services for this specific application, a good understanding of the mixed-mode system and the runtime environments is invaluable for mucking around with low-level stuff like this). It's not a simple issue, unfortunately, and I've left out a lot of details, but it can be done. I've done this to trace Device Manager calls, which is the same as your case except for the selector-based issue, so I may have some code that you could use. bhahn@transoft.mangle.net <-- unmangle to reply --------------------------- >From Bill Carey Subject: Making Plug-Ins Date: Fri, 16 Jan 1998 22:34:51 -0400 Organization: Starline Software Hi, I'm attempting to include some plug-ins with a program I am writing, and I need to store a procedure externally, in a resource fork. Does anyone know how to create and access code in other files? Thanks. -Bill Carey Starline Software 703-620-6377 +++++++++++++++++++++++++++ >From wyattw@edmark.com (Wyatt Webb) Date: Tue, 27 Jan 1998 10:47:18 -0800 Organization: Edmark Corp In article <34C018C9.5DFA@patriot.net>, hunt52@patriot.net wrote: > Hi, > I'm attempting to include some plug-ins with a program I am writing, > and I need to store a procedure externally, in a resource fork. Does > anyone know how to create and access code in other files? > > Thanks. > > -Bill Carey > Starline Software > 703-620-6377 Code resources are not a simple task. If you plan on doing this seriously then I would suggest picking up "A Fragment of Your Imagination" by Joe Zobkiw. It does an excellent job of explaining code fragments and code resources for 680x0 and PPC Macs. It also has all the info you need to implement your own plug-in system. I plan on using this style for import/export facilities in my personal project. Good luck! -Wyatt Webb +++++++++++++++++++++++++++ >From online@mactech.com (Jeff at MacTech) Date: Mon, 16 Feb 1998 01:48:55 -0700 Organization: MacTech Magazine In article , wyattw@edmark.com (Wyatt Webb) wrote: >In article <34C018C9.5DFA@patriot.net>, hunt52@patriot.net wrote: > >> I'm attempting to include some plug-ins with a program I am writing, >> and I need to store a procedure externally, in a resource fork. Does >> anyone know how to create and access code in other files? >> > >Code resources are not a simple task. If you plan on doing this seriously >then I would suggest picking up "A Fragment of Your Imagination" by Joe >Zobkiw. It does an excellent job of explaining code fragments and code >resources for 680x0 and PPC Macs. It also has all the info you need to >implement your own plug-in system. I plan on using this style for >import/export facilities in my personal project. The Zobkiw book is indeed the definitive reference. Just in case, one source for this is Developer Depot at . I thought you might also be interested to know that MacTech is currently planning to have an issue devoted to Plugins in June, and hopes to have an article on implementing a plugin architecture in your own programs, as well as info about writing plugins for other apps. __________________________________________________________________________ Jeff Clites Online Editor http://www.MacTech.com/ online@MacTech.com MacTech Magazine __________________________________________________________________________ --------------------------- >From Robert Chancellor Subject: Safe way to set orientation in print record? Date: Sat, 14 Feb 1998 16:11:25 -0800 Organization: EarthLink Network, Inc. According to Inside Macintosh, you should never set the values in a print record directly (always use API). The problem I have is a need for predefined pages to print in the correct orientation (would be nice if page size could be controlled as well). Is there a safe way to set the orientation or page size for a predefined document so it will always print correctly? I though of saving the information for the page into a resource, but according to the Print Manager, when PRValidate is called and the driver is different, then default values are used. Your help or experiences are greatly needed. +++++++++++++++++++++++++++ >From oster@netcom.com (David Phillip Oster) Date: Mon, 16 Feb 1998 14:36:12 -0800 Organization: Digital Arts & Sciences In article <34E632A1.9AADBDD7@earthlink.net>, creality@earthlink.net wrote: > According to Inside Macintosh, you should never set the values in a > print record directly (always use API). The problem I have is a need for > predefined pages to print in the correct orientation (would be nice if > page size could be controlled as well). The safe thing is let the user set things up any way she wants, then save the settings in your document (or preferences) The user knows more about her specific printer than you ever could, so just let her get it right and keep it right. You can pre-initialize your doucment with saved print records for common printers, and fallback to the above method when your program encounters a printer it doesn't recognize. You should try to design your program so that it is tolerant of different paper sizes: people in different parts of the world normally buy paper in different sizes from each other. +++++++++++++++++++++++++++ >From nospam@best.com (Dave Polaschek) Date: Tue, 17 Feb 1998 07:13:17 -0600 Organization: Polaschek Publishing In article <34E632A1.9AADBDD7@earthlink.net>, creality@earthlink.net wrote: > According to Inside Macintosh, you should never set the values in a > print record directly (always use API). The problem I have is a need for > predefined pages to print in the correct orientation (would be nice if > page size could be controlled as well). > > Is there a safe way to set the orientation or page size for a predefined > document so it will always print correctly? I though of saving the > information for the page into a resource, but according to the Print > Manager, when PRValidate is called and the driver is different, then > default values are used. supplies the "official" answer. -DaveP -- THE "REPLY TO" BUTTOM WILL NOT WORK WITH THIS POSTING The reply-to address has been altered to thwart junk e-mailers. Dave Polaschek - davep@best.com PGP key and other spiffy things at --------------------------- >From martin_s@fwhk.hk.net (Martin Schaefer) Subject: local volume or mounted volume? Date: Mon, 16 Feb 1998 09:04:15 +0800 Organization: Fontworks Ltd. I'm writing an app that's doing a lot of file opening, reading, writing and closing. Fortunately it runs fast enough if the folder, where all this is happening, resides on a local hard disk on my machine. But as soon as i try to run the application on some data on a mounted disk via ethernet, things become unbearably slow. Since I don't want to buy (again) faster file servers with faster disks, I thought the solution would be to copy the remote data to a local disk before starting the operation. But after a half day of frustration with THINK reference I still did not know how I can find out from a volume reference number whether the volume is local on my machine or whether it is a volume mounted across our intranet. Can someone please help me and tell me how I can find it out? Martin Schaefer Fontworks Ltd Hong Kong +++++++++++++++++++++++++++ >From Bill McElmury Date: Mon, 16 Feb 1998 08:43:23 -0600 Organization: JMC Inc Martin Schaefer wrote: > But after a half day of frustration with THINK reference I still did not > know how I can find out from a volume reference number whether the volume > is local on my machine or whether it is a volume mounted across our > intranet. Hi Martin, Call PBHGetVolParms(&hpb,false) and then check hpb.vMServerAdr. If it is non-zero, it is a mounted (remote) volume. Good Luck. Have Fun. Bill McElmury JMC Inc Student Record Management software +++++++++++++++++++++++++++ >From David.Walton.10@nd.edu (David Walton) Date: Mon, 16 Feb 1998 20:03:11 -0500 Organization: University of Notre Dame In article , martin_s@fwhk.hk.net (Martin Schaefer) wrote: > I'm writing an app that's doing a lot of file opening, reading, writing and > closing. Fortunately it runs fast enough if the folder, where all this is > happening, resides on a local hard disk on my machine. But as soon as i > try to run the application on some data on a mounted disk via ethernet, > things become unbearably slow. Since I don't want to buy (again) faster > file servers with faster disks, I thought the solution would be to copy > the remote data to a local disk before starting the operation. > But after a half day of frustration with THINK reference I still did not > know how I can find out from a volume reference number whether the volume > is local on my machine or whether it is a volume mounted across our > intranet. > Can someone please help me and tell me how I can find it out? > > Martin Schaefer > Fontworks Ltd > Hong Kong If I remember correctly (this is off the cuff), something like this: OSErr IsAFPVolume(short vRefNum, *isAFPVol) { HParamBlockRec PB; GetVolParmsInfoBuffer infoBuffer; OSErr error; PB.ioParam.ioNamePtr = nil; PB.ioParam.ioVRefNum = vRefNum; PB.ioParam.ioBuffer = (Ptr)&infoBuffer; PB.ioParam.ioReqCount = sizeof(infoBuffer); error = PBHGetVolParmsSync(&PB); *isAFPVol = (infoBuffer.vMServerAdr != 0); return(error); } Hope this helps. David Walton -- David Walton | Graduate Student and Macintosh pundit Mailto:David.Walton.10@nd.edu | Dept. History & Philosophy of Science http://www.nd.edu/~dwalton1 | University of Notre Dame "Beware the advice of successful people; they do not seek company." +++++++++++++++++++++++++++ >From "Gary Smith" Date: Wed, 18 Feb 1998 10:47:42 +1100 Organization: Global Info-Links News Server If I may add a question, how about telling if a volume is a CD. or a removable like a Zip. Gary +++++++++++++++++++++++++++ >From mclow@mailhost2.csusm.edu (Marshall Clow) Date: Thu, 19 Feb 1998 11:48:18 -0800 Organization: Aladdin Systems In article <6cdcck$lho16@iccu9.ipswich.gil.com.au>, "Gary Smith" wrote: > If I may add a question, > > how about telling if a volume is a CD. or a removable like a Zip. > There isn't an easy way. You can see if a volume is removeable. You can see if a volume is read-only. You can see if a volume's driver is ".AppleCD" You can see if a volume's driver is ".SC/IOMEGA". All of these will get you a reasonable guess, but none of them (nor all of them) will give you 100% certainty. What are you trying to accomplish? -- Marshall Clow Aladdin Systems "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -- Benjamin Franklin _Historical Review of Pennsylvania_, 1759 +++++++++++++++++++++++++++ >From "Gary Smith" Date: Fri, 20 Feb 1998 19:35:08 +1100 Organization: Global Info-Links News Server Thanks Marshall, that's what I feared. I'm writing a small system info thingy, listing the amount of memory, mounted disks, free space, etc. Gary --------------------------- End of C.S.M.P. Digest **********************