From: pottier@clipper.ens.fr (Francois Pottier) Subject: csmp-digest-v3-063 Date: Thu, 6 Oct 1994 22:52:40 +0100 (MET) C.S.M.P. Digest Thu, 06 Oct 94 Volume 3 : Issue 63 Today's Topics: <command>+? == PLAIN STUPID!!! (true) Apple Events Question File System Manager Software Development Kit GDGX Graphics Shell bus errors with GX Beta 3... Getting Started (Summary) Help: idle, shutdown, and MacTCP examples.. Pascal Flavours for Macintosh Q: Script-Independant Command-Keys? XCMD memory residence The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier (pottier@clipper.ens.fr). The digest is a collection of article threads from the internet newsgroup comp.sys.mac.programmer. It is designed for people who read c.s.m.p. semi- regularly and want an archive of the discussions. If you don't know what a newsgroup is, you probably don't have access to it. Ask your systems administrator(s) for details. If you don't have access to news, you may still be able to post messages to the group by using a mail server like anon.penet.fi (mail help@anon.penet.fi for more information). Each issue of the digest contains one or more sets of articles (called threads), with each set corresponding to a 'discussion' of a particular subject. The articles are not edited; all articles included in this digest are in their original posted form (as received by our news server at nef.ens.fr). Article threads are not added to the digest until the last article added to the thread is at least two weeks old (this is to ensure that the thread is dead before adding it to the digest). Article threads that consist of only one message are generally not included in the digest. The digest is officially distributed by two means, by email and ftp. If you want to receive the digest by mail, send email to listserv@ens.fr with no subject and one of the following commands as body: help Sends you a summary of commands subscribe csmp-digest Your Name Adds you to the mailing list signoff csmp-digest Removes you from the list Once you have subscribed, you will automatically receive each new issue as it is created. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest. Questions related to the ftp site should be directed to scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP digest are available there. Also, the digests are available to WAIS users. To search back issues with WAIS, use comp.sys.mac.programmer.src. With Mosaic, use http://www.wais.com/wais-dbs/comp.sys.mac.programmer.html. ------------------------------------------------------- >From alun@isy.liu.se (Anders Lundqvist) Subject: <command>+? == PLAIN STUPID!!! (true) Date: 19 Sep 1994 06:42:44 GMT Organization: Dept. of E.E., Univ. of Linkoping Greetings all programmers! I wonder how many of you that implement keyboard shortcuts like <command>+? realize that these DO NOT work on many international keyboard layouts like the swedish???? Why? Because in order to produce a question mark I need to use the shift key and since the command key disables the shift key, this doesn't work. I have been playing around with the DA Keyboard and there's simply no way around. Obiwan uses <command>+` and this I can emulate by pressing <command>+<option>+<control>+'. Sigh... Of course, this wouldn't been so bad if there was an equivalent meny command, but in many cases there isn't. Usually <command>+? invokes some help mode and turns the pointer into a question mark to allow the user to point at an object (e.g Disinfectant and Mathematica). IS THIS PROBLEM MENTIONED IN THE HUMAN INTERFACE GUIDELINES??? Thank you for any feedback! Anders Lundqvist Department of EE Linkoping University Sweden +++++++++++++++++++++++++++ >From philip@cs.wits.ac.za (Philip Machanick) Date: 19 Sep 1994 08:16:47 GMT Organization: Computer Science Dept, U of Witwatersrand In article <35jbt4$mac@newsy.ifm.liu.se>, alun@isy.liu.se wrote: > Why? Because in order to produce a question mark I need to > use the shift key and since the command key disables the shift > key, this doesn't work. This is also true on the English and US keyboards: "?" is shift-/. Where did you get the idea that command disables shift? All the modifiers are independent and can be sensed independently. If COMMAND-? is not working for you there must be some other explanation. -- Philip Machanick philip@cs.wits.ac.za Department of Computer Science, University of the Witwatersrand 2050 Wits, South Africa (at University of Cape Town 4 July-7 Nov) phone 27(11)716-3309 fax 27(11)339-7965 +++++++++++++++++++++++++++ >From resnick@uiuc.edu (Pete Resnick) Date: Mon, 19 Sep 1994 08:35:23 -0500 Organization: University of Illinois at Urbana-Champaign In article <philip-1909941017020001@mackerel.cs.uct.ac.za>, philip@cs.wits.ac.za (Philip Machanick) wrote: > In article <35jbt4$mac@newsy.ifm.liu.se>, alun@isy.liu.se wrote: > > > Why? Because in order to produce a question mark I need to > > use the shift key and since the command key disables the shift > > key, this doesn't work. > > This is also true on the English and US keyboards: "?" is shift-/. Where > did you get the idea that command disables shift? All the modifiers are > independent and can be sensed independently. If COMMAND-? is not working > for you there must be some other explanation. You're wrong Phil. Command does in fact disable the shift modifier. See the tech note on International Cancelling. To properly handle the command key in your application, you should always strip the command-key bit out of the modifiers field and re-pass the keystroke through KeyTrans. Here's some source code for doing it with the cancel key, but you should use similar code for any command-key combination (like in MenuKey): /* These both use Universal Headers. The second is for System 6 too. */ Boolean WasCancel(EventRecord *theEvent) { short keyCode; long state = 0L, test; unsigned long keys; if(!(theEvent->modifiers & cmdKey)) return(false); keyCode = (theEvent->modifiers & 0xFE00) | ((theEvent->message & keyCodeMask) >> 8); keys = KeyTranslate((Ptr)GetScriptManagerVariable(smKCHRCache), keyCode, &state); return(((Byte)keys == '.') || ((Byte)(keys >>= 16) == '.')); } Boolean WasCancelSystem6or7(EventRecord *theEvent) { short keyCode, rsrcID, scriptID; Ptr kchrPtr; Handle kchrRsrc = nil; long state = 0L; unsigned long keys; if(!(theEvent->modifiers & cmdKey)) return(false); keyCode = (theEvent->modifiers & 0xFE00) | ((theEvent->message & keyCodeMask) >> 8); if((kchrPtr = (Ptr)GetScriptManagerVariable(smKCHRCache)) == nil) { scriptID = GetScriptManagerVariable(smKeyScript); rsrcID = GetScriptVariable(scriptID, smScriptKeys); kchrRsrc = GetResource('KCHR', rsrcID); if(kchrRsrc != nil) kchrPtr = *kchrRsrc; } if(kchrPtr != nil) keys = KeyTranslate(kchrPtr, keyCode, &state); if(kchrRsrc != nil) ReleaseResource(kchrRsrc); return(((Byte)keys == '.') || ((Byte)(keys >>= 16) == '.')); } -- Pete Resnick (...so what is a mojo, and why would one be rising?) Doctoral Student - Philosophy Department, Gregory Hall, UIUC System manager - Cognitive Science Group, Beckman Institute, UIUC Internet: resnick@uiuc.edu +++++++++++++++++++++++++++ >From alun@isy.liu.se (Anders Lundqvist) Date: 19 Sep 1994 13:31:07 GMT Organization: Dept. of E.E., Univ. of Linkoping In article 1909941017020001@mackerel.cs.uct.ac.za, philip@cs.wits.ac.za (Philip Machanick) writes: >In article <35jbt4$mac@newsy.ifm.liu.se>, alun@isy.liu.se wrote: > >> Why? Because in order to produce a question mark I need to >> use the shift key and since the command key disables the shift >> key, this doesn't work. > >This is also true on the English and US keyboards: "?" is shift-/. Where >did you get the idea that command disables shift? All the modifiers are >independent and can be sensed independently. If COMMAND-? is not working >for you there must be some other explanation. >-- >Philip Machanick philip@cs.wits.ac.za >Department of Computer Science, University of the Witwatersrand >2050 Wits, South Africa (at University of Cape Town 4 July-7 Nov) >phone 27(11)716-3309 fax 27(11)339-7965 I'll try again... On my keybord the "?" is located next to the "0" (zero) key and is <shift>+"+". If I use the DA Keyboard and press the shift key then all letters turn into capital letters and the "+" sign turns into a question mark. OK! If I now keep the shift key pressed and press the <command> key all letter go back to normal and the "?" is transmogrified into a "+" again. Does this happen to you? If it does and you can use <command>+"?" then I'm completely lost... Of course, everything works as a charm if I turn on the US keyboard layout. Anders Lundqvist Department of EE Linkoping University Sweden +++++++++++++++++++++++++++ >From pcastine@prz.tu-berlin.de (Peter Castine) Date: Mon, 19 Sep 1994 15:19:45 GMT Organization: Process Control Center In article <philip-1909941017020001@mackerel.cs.uct.ac.za>, philip@cs.wits.ac.za (Philip Machanick) wrote: > In article <35jbt4$mac@newsy.ifm.liu.se>, alun@isy.liu.se wrote: > > > Why? Because in order to produce a question mark I need to > > use the shift key and since the command key disables the shift > > key, this doesn't work. > > This is also true on the English and US keyboards: "?" is shift-/. Where > did you get the idea that command disables shift? All the modifiers are > independent and can be sensed independently. If COMMAND-? is not working > for you there must be some other explanation. Anders is right--if the command-shift-anything is pressed, the ASCII code of the unshifted character is returned in event record. If the programmer wants to get the shifted character, she needs to reprocess the key code with the cmdKey bit in the modifiers field reset. This was all discussed years ago in a Tech Note called ``International Cancelling'', it gave code for correctly detecting command-period on all keyboards. Don't ask me where the code is in NIM, I don't know. You can also find the technique in use in the TCL source. The trick with Mathematica is that, although it tells you to use Cmd-?, it really is looking for Cmd-/. There is a possibility that, upon finding '/' in the event record, it checks if both the shift and command keys are pressed, but that still won't help you if '?' is someplace different from it's position on the American Sholes (QWERTY) keyboard layout. Someday I'm gonna write an application that uses Command-Ü (that's U-Umlaut if you're not reading on a Mac), just to let some people find out what it feels like. BTW, there is one work-around for Anders problem: switch to the U.S. keyboard layout, at least when you want to get that nifty ?-cursor. This is a pain in the neck, but there are a couple of short cuts you can take--mail me if you want details. -- -Peter Castine--pcastine@prz.tu-berlin.de--Process Control Center--TU Berlin- * A New York City judge ruled that if two women behind you at the movies * * insist on discussing the probable outcome of the film, you have the * * right to turn around and blow a Bronx cheer at them. * +++++++++++++++++++++++++++ >From philip@cs.wits.ac.za (Philip Machanick) Date: 19 Sep 1994 15:01:50 GMT Organization: Computer Science Dept, U of Witwatersrand In article <35k3qr$28b@newsy.ifm.liu.se>, alun@isy.liu.se wrote: > On my keybord the "?" is located next to the "0" (zero) key and is > <shift>+"+". If I use the DA Keyboard and press the shift key then all > letters turn into capital letters and the "+" sign turns into a question > mark. OK! If I now keep the shift key pressed and press the <command> key > all letter go back to normal and the "?" is transmogrified into a "+" again. > > Does this happen to you? If it does and you can use <command>+"?" then I'm > completely lost... If I use the DA, the same thing happens yet I can use command-? in MS Word etc. Maybe Pete Resnick's article throws some light on this but it's not instantly clear why this should be different for a different keyboard layout (on the US keyboard on my PB170 "?" is SHIFT-/). -- Philip Machanick philip@cs.wits.ac.za Department of Computer Science, University of the Witwatersrand 2050 Wits, South Africa (at University of Cape Town 4 July-7 Nov) phone 27(11)716-3309 fax 27(11)339-7965 +++++++++++++++++++++++++++ >From stk@uropax.contrib.de (Stefan Kurth) Date: 20 Sep 1994 01:36:04 +0200 Organization: none In article <35jbt4$mac@newsy.ifm.liu.se>, alun@isy.liu.se (Anders Lundqvist) wrote: > I wonder how many of you that implement keyboard shortcuts > like <command>+? realize that these DO NOT work on many > international keyboard layouts like the swedish???? > > Why? Because in order to produce a question mark I need to > use the shift key and since the command key disables the shift > key, this doesn't work. > > IS THIS PROBLEM MENTIONED IN THE HUMAN INTERFACE GUIDELINES??? It is mentioned in NIM: Text, page C-23. And if all programs were well-behaved and handled these things like Apple tells us, you would have no problems. The solution is to strip the cmdKey bit from theEvent.modifiers, and then run it through KeyTrans() again before passing it to MenuKey(). (BTW, I just tried it in Disinfectant, and it works fine for me; and I have a German keyboard which I guess is similar to yours.) Actually, some programs don't check for command-? at all, but instead they check whether the shift key is down, and if it is, they check for command-/ (because shift-/ yields ? on a US keyboard). Thus, you might try command-shift-/ on your keyboard and see if it works. Cheers, -Stefan ________________________________________________________________________ Stefan Kurth Berlin, Germany stk@contrib.de +++++++++++++++++++++++++++ >From quinn@cs.uwa.edu.au (Quinn "The Eskimo!") Date: Tue, 20 Sep 1994 11:30:09 +0800 Organization: Department of Computer Science, The University of Western Australia In article <35jbt4$mac@newsy.ifm.liu.se>, alun@isy.liu.se wrote: >Greetings all programmers! Anders, you think *you've* got problems, us Dvorak keyboards users have to put up with certain applications (like Photoshop 2.x and BBEdit 3.0 and certain bits of HC 2.x) where it ignores the command-key table in the KCHR and decides to use Dvorak command keys instead of QWERTY ones. Do you have any idea how annoying it is to hit command-X (to do a Cut) and have the application quit. *grrr* -- Quinn "The Eskimo!" "Kids, 3D and driving just don't mix." So many gumbies, so few ICBMs. Still using BBEdit 2.3.2. +++++++++++++++++++++++++++ >From h+@nada.kth.se (Jon W{tte) Date: Tue, 20 Sep 1994 10:36:02 +0200 Organization: Royal Institute of Something or other In article <35jbt4$mac@newsy.ifm.liu.se>, alun@isy.liu.se (Anders Lundqvist) wrote: >IS THIS PROBLEM MENTIONED IN THE HUMAN INTERFACE GUIDELINES??? Yes, it is. Applications are suggested only to use letters, and where they use non-letters, to do the keyboard translation themselves using KeyTrans with the command key stripped off or something to that effect. The easy thing for a user to do is to extract the Swedish keyboard layout in ResEdit and change it to care about shift with command down (that's just a simple re-binding) However, you immediately get a new problem; cmd-shift-digit means FKEY, and the international shifted numbers aren't the same as the US ones (on my keyboard, from 1 through 0, it's: bang quote hash sun percent ampersand slash leftparen rightparen equal, or as you may, potion amulet sink unknown food demon wawwnd tool armor ring :-) Now, FoxPro for Macintosh uses cmd-F1 cmd-F2 etc for commands that aren't edit commands, so it could be worse (I don't have command keys on my keyboard) But then, FPfM says it supports the full power of AppleEvents and AppleScripts, when the only non-required AE they support is the DoScript one. Lame, and misleading. Cheers, / h+ -- Jon Wätte (h+@nada.kth.se), Hagagatan 1, 113 48 Stockholm, Sweden V}ga v{gra nonkonformism! +++++++++++++++++++++++++++ >From pcastine@prz.tu-berlin.de (Peter Castine) Date: Tue, 20 Sep 1994 10:00:17 GMT Organization: Process Control Center In article <35l794$s3j@uropax.contrib.de>, stk@uropax.contrib.de (Stefan Kurth) wrote: > Actually, some programs don't check for command-? at all, but instead > they check whether the shift key is down, and if it is, they check for > command-/ (because shift-/ yields ? on a US keyboard). Thus, you might > try command-shift-/ on your keyboard and see if it works. The problem is that this won't work if the slash (/) itself is a shift-key combination as it is, for instance, on the German keyboard (/ == shift-7). So, the only solution for Anders' problem (short of switching to the U.S. keyboard layout) seems to be to use QuicKeys. Of course, if the command isn't available in a menu somewhere, he won't have luck with that, either. I sense a moral here: Don't implement command-key shortcuts that *aren't* available through menus. Hey, if the cmd-key equivalents were for menu commands, Anders could just tweak the appropriate resources. (Won't work for MS products, but, hey, nothing works for MS products ;-} ). Cheers -- -Peter Castine--pcastine@prz.tu-berlin.de--Process Control Center--TU Berlin- * A New York City judge ruled that if two women behind you at the movies * * insist on discussing the probable outcome of the film, you have the * * right to turn around and blow a Bronx cheer at them. * +++++++++++++++++++++++++++ >From rollin@newton.apple.com (Keith Rollin) Date: Wed, 21 Sep 1994 04:06:34 -0800 Organization: Apple ][ -> Mac -> Taligent -> Newton -> Windows? In article <35jbt4$mac@newsy.ifm.liu.se>, alun@isy.liu.se wrote: >I wonder how many of you that implement keyboard shortcuts >like <command>+? realize that these DO NOT work on many >international keyboard layouts like the swedish???? FYI, the '?' key is shifted on US layouts, too. > >Why? Because in order to produce a question mark I need to >use the shift key and since the command key disables the shift >key, this doesn't work. I have been playing around with the DA >Keyboard and there's simply no way around. Obiwan uses <command>+` >and this I can emulate by pressing <command>+<option>+<control>+'. >Sigh... > >Of course, this wouldn't been so bad if there was an equivalent >meny command, but in many cases there isn't. Usually <command>+? >invokes some help mode and turns the pointer into a question mark >to allow the user to point at an object (e.g Disinfectant and >Mathematica). > >IS THIS PROBLEM MENTIONED IN THE HUMAN INTERFACE GUIDELINES??? There's a technote called "International Canceling" that deals with this issue. It focuses on the fact that '.' is sometimes a shifted character (the technote cites the Italian keyboard as an example), and shows how to get around the fact that Shift is ignored when Command is pressed. If programmers care to get it right, the information is available. - -------------------------------------------------------------------------- Keith Rollin --- Phantom Programmer --- Apple Computer, Inc. --- Team Newton --------------------------- >From westwig@msc.cornell.edu (Erik Anton Westwig) Subject: Apple Events Question Date: Wed, 21 Sep 1994 10:11:54 -0500 Organization: Cornell University I'm trying to finally learn about Apple Events, but I'm having some problems understanding something quite fundamental: Consider the first required AE: Open Application When the Finder starts my App, it calls the Process Manager to launch it and then sticks a kAEOpenApplication high-level event into my queue. I think I got that part, but because I want my app to be as friendly as possible to older systems (without AEs) I wouldn't want to stick ANY code in the OpenApp routine that is necessary to the starting of my program. I can't see what I would do differently in the OpenApp routine than I would do in the non AE environment --> so I guess what I'm saying is I don't understand why this is an important event to support. Am I completely missing the whole point here, or what? I think I see how the QuitApp event is different: it gives my App a chance to shut down itself gracefully (e.g. asking the user if they want to save open documents, etc.) Thanks, ERIK +++++++++++++++++++++++++++ >From Jeremy@dewey.soe.berkeley.edu (Jeremy Roschele) Date: Wed, 21 Sep 1994 08:09:28 -0800 Organization: SimCalc Project In article <westwig-210994101154@132.236.102.71>, westwig@msc.cornell.edu (Erik Anton Westwig) wrote: > I can't see what I would do differently in the OpenApp routine than I > would do in the non AE environment --> so I guess what I'm saying is I > don't > understand why this is an important event to support. > Am I completely missing the whole point here, or what? > On the Open Application event you should create a blank document. The Finder won't send OApp if it is printing, or the user launched with a document. jeremy +++++++++++++++++++++++++++ >From jwbaxter@olympus.net (John W. Baxter) Date: Wed, 21 Sep 1994 13:26:08 -0700 Organization: Internet for the Olympic Peninsula In article <westwig-210994101154@132.236.102.71>, westwig@msc.cornell.edu (Erik Anton Westwig) wrote: > I'm trying to finally learn about Apple Events, but I'm having some > problems > understanding something quite fundamental: > > Consider the first required AE: Open Application > When the Finder starts my App, it calls the Process Manager to launch it > and then sticks a kAEOpenApplication high-level event into my queue. I > think I got that part, but because I want my app to be as friendly as > possible to older systems (without AEs) I wouldn't want to stick ANY code > in the OpenApp routine that is necessary to the starting of my program. > I can't see what I would do differently in the OpenApp routine than I > would do in the non AE environment --> so I guess what I'm saying is I > don't > understand why this is an important event to support. > Am I completely missing the whole point here, or what? When your application starts, and realizes that Apple events are active (all my apps realize that, because I don't write for System 6 any more), it should do what needs to be done every time it starts up. None of this will be visible to a user. When an Open Application event comes in, the app should do what it does when it is double-clicked on in the Finder. Often, that is to create and open a new untitled document...sometimes it isn't. At one time, Apple suggested not doing that if an Open Application appears after the app is happily doing things. Recently, it seems that Apple may in the future want the open a new untitled document behavior in that case, as an "improvement" to the Mac look and feel. So you probably should just go ahead and handle Open Application whenever it shows up. When an Open Document comes in before the Open Application, it means that one or more docs were double-clicked rather than your application. Normally, you would open them (assuming that's what your application does). Print Document may appear rather than Open Document...this becomes more important with QuickDraw GX than it was with most users before, since it's how you find out that a user has dragged one of your docs to a desktop printer. Another possibility is that an 'ascr'/'noop' (I think 'noop' is right) event appears. Something else will happen later. Most apps can simple ignore this event, which says "I'll tell you later why you were started". But some apps may need to know. --John -- John Baxter Port Ludlow, WA, USA [West shore, Puget Sound] "Occasionally...astronomers add a second to either June 31 or December 31..." IM: OS Utilities, p 4-12 jwbaxter@pt.olympus.net +++++++++++++++++++++++++++ >From westwig@msc.cornell.edu (Erik Anton Westwig) Date: Wed, 21 Sep 1994 18:35:46 -0500 Organization: Cornell University In article <Jeremy-2109940809280001@now-and-zen.hip.berkeley.edu>, Jeremy@dewey.soe.berkeley.edu (Jeremy Roschele) wrote: > On the Open Application event you should create a blank document. The > Finder won't send OApp if it is printing, or the user launched with a > document. > > jeremy yup, i get that part. But what I don't see is what I need to do differently than before (without the AEs). To be pre system 7 friendly, I need to be able to open my blank document without using the KAEOpenApplication event, anyway. ERIK +++++++++++++++++++++++++++ >From jwbaxter@olympus.net (John W. Baxter) Date: Wed, 21 Sep 1994 19:42:44 -0700 Organization: Internet for the Olympic Peninsula In article <westwig-210994183547@132.236.102.67>, westwig@msc.cornell.edu (Erik Anton Westwig) wrote: > In article <Jeremy-2109940809280001@now-and-zen.hip.berkeley.edu>, > Jeremy@dewey.soe.berkeley.edu (Jeremy Roschele) wrote: > > > On the Open Application event you should create a blank document. The > > Finder won't send OApp if it is printing, or the user launched with a > > document. > > > > jeremy > > yup, i get that part. But what I don't see is what I need to do > differently > than before (without the AEs). To be pre system 7 friendly, I need to be > able > to open my blank document without using the KAEOpenApplication event, > anyway. The sample code in Inside Mac: IAC shows how to detect whether you should wait for the 'oapp' because it's coming, or not. I think the discussion in Think Reference also does. --John -- John Baxter Port Ludlow, WA, USA [West shore, Puget Sound] "Occasionally...astronomers add a second to either June 31 or December 31..." IM: OS Utilities, p 4-12 jwbaxter@pt.olympus.net +++++++++++++++++++++++++++ >From h+@nada.kth.se (Jon W{tte) Date: Thu, 22 Sep 1994 16:11:18 +0200 Organization: Royal Institute of Something or other In article <westwig-210994183547@132.236.102.67>, westwig@msc.cornell.edu (Erik Anton Westwig) wrote: >yup, i get that part. But what I don't see is what I need to do >differently >than before (without the AEs). To be pre system 7 friendly, I need to be >able >to open my blank document without using the KAEOpenApplication event, >anyway. Well, the logic goes like this: On startup: if (hasn't got AppleEvents) then if (CountAppFiles) then Open or Print files else Make new document else Install AppleEvent Handlers on OpenApplication: Make new document on OpenDocument: Open files on PrintDocument: Print files As you see, you should separate the actions (opening/printing documents or making new documents) from their triggers (starting up and/or choosing the menu items) For instance, you wouldn't want your app to create a blank document before receiving an open documents appleevent when the user double-clicks a document in the Finder under system 7. Cheers, / h+ -- Jon Wätte (h+@nada.kth.se), Hagagatan 1, 113 48 Stockholm, Sweden "TextEdit does everything right." ‹ Jon W{tte --------------------------- >From jumplong@aol.com (Jump Long) Subject: File System Manager Software Development Kit Date: 15 Sep 1994 00:28:01 -0400 Organization: America Online, Inc. (1-800-827-6364) Apple Developers: The File System Manager Software Development Kit (SDK) version 1.2 is available on Apple's ftp server at: ftp.apple.com (IP 130.43.2.3) /ftp/dts/mac/sys.soft/extensions/file-system-manager-sdk.hqx The FSM SDK will be on Developer CDs and on AppleLink in the future. Archive Contents - -------------- * File System Manager -- A system extension which implements version 1.2 of FSM and the extended Disk Initialization Package. This extension is compatible with System 7.0 and later. If in future system software, we make changes to FSM, the File System Manager extension will disable itself. * FSMGlueLib.o -- The glue code for the File System Manager service routines. * FSM.h. FSM.p and FSM.a -- The Universal Interface files for the File System Manager. This version of the interface files was built to work with the Universal Interfaces 2.0a1 from ETO #15, MPW prerelease. However, for 68K development (which we expect all foreign file systems to be), FSM.h works perfectly with the current release of Universal Interfaces on ETO #15. * Guide - File System Manager -- The documentation for the File System Manager in Apple DocViewer format. The latest version of the Apple DocViewer application can be found on any recent Developer CD. Licensing Information - ------------------- The File System Manager extension version 1.2 may be licensed for distribution. Contact Apple Software Licensing at: Software Licensing Apple Computer, Inc. 2420 Ridgepoint Drive, MS: 198-SWL Austin, TX 78754 512 919-2645 AppleLink: SW.LICENSE The File System Manager Development and Developer Support Team (I told ya we'd make it available when it was done - Jim Luther) +++++++++++++++++++++++++++ >From quinn@cs.uwa.edu.au (Quinn "The Eskimo!") Date: Fri, 16 Sep 1994 10:57:22 +0800 Organization: Department of Computer Science, The University of Western Australia In article <358igh$sme@search01.news.aol.com>, jumplong@aol.com (Jump Long) wrote: >(I told ya we'd make it available when it was done - Jim Luther) (: Yay Jim! -- Quinn "The Eskimo!" "Scout in a can. Simple, cheap, easy to use and it's expendable!" +++++++++++++++++++++++++++ >From jumplong@aol.com (Jump Long) Date: 17 Sep 1994 14:57:02 -0400 Organization: America Online, Inc. (1-800-827-6364) In article <rmah-1509940108340001@rmah.dialup.access.net>, rmah@panix.com (Robert Mah) writes: >Please pardon my ignorance, but I have one question. What does it do? Here's some meterial cut from the FSM docs which should answer this question: "The File System Manager is the part of the Macintosh Operating System that manages the use of foreign file systems. The File System Manager provides a general means by which foreign file systems can be installed, identified, and interfaced to the Operating System. The Operating System services provided by the File System Manager are called FSM components and the interface mechanism between an foreign file system and a particular FSM component is known as a FSM component interface. At this time, two FSM component interface are defined for use under the File System Manager * the HFS Component Interface which allows a foreign file system to process File Manager requests * the Disk Initialization Package Component Interface which allows foreign file systems to initialize foreign file system volumes on a Macintosh" FSM also includes the File System Utility Routines which help you write a foreign file system. Here's the description of those utilities: "The File System Utility routines are intended for use by foreign file systems to allow your foreign file system to * access file control blocks (FCBs), volume control blocks (VCBs), working directory control blocks (WDCBs), and drive queue elements (DrvQEl) * set and get the default volume and working directory * eject a volume * validate and process parameters passed with Macintosh file system calls * access the Macintosh file system's cache buffers and low-level I/O services" Writing a foreign file system is by no means simple, but we've tried to make it easier to do a lot of it. - Jim Luther +++++++++++++++++++++++++++ >From quinn@cs.uwa.edu.au (Quinn "The Eskimo!") Date: Sun, 18 Sep 1994 22:37:05 +0800 Organization: Department of Computer Science, The University of Western Australia In article <35fe5u$j0m@newsbf01.news.aol.com>, jumplong@aol.com (Jump Long) wrote: >Writing a foreign file system is by no means simple, but we've tried to >make it easier to do a lot of it. So I spent the weekend reading the docs and now I have a question... How do you write an asychronous file system based on a non-block device? (eg AppleShare) Presumably you should be using the cache routines because of this comment... "all calls to most device drivers should be made through the cache routines." (: However the cache routines (eg UTCacheReadIP) seem to imply that they access the block device driver directly, because they call the log2PhyProc. Any ideas? -- Quinn "The Eskimo!" "Scout in a can. Simple, cheap, easy to use and it's expendable!" +++++++++++++++++++++++++++ >From jumplong@aol.com (Jump Long) Date: 18 Sep 1994 15:43:06 -0400 Organization: America Online, Inc. (1-800-827-6364) In article <quinn-1809942237050001@edu-dynamic5.educ.ecel.uwa.edu.au>, quinn@cs.uwa.edu.au (Quinn "The Eskimo!") writes: >How do you write an asychronous file system based on a non-block device? >(eg AppleShare) Presumably you should be using the cache routines because >of this comment... > >"all calls to most device drivers should be made through the cache routines." Here's the answer I gave to a couple of developers during the seed to get them around this: - --- So, how do you use the cache routines (which are designed to work with block disk devices) with non-block devices? You write a very simple block disk driver - one that supports one writable block. You'll need a driver anyway to handle _Control calls with csCode 21 (return physical drive icon) because the Finder uses that control call. The single block driver is going to be your communications channel between your FFS, which can only perform block I/O through the cache, and your non-block driver. As an example of how this trick works, let's say your FFS needs to send a command to your WizzyNet driver. First, your FFS needs to get a cache block and associate it with the block on your simple block driver. It does this by calling UTGetBlock passing the volume's volume reference number for the refNum (so the cache code knows which driver to call), NULL for the log2PhyProc, 0 for the block number (the only block your driver has), and gbNoRead for the gbOption (which tells the cache code not to bother reading the block from disk). You'll get a pointer back to a 512-byte buffer in the cache. Next, your FFS puts whatever data is wants to send to the block driver (to send on to the WizzyNet driver) into the cache buffer. Then, to tell the cache that the block needs to be sent to the block driver, the FFS calls UTMarkDirty with the pointer to the cache block. To tell the cache code to write the block, the FFS calls UTFlushCache. When the cache code is called to flush the dirty block to the disk driver, it will call the block driver to write the cache block. The block driver can then call the WizzyNet driver asynchronously with a completion routine and then RTS back to the Device Manager. The Device Manager will then either return control to the user code or will spin in the SyncWait loop if the call was made synchronously. When the WizzyNet driver completes the call and the Device Manager calls the completion routine in the block driver, the block driver will jump to jIODone, the Device Manager will call the completion routine in the File Manager's cache code, and the cache code will pass control back through FSM to the FFS that made the cache call. Finally, when you're done making calls to your driver for this particular File Manager request, you call UTReleaseBlock to release the block. So, all your block driver needs to handle is _Open, _Close, _Control, and _Write. Since it'll never be getting _Read or _Status calls from your FFS, you can simply return readErr to _Read and statusErr to _Status requests. The data your driver is asked to write is going to be the command or data you want to send to your non-block driver. You might want to put a signature long-word in the cache blocks your write so that other code that mistakenly writes to your driver can be ignored if the signature isn't there. - --- Yes, that's a hack, but it works and it keeps your foreign file system from deadlocking the system. There are a few published foreign file systems (I won't mention any names) that make synchronous calls to network drivers which they don't completely own. Every once in a while, those file systems deadlock the system because: a) something interrupts while the driver they call is busy, and b) that code makes an asynchronous File Manager request and c) if the File Manager isn't busy, it passes the request on to the foreign file system which d) makes a synchronous call to the busy driver which causes the system to spin in SyncWait forever (or until you reset the system or pull the plug). - Jim Luther +++++++++++++++++++++++++++ >From quinn@cs.uwa.edu.au (Quinn "The Eskimo!") Date: Mon, 19 Sep 1994 09:42:25 +0800 Organization: Department of Computer Science, The University of Western Australia In article <35i58a$9bi@newsbf01.news.aol.com>, jumplong@aol.com (Jump Long) wrote: >In article <quinn-1809942237050001@edu-dynamic5.educ.ecel.uwa.edu.au>, >quinn@cs.uwa.edu.au (Quinn "The Eskimo!") writes: > >>How do you write an asychronous file system based on a non-block device? > >Yes, that's a hack, but it works [...] Cool. I figured that the hack would work something like that but it's nice to know that I'm not missing something obvious. Share and Enjoy. -- Quinn "The Eskimo!" "Scout in a can. Simple, cheap, easy to use and it's expendable!" +++++++++++++++++++++++++++ >From peter.lewis@info.curtin.edu.au (Peter N Lewis) Date: Tue, 20 Sep 1994 10:13:20 +0800 Organization: NCRPDA, Curtin University >Cool. I figured that the hack would work something like that but it's >nice to know that I'm not missing something obvious. It should be possible to write a generic driver to take the place of that block driver, something where the block is formatted like: <signature> <address to call> <generic parameter> And have the block driver call the specified address, with a ptr to the parameters. Once we (someone) writes this and makes it available, that should be one less chunk we all have to write. That should work, right? Peter. -- Peter N Lewis <peter.lewis@info.curtin.edu.au> - Macintosh TCP fingerpainter FTP my programs from redback.cs.uwa.edu.au:Others/PeterLewis/ or amug.org:pub/peterlewis/ or nic.switch.ch:software/mac/peterlewis/ +++++++++++++++++++++++++++ >From jumplong@aol.com (Jump Long) Date: 20 Sep 1994 03:08:06 -0400 Organization: America Online, Inc. (1-800-827-6364) In article <peter.lewis-2009941013200001@rocky.curtin.edu.au>, peter.lewis@info.curtin.edu.au (Peter N Lewis) writes: >It should be possible to write a generic driver to take the place of >that block driver, something where the block is formatted like: > ><signature> ><address to call> ><generic parameter> > >And have the block driver call the specified address, with a ptr to the >parameters. Once we (someone) writes this and makes it available, that >should be one less chunk we all have to write. That should work, right? That looks like you're planning on calling <address to call> synchronously and that won't work. When the block driver gets a request (either asynchronously or synchronously - this method works for both), the block driver should: 1) Call the network driver asynchronously with a completion routine 2) RTS back to the Device Manager 3) When the completion routine is executed, jump to ioDone to finish up the call. The reason it should do it that way is that the network driver could be busy. If that's the case, then the request will be queued for execution later. The Device Manager will return control to the file system's cache code (which called the block driver) and the file system will do one of two things: 1) if the original File Manager request was synchronous, it will spin in SyncWait until the device request's ioResult field is less than or equal to noErr or 2) if the original File Manager request was asynchronous, it will return control to the caller. Either way, when the network driver completes its request and the Device Manager calls the block driver's completion routine and the block driver calls the File Manager's completion routine (or the SyncWait loop code sees ioResult change), then control will be returned to the Foreign File System that used the cache. So, if you're going to write some kind of generic block driver, then you should only need to pass it a block with a structure like this: enum { kReadRequest = 1, kWriteRequest = 2, kControlRequest = 3, kStatusRequest = 4 }; struct CallDriverStruct { OSType: mySignature; /* the creator type of my foreign file system */ /* to help stop unknown writers */ short: callToMake; /* pass kReadRequest, kWriteRequest, etc. to */ /* tell block driver which driver call to make. */ ParamBlockRec: pb; /* parameter block to make driver call with. */ }; All of that fits easily into a 512-byte cache block and you don't have to worry about the parameter block moving or being reused since cache blocks you get with UTGetBlock are yours until you release them (and they don't move in memory - ever). All of this is off the top of my somewhat sleepy head, so I hope it makes sense. If you get something working and want a code review, let me know. If I have time, I'll write it... - Jim Luther +++++++++++++++++++++++++++ >From benh@fdn.org (Benjamin Herrenschmidt) Date: Wed, 21 Sep 94 23:00:53 +0100 Organization: (none) Hi ! I was away from the usenet for some days (AppleExpo in Paris) and i missed the beginning of this thread. The API to the File System Manager is available somewhere ? I am interested.... BenH. --------------------------- >From gwatts@whcdfo.fnal.gov Subject: GDGX Graphics Shell bus errors with GX Beta 3... Date: 19 Sep 94 09:17:28 -0600 Organization: Fermi National Accelerator Lab Hi all, I'm trying to teach myself some QDGX graphics this week. :) Short story is I built GDGX Graphics Shell with MW and I get a trashed stack ("sc" in Macsbug says my stack pointer is odd!). The precompiled version on the develop CD bombs with a bus error as well. Details next: I thought I would start by building the QDGX Graphics shell from Develop 15. I pulled the source code from develop 19, and I'm using beta 3 of GX (I don't system 7.5 yet, just 7.1). The app on the disk crashed my mac with a bus error. So, I decided to recompile everything. I'm using MW D/4. First thing I have to do is #define ppcinterfaces in all the source files (including the library files!). Second, the shell sources won't compile as is. There is a routine GXQDGlobalToFixedLocal, for example, that doesn't exist in any of the gx .h files. I replaced it with ConvertGXPoint, and used the parent view port of gcontentWindow to get the local coords correct. When creating the "runFeatures" for the styled layout shape, the second feather (alternateblahblah) doesn't exist in gx anylonger. Is that right? For the time being, I've just removed it. So, what did I miss. Do I have to do a #pramga parameters_in_a0 or something like that around the gx interfaces? Why isn't this done automagically, if I do have to do it. I only just started last night, so I've not done a detailed step through the program yet. I just figured that others starting out with GX may have seen the same thing, and save me some time. Thought changing the to the ConvertQDPoint taught me a bit about viewport coord systems! Any help would be great! TIA. Cheers, Gordon. +++++++++++++++++++++++++++ >From dkj@apple.com (Dave Johnson) Date: Wed, 21 Sep 1994 17:56:24 GMT Organization: Apple Computer In article <1994Sep19.091728.1@whcdfo.fnal.gov>, gwatts@whcdfo.fnal.gov wrote: > I thought I would start by building the QDGX Graphics shell from Develop 15. > I pulled the source code from develop 19, and I'm using beta 3 of GX (I don't > system 7.5 yet, just 7.1). The app on the disk crashed my mac with a bus error. The QDGX Shell on the CDs was compiled for, and runs under, beta 1 of GX (and without universal interfaces). It was never updated for beta 3, unfortunately. The quick and (very) dirty way to get it up and running would be to install beta 1 (it's on the issue 15 CD) and use old headers. Not recommended. > So, I decided to recompile everything. > I'm using MW D/4. First thing I have to do is #define ppcinterfaces in all > the source files (including the library files!). It actually might be better to #define it in either a "prefix" file (if you're not using precompiled headers) or in a .h file that you include before any other headers. > Second, the shell sources > won't compile as is. There is a routine GXQDGlobalToFixedLocal, for example, > that doesn't exist in any of the gx .h files. I replaced it with > ConvertGXPoint, and used the parent view port of gcontentWindow to get the > local coords correct. Excellent exercise! :-) That routine went away between beta 1 and beta 3. > So, what did I miss. Do I have to do a #pramga parameters_in_a0 or something > like that around the gx interfaces? Here's the recommended "prefix" file for MW, most of which came from the GX SDK: /// #define ppcinterfaces #ifndef powerc // The following two typedef's are to work around a bug in the ETO #15 // Universal headers -- the headers only typedef float_t and double_t // for "applec" and "powerc". When this is eventually fixed, these // lines will generate "redefined type" errors. typedef long double float_t; typedef long double double_t; // The following is required if using Metrowerks 68K (CW4). // Otherwise, MetroWerks 68K expects (and uses what it thinks are) // A0 result values instead of D0 ones. #pragma pointers_in_D0 // Required for c-style toolbox glue. #endif /// On the November CDs (Bookmark 20 and Reference Library), the beta 1 GX shell will probably be replaced with the "modern" version that comes with the SDK (I still have to get buyoff for that, but I don't anticipate any problems). It uses the release version of GX, and the code has been cleaned up in a big way. Frankly I wouldn't recommend the old one any more, except as an "exercise for the reader." Have fun! Dave Johnson Technical Buckstopper d e v e l o p +++++++++++++++++++++++++++ >From lalonde@metrowerks.ca (Paul Lalonde) Date: Thu, 22 Sep 1994 11:24:47 GMT Organization: Metrowerks In article <1994Sep19.091728.1@whcdfo.fnal.gov>, gwatts@whcdfo.fnal.gov wrote: > Hi all, > I'm trying to teach myself some QDGX graphics this week. :) > Short story is I built GDGX Graphics Shell with MW and I get a trashed > stack ("sc" in Macsbug says my stack pointer is odd!). The precompiled version > on the develop CD bombs with a bus error as well. Details next: > I thought I would start by building the QDGX Graphics shell from Develop 15. > I pulled the source code from develop 19, and I'm using beta 3 of GX (I don't > system 7.5 yet, just 7.1). The app on the disk crashed my mac with a bus error. > So, I decided to recompile everything. > I'm using MW D/4. First thing I have to do is #define ppcinterfaces in all > the source files (including the library files!). Second, the shell sources > won't compile as is. There is a routine GXQDGlobalToFixedLocal, for example, > that doesn't exist in any of the gx .h files. I replaced it with > ConvertGXPoint, and used the parent view port of gcontentWindow to get the > local coords correct. When creating the "runFeatures" for the styled layout > shape, the second feather (alternateblahblah) doesn't exist in gx anylonger. > Is that right? For the time being, I've just removed it. > So, what did I miss. Do I have to do a #pramga parameters_in_a0 or something > like that around the gx interfaces? Why isn't this done automagically, if I > do have to do it. > I only just started last night, so I've not done a detailed step through > the program yet. I just figured that others starting out with GX may have > seen the same thing, and save me some time. Thought changing the to the > ConvertQDPoint taught me a bit about viewport coord systems! > Any help would be great! TIA. > > Cheers, > Gordon. I've been through this problem, and what I did was make myself a precompiled header whose source file included all of the GX headers. Everything was then wrapped between #pragma parameters_in_d0 and #pragma parameters_in_a0. Then things started working :) You see, contrary to almost the whole Toolbox, the GX graphics routines use the C calling convention. Problem is, those conventions vary from one compiler to the next. Hence the need for the #pragma. Also, if you're looking for those missing " alternateblahblah" declarations, there's a demo on the develop 17 CD (*not* called "QDGX Graphics shell", though) that puts up the same graphic as the shell on the develop 15 CD, so you can just cut and paste. Note: The headers changed between B1 and B3. Be sure you're using the right headers for the version you're running. Paul Lalonde lalonde@metrowerks.ca --------------------------- >From stone@phoenix.cs.uga.edu (Robert) Subject: Getting Started (Summary) Date: 17 Sep 1994 23:45:40 GMT Organization: kind of sloppy actually.... Thanks to everyone who sent responses to me. Here's a compilation of some of what I got when I asked about getting started with Macintosh programming for around $200. Hopefully this will prove helpful to others out there who are toying with the idea of attempting to learn Mac programming. >From Gary M. Greenberg <garyg@UFCC.UFL.EDU> Part of what you do should depend on how much _other_ programming background you have. Many newbies to the Mac are highly or fairly experienced on other platforms. If that's you, then get the biggest, baddest, _mostest_ package you can find (maybe even get SC++7.__ and CW Gold). On the other hand, if you're like me and you have no (zero) former programming experience, _and_ you're teaching yourself rather than studying CS at a university, then any ANSI C compiler and good books will be fine. I've been teaching myself how to code for a few months but I've only had a few actual weeks of time to spend working at it. Still, I've gotten through 7 chapters of the Waite Group's C Primer Plus, and I'm concurrently reading K&R's The C Programming Language, 2nd Edition. I'm also chipping away at a new book called Symantec C++ Programming for the Macintosh (with Diskette for about $35.00). I bought SC++6.0 for $50.00 and got the free upgrades from the SC FTP site. I'm sure that the OO Libraries are about 6-12 months beyond my reach given the limited time I can invest in learning right now, but I expect a geometric progression -- you should too. I've spent more on books than any other resource. The books on CD are okay if that is all money will permit, but you'll become hungry for the paper soon, as too much screen time weakens one's concentration. I've used them enough to know. And, I now subscribe to MacTech and Develop. I've written some very small _useless_ programs/exercises (and had fun each minute making them work) so my method is having a positive result. Books, source code, following c.s.m.p. and a.s.m. (that's alt.sources.mac) and lots of keystrokin' is what will bring it all together for you and the tool you choose (the brand of programming environment) will be less important. You'll see lots of passionate hooey about all the brands. Each has lovers and haters (I personally can't wait til my skills become sharp enough that I feel comfortable tackling Smalltalk) but they are only _tools_. I firmly believe that after you are successful at learning a language, you'll move around and experiment with many different types of tools. So, $200 [hey, I made it back to your topic ;-) ] is a comfortable starting point ... yet, it's just that ... a starting point. >From Tim Dixon <tdixon@css.tayloru.edu> If you're a student (or perhaps faculty, I don't know) CodeWarrior Gold is available at the educational price of $99. Call 1-800-377-5416 for details. [Regarding having a friend who's a student order for you:] That should work. A friend and I placed our orders at the same time. We had to place separate orders, but they let us both use his credit card (I don't have one so I paid him by check). They'll also accept a check. >From Peter S. Lau: well, CodeWarrier is quiet good, and you can tell by the recent created and active newsgroup comp.sys.mac.programmer.codewarrier. I think $99 to get the compiler (actually 3 compilers C, C++, and Pascal), plus tools, plus class library is definitely a bargain. I have used the demo version in Thomson's book. I feel quiet comfortable with it. A few third-party books are good, too. "Macintosh Programming Secrets" 2nd edition is good. I found it a bit wordy, but the examples are practical, so that's the good part. You might want to check the library. >From Robert B. Schmunk <pcrxs@nasagiss.giss.nasa.gov> The develop Bookmark CD no longer contains all the NIM books, but if you request a copy of issue #17 (backissues cost about $10), I understand that all that had been released before spring 1994 they're all on that one. To get the newer ones, you'll need to subscribe, which is something like $37 for four issues. Supposedly, Addison-Wesley will be publishing a CD sometime in the next couple months which contains nothing but a complete NIM (the Bookmark CD contains lots more), and the street price will supposedly be around $99. >From Eric Drumbor <ericd@netcom.com> I would check around for used books. I purchased volumes 1-6, the X-Reference, and a book on the Communications Toolbox (this was all from the old series) for $30. The CDs are nice to have, but it's much easier to have a book to use as a reference. I don't know what you have as far as beginners programming books (if you actually need them), but I would recommend either Learn C on the Macintosh and The C Programming Primer from Dave Mark, or Think THINK C by Dan Parks Sydow (Sydow has also written another "intermediate" book that explains more about the Macintosh Toolbox commands). Mark's books are fairly good, but I think Sydow has a better understanding on how to teach and what needs to be explained. What I've suggested goes over the $200 mark, but I'd recommend that you get Code Warrior and some kind of C book before you get a Develop subscription. I've spent over $600 in books alone, and I'm still waiting for my next paycheck to buy some more. Hope this helps..good luck! @@@@@ Robert Stone (stone@phoenix.cs.uga.edu) @@@@@ Some Sort of Computer-Related Person, UGA - Extension Dairy Sci. @@@@@ I am not responsible for anything I might say. +++++++++++++++++++++++++++ >From kenlong@netcom.com (Ken Long) Date: Mon, 19 Sep 1994 04:04:17 GMT Organization: NETCOM On-line Communication Services (408 261-4700 guest) If someone wanted to program on the Mac and had minimal finances, and could only afford a used Think C package, then what could they get to learn more? Kernighan on C - a big text (w.p.) document by Brian Kernigan on the C language, SpInside Mac, and as much example source as could be found and downloaded. The books are all expensive and many only give you example code and a book full of comments. Some have useful info not found in example code, but is it absolutely necessary for the price? I've found few source examples in books (or on the extra disks you'd buy) that did not have similar or identical example sources somewhere in cyberspace. And there are a LOT more examples in cyberspace that you'd not see in any bought book. I'm not against buying programming books - especially IM. I've got plenty of money tied up in them! But if you don't have any money, example source and SpInside Mac is your route. As far as value in programmer training, I'd say IM, example source and programmer message forums are far superior than Mac programming books. Think C 5's Standard Libraries manual was a real close second to K&R's. -Ken- +++++++++++++++++++++++++++ >From Clay Thurmond <claytex@panix.com> Date: 19 Sep 1994 04:45:00 GMT Organization: TVMHS In article <kenlongCwCzB5.Bsz@netcom.com> Ken Long, kenlong@netcom.com writes: >Kernighan on C - a big text (w.p.) document by Brian Kernigan on the C >language, SpInside Mac, and as much example source as could be found and >downloaded. The books are all expensive and many only give you example >code and a book full of comments. Some have useful info not found in >example code, but is it absolutely necessary for the price? I've heard of this Spinside Mac a number of times, but I've never been able to find it. Archie comes up dry. I haven't been able to locate it on ftp.apple.com either. Any idea where it is exactly? Also, is this Kernighan document available on the net? Thanks, Clay +++++++++++++++++++++++++++ >From jwbaxter@olympus.net (John W. Baxter) Date: Mon, 19 Sep 1994 12:05:37 -0700 Organization: Internet for the Olympic Peninsula In article <35j50c$o1v@news.panix.com>, Clay Thurmond <claytex@panix.com> wrote: > In article <kenlongCwCzB5.Bsz@netcom.com> Ken Long, kenlong@netcom.com > writes: > >Kernighan on C - a big text (w.p.) document by Brian Kernigan on the C > >language, SpInside Mac, and as much example source as could be found and > >downloaded. The books are all expensive and many only give you example > >code and a book full of comments. Some have useful info not found in > >example code, but is it absolutely necessary for the price? > > I've heard of this Spinside Mac a number of times, but I've never been > able to find it. SpInside Mac is a monster Hypercard stack (with bunches of supporting files). That in itself isn't so bad, but...SpInside Mac is also very obsolete (roughly speaking, it is part way between volumes I through V and volume VI, with some extras). I've ignored it on the last couple of years of CDs it has come on, and never looked for it on the net. --John -- John Baxter Port Ludlow, WA, USA [West shore, Puget Sound] "Occasionally...astronomers add a second to either June 31 or December 31..." IM: OS Utilities, p 4-12 jwbaxter@pt.olympus.net +++++++++++++++++++++++++++ >From d_spacey@icrf.icnet.uk (Dylan the Hippy Wabbit) Date: Wed, 21 Sep 1994 15:31:11 -0500 Organization: Imperial Cancer Research Fund In article <35j50c$o1v@news.panix.com>, Clay Thurmond <claytex@panix.com> wrote: > I've heard of this Spinside Mac a number of times, but I've never been > able to find it. Archie comes up dry. I haven't been able to locate it > on ftp.apple.com either. Any idea where it is exactly? Also, is this > Kernighan document available on the net? > > Thanks, > Clay Ftp to ftp.apple.com, I'm afraid I don't remember the directory name. Alternatively use http://dts.apple.com if you have a web browser. Either way be warned about the time/disk space requirements. There are eight parts taking up 7 1/2 meg. Being multipart you will need unstuffit rather than stuffit expander. Once you've got it you'll find it's like learning a language from a French/English dictionary. I've been scratching my head over the thing all year. Dave Spacey -- Don't underestimate the abacus......it requires no power, can be made with any materials you have to hand, and never goes bing in the middle of an important piece of work. (Many thanks to Douglas Adams.) +++++++++++++++++++++++++++ >From s.fraser@ic.ac.uk (Simon Fraser) Date: Wed, 21 Sep 94 19:52:09 BST Organization: Centre for Population Biology, Imperial College, UK. In article <35j50c$o1v@news.panix.com> Clay Thurmond, claytex@panix.com writes: >I've heard of this Spinside Mac a number of times, but I've never been >able to find it. Archie comes up dry. I haven't been able to locate it >on ftp.apple.com either. Any idea where it is exactly? Also, is this OK, here it is! ftp.apple.com:dts/mac/docs/stacks/spinside/spinside-mac-4-0-2-pt1.hqx ftp.apple.com:dts/mac/docs/stacks/spinside/spinside-mac-4-0-2-pt2.hqx ftp.apple.com:dts/mac/docs/stacks/spinside/spinside-mac-4-0-2-pt3.hqx ftp.apple.com:dts/mac/docs/stacks/spinside/spinside-mac-4-0-2-pt4.hqx ftp.apple.com:dts/mac/docs/stacks/spinside/spinside-mac-4-0-2-pt5.hqx ftp.apple.com:dts/mac/docs/stacks/spinside/spinside-mac-4-0-2-pt6.hqx ftp.apple.com:dts/mac/docs/stacks/spinside/spinside-mac-4-0-2-pt7.hqx The whole lot uncompresses into a 10.8Mb folder. I find it really useful (well, more so before I started to buy the new Inside Macintosh books (you'll see them referred to as NIM: Text for example). Stretching out the Hypercard stack to the height of a 14" monitor makes it a lot easier as well. I did this by a combination of 'set the userlevel to 5' in the message box, and having a new, unprotected stack open at the same time, which enabled me to get at the tool palette. You might also find the technotes stack useful-- 5.9 Mb worth! ftp.apple.com:dts/mac/docs/stacks/tnstack/tech-notes-stack-4-0-4-pt1.hqx ftp.apple.com:dts/mac/docs/stacks/tnstack/tech-notes-stack-4-0-4-pt2.hqx ftp.apple.com:dts/mac/docs/stacks/tnstack/tech-notes-stack-4-0-4-pt3.hqx ftp.apple.com:dts/mac/docs/stacks/tnstack/tech-notes-stack-4-0-4-pt4.hqx ftp.apple.com:dts/mac/docs/stacks/tnstack/tech-notes-stack-4-0-4-pt5.hqx Hope this helps! Simon P.S. the best time to access files of this size of off-peak at a weekend. It's dead fast early on a Sunday morning from the UK! __________________________________________________________________________ Simon Fraser NERC Centre for Population Biology s.fraser@ic.ac.uk Imperial College at Silwood Park Ascot, Berkshire, SL5 7PY. UK --------------------------- >From beltoft@icaen.uiowa.edu (Brian S Eltoft) Subject: Help: idle, shutdown, and MacTCP examples.. Date: 19 Sep 1994 13:31:21 GMT Organization: Iowa Computer Aided Engineering Network I'm looking for source code that shows how you would write a program to sense that the mac has been idle for sometime... as well as an example of a safe shutdown (as if I'm using the shutdown from the special menu). I tried the example found in Inside Mac, but it gives me an error of -609 when I try the AESend(..) I was also looking about for some examples of MacTCP... something that would do a finger... If anyone has any info on where to look for this code could you please mail it to: beltoft@icaen.uiowa.edu -- Brian Eltoft Email: beltoft@icaen.uiowa.edu +++++++++++++++++++++++++++ >From brook@psy.uwa.edu.au (Brook ) Date: 19 Sep 1994 23:28:43 GMT Organization: The University of Western Australia beltoft@icaen.uiowa.edu (Brian S Eltoft) writes: >I'm looking for source code that shows how you would write a program to >sense that the mac has been idle for sometime... as well as an example >of a safe shutdown (as if I'm using the shutdown from the special menu). >I tried the example found in Inside Mac, but it gives me an error of >-609 when I try the AESend(..) I was also looking about for some examples >of MacTCP... something that would do a finger... The following function is a correction to the one shown in IM:Processes and works for me. FUNCTION ShutDownSafely : OSErr CONST kFinderSig = 'MACS' VAR myErr: OSErr; finderAddr: AEDesc; myShutDown: AppleEvent; nilReply: AppleEvent; signature: OSType; BEGIN signature := kFinderSig; myErr := AECreateDesc ( typeApplSignature, @signature,SizeOf(OSType), finderAddr); IF myErr = noErr THEN myErr := AECreateAppleEvent ( kAEFinderEvents, kAEShutDown,finderAddr, kAutoGenerateReturnID, AnyTransactionID,myShutDown); IF myErr = noErr THEN myErr := AESend ( myShutDown,nilReply, kAENoreply + kAECanSwitchLayer + kAEAlwaysInteract, kAENormalPriority, kAEDefaultTimeOut,nil,nil); ShutDownSafely := myErr; END; -- Brooklyn Waters (Senior Programmer) email: brook@psy.uwa.edu.au Centre for Computer Managed Training and Decision Support Systems The University of Western Australia Tel: +61-9-3803637 NEDLANDS WA 6009 AUSTRALIA FAX: +61-9-3801006 +++++++++++++++++++++++++++ >From David_Seale@magic.ca (David Seale) Date: 21 Sep 1994 22:08:32 GMT Organization: Magic Online Services Toronto Inc. "I'm looking for source code that shows how you would write a program to sense that the mac has been idle for sometime... as well as an example of a safe shutdown (as if I'm using the shutdown from the special menu). I tried the example found in Inside Mac, but it gives me an error of -609 when I try the AESend(..)" I seem to remember that the -609 error is because the example in IM:Processes is wrong. I think that the solution is to change the Finder signature to 'MACS', instead of 'FNDR' or whatever they have. If that doesn't work, use the process manager to look for the Finder, and then use the ProcessSerialNumber version of the AE (That's what I did). The idle thing is not as hard as it sounds. I used a timer task to check to see if any of the keys were down on the keyboard (using GetKeys), and if the mouse was still in the same position, works very well. Hope this is helpful (and that I'm not confused again). Dave. david_seale@magic.ca --------------------------- >From fehrst@herald.usask.ca (Stuart Fehr) Subject: Pascal Flavours for Macintosh Date: 19 Sep 1994 19:16:07 GMT Organization: University of Saskatchewan Our campus bookstore sells two Pascal for Macintosh software packages. They are: Think Pascal by Symantec, and Pascal for the Macintosh, also by Symantec. What are the differences? Or, maybe I should ask, what is Pascal for the Macintosh? I haven't read or heard anything about it at all. I have been reading the posts on Think Pascal, but have seen no mention of this other one. There is a significant price difference too -- Pascal for the Macintosh is approx. $20.00 more than think Pascal. Any suggestions or information would be appreciated. +++++++++++++++++++++++++++ >From peter.lewis@info.curtin.edu.au (Peter N Lewis) Date: Wed, 21 Sep 1994 10:40:25 +0800 Organization: NCRPDA, Curtin University In article <35ko1n$5b8@tribune.usask.ca>, fehrst@herald.usask.ca (Stuart Fehr) wrote: >Our campus bookstore sells two Pascal for Macintosh software packages. >They are: Think Pascal by Symantec, and Pascal for the Macintosh, also >by Symantec. No idea. Symantec used to (and may still do) sell a Juse Enough Pascal which was a education tool or something, I'm not sure. Pascal Compilers: THINK Pascal 4.0.2 Object Pascal. 68k only. Very nice environment. Basically bug free, but the program is dead (it will likely never be updated) and is growing incompatiblities with each new system version. Metrowerks CodeWarrior Pascal No Objects (scheduled for the end of the year). Native & 68k, both are still in development and are not bug free. Quite nice environment, also still in development. Not quite production quality as yet, but this program is getting being worked on full time by Metrowerks, and will almost certainly be the Pascal compiler to choose after the end of the year. Language Systems Pascal Object Pascal. Native (& 68k?). Still in beta, I dont know how solid it is. MPW evironment only, so not really suitable for education/lab use if you want a friendly environment. MPW Pascal Object Pascal. 68K only. Free from serious bugs. Doesn't cut it for a standalone project when compared to Think Pascal but useful when you need to build something strange (INITs, DRVRs, etc). Enjoy, Peter. -- Peter N Lewis <peter.lewis@info.curtin.edu.au> - Macintosh TCP fingerpainter FTP my programs from redback.cs.uwa.edu.au:Others/PeterLewis/ or amug.org:pub/peterlewis/ or nic.switch.ch:software/mac/peterlewis/ --------------------------- >From bb@lightside.com (Bob Bradley) Subject: Q: Script-Independant Command-Keys? Date: Sun, 18 Sep 1994 10:54:40 -0800 Organization: SS Software Inc. I have a simple dialog for "Don't Save, "Cancel", "Save" and want to handle commands keys for the dialog correctly. Right now, I'm just checking for 'D', Escape or Command Period (I am doing international canceling), and Return or Enter, respectively but, I know there's a better way. I'd like to make the code localizable and to also get rid of data (the raw 'D' letter, etc..) from the source code (so I don't have t re-compile to change it). How would I go about this? I assume it would all be thru the use of the Script Manager but, I'm not sure on the implementation. +++++++++++++++++++++++++++ >From resnick@uiuc.edu (Pete Resnick) Date: Mon, 19 Sep 1994 23:38:05 -0500 Organization: University of Illinois at Urbana-Champaign In article <bb-1809941054400001@user53.lightside.com>, bb@lightside.com (Bob Bradley) wrote: > I have a simple dialog for "Don't Save, "Cancel", "Save" and want to > handle commands keys for the dialog correctly. Right now, I'm just > checking for 'D', Escape or Command Period (I am doing international > canceling), and Return or Enter, respectively but, I know there's a better > way. > > I'd like to make the code localizable and to also get rid of data (the raw > 'D' letter, etc..) from the source code (so I don't have t re-compile to > change it). > > How would I go about this? I assume it would all be thru the use of the > Script Manager but, I'm not sure on the implementation. For single-byte languages, this is easy: Just do a GetControlTitle() for each of the controls in the dialog (doing a GetDialogItem() to get the control handles) and then compare the keystroke with the first character of the control title. Use the same method you do for command-period to make sure that you get the correct ASCII character code, and then make sure to use the CompareText() or IdenticalText() routines so that case and diacriticals are handled properly. For double-byte languages, you're going to have a problem since the character codes for a single character are going to come through in two events. In this case, you could get really cute and force the keyboard to something that will produce single-bytes only (like Romanji in Japanese) and then Transliterate() the names of the buttons and compare the first character, but I think this gets a little absurd. Personally, if the current font for the buttons (i.e. the system font or the window font of your dialog if the buttons are useWFont) is a double-byte character font, I would punt on the "command key for the first letter of the button" method. pr -- Pete Resnick (...so what is a mojo, and why would one be rising?) Doctoral Student - Philosophy Department, Gregory Hall, UIUC System manager - Cognitive Science Group, Beckman Institute, UIUC Internet: resnick@uiuc.edu +++++++++++++++++++++++++++ >From bb@lightside.com (Bob Bradley) Date: Sun, 18 Sep 1994 14:19:30 -0800 Organization: SS Software Inc. In article <resnick-1909942338050001@resnick1.isdn.uiuc.edu>, resnick@uiuc.edu (Pete Resnick) wrote: > For single-byte languages, this is easy: Just do a GetControlTitle() for > each of the controls in the dialog (doing a GetDialogItem() to get the > control handles) and then compare the keystroke with the first character > of the control title. Use the same method you do for command-period to > make sure that you get the correct ASCII character code, and then make > sure to use the CompareText() or IdenticalText() routines so that case and > diacriticals are handled properly. > > For double-byte languages, you're going to have a problem since the > character codes for a single character are going to come through in two > events. In this case, you could get really cute and force the keyboard to > something that will produce single-bytes only (like Romanji in Japanese) > and then Transliterate() the names of the buttons and compare the first > character, but I think this gets a little absurd. Personally, if the > current font for the buttons (i.e. the system font or the window font of > your dialog if the buttons are useWFont) is a double-byte character font, > I would punt on the "command key for the first letter of the button" > method. I'd like to figure out a good method for storing the command-keys in a resource which I could pull out later since a few of the button command-keys I want to use are not the same as the first letter of the button (ie. Add is usually command-G). Is there anyway to tell if, when a double-byte script is installed the user types the first half of a double-byte character? If so, I could detect this, store the first half and if the second half comes thru in the next event, do my compare as I would with a regular key. I'd like to store the command-keys as a string resource with each key as an individual string with the string id (index if in a STR# resource) relating the particular button. Could I just compare the key entered with the key stored in the string to see if they are equal or would I have to use a special Script Manager comparison routine? +++++++++++++++++++++++++++ >From ari@world.std.com (Ari I Halberstadt) Date: Wed, 21 Sep 1994 04:19:44 GMT Organization: The World Public Access UNIX, Brookline, MA In article <resnick-1909942338050001@resnick1.isdn.uiuc.edu>, Pete Resnick <resnick@uiuc.edu> wrote: >In article <bb-1809941054400001@user53.lightside.com>, bb@lightside.com >(Bob Bradley) wrote: > >> I have a simple dialog for "Don't Save, "Cancel", "Save" and want to >> handle commands keys for the dialog correctly. Right now, I'm just >> checking for 'D', Escape or Command Period (I am doing international >> canceling), and Return or Enter, respectively but, I know there's a better >> way. >>... >For single-byte languages, this is easy: Just do a GetControlTitle() for >each of the controls in the dialog (doing a GetDialogItem() to get the >control handles) and then compare the keystroke with the first character >of the control title. Use the same method you do for command-period to >make sure that you get the correct ASCII character code, and then make >sure to use the CompareText() or IdenticalText() routines so that case and >diacriticals are handled properly. A resource that defines equivalence between buttons and command keys. Use some special resource type, say "CMDK" or "DLCK" (dialog command key), or whatever, and give it the same ID as the dialog or alert. Or a <clover><char> syntax you tack onto the end of the button names, then extract before displaying the dialog or alert. Other languages might not have unique first-character button names, and you might not want command key equivalence for some buttons, etc. so storing it in the resource data is more flexible. -- Ari Halberstadt ari@world.std.com One generation passes away, and another generation comes: but the earth abides for ever. -- Ecclesiastes, 1:4. +++++++++++++++++++++++++++ >From lalonde@metrowerks.ca (Paul Lalonde) Date: Thu, 22 Sep 1994 23:46:20 GMT Organization: Metrowerks In article <bb-1809941054400001@user53.lightside.com>, bb@lightside.com (Bob Bradley) wrote: > I have a simple dialog for "Don't Save, "Cancel", "Save" and want to > handle commands keys for the dialog correctly. Right now, I'm just > checking for 'D', Escape or Command Period (I am doing international > canceling), and Return or Enter, respectively but, I know there's a better > way. > > I'd like to make the code localizable and to also get rid of data (the raw > 'D' letter, etc..) from the source code (so I don't have t re-compile to > change it). > > How would I go about this? I assume it would all be thru the use of the > Script Manager but, I'm not sure on the implementation. You would basically need a modal dialog filter proc in which, every time a key down was received with the command key down, you loop through all of the items in the dialog's item list. If an item is a button, you retrieve its title and compare the first character with the character just pressed. Of course, if you also want to deal with double-byte systems, you need to store state information between calls to the filter proc so you will know if a key corresponds to the first or second byte of a character. Paul Lalonde lalonde@metrowerks.ca +++++++++++++++++++++++++++ >From bb@lightside.com (Bob Bradley) Date: Wed, 21 Sep 1994 16:21:17 -0800 Organization: SS Software Inc. In article <lalonde-2209941946200001@slip68.dialup.mcgill.ca>, lalonde@metrowerks.ca (Paul Lalonde) wrote: > You would basically need a modal dialog filter proc in which, every time > a key down was received with the command key down, you loop through all of > the items in the dialog's item list. If an item is a button, you retrieve > its title and compare the first character with the character just pressed. > > Of course, if you also want to deal with double-byte systems, you need to > store state information between calls to the filter proc so you will know > if a key corresponds to the first or second byte of a character. The way I'm doing it now is to create a key item command table when the dialog is create based on a custom resource that contains the key (just a 2 byte short), the item it goes with, and which modifiers are required (ie. command, option, control) then when I get a key down, in my proc to handle key downs in dialogs (they are all modeless) I search the table for the typed key and check whether or not the correct modifiers were down when it was pressed (I also use the method in the Tech Note International Canceling to work with keyboards that discharge the shift key when the command key is down). I also made a simple Resorcerer template for creating and editing the key item command table It seems to work ok but, I haven't tested it with any non-roman scripts. --------------------------- >From gpointer@guest.adelaide.edu.au (Geoff Pointer) Subject: XCMD memory residence Date: 19 Sep 1994 10:50:46 GMT Organization: Individual I am trying to manage an external window for Hypercard. It is geared to handle several windows open at once and I have handled the fact that all windows will be using the same copy of the XCMD code. What I am not clear about, is what can happen to the code resource in between event calls. I am aware that it can be moved in memory but can it ever be purged? I am presently basing my logic on the code not being purged and being copied from its original location in memory when it is moved rather than recopied from the original resource. Is it possible to get definitive answers?? My problem involves how I use certain globals (via A4, I use Code Warrior). I use RefCon stuff for the globals that go with each individual window, but I need special action for the first window open and the last window closed, which involves retaining knowledge across individual event calls. - --------- Cheers - Geoff %^> ---------- Voice: 61 8 362 9890 63 Lambert Rd Fax: 61 8 363 2682 Joslin SA 5070 Australia - --------------------------------------- +++++++++++++++++++++++++++ >From e-baumgartner@nwu.edu (Eric Baumgartner) Date: Mon, 19 Sep 1994 16:27:53 -0500 Organization: Northwestern University In article <35jqe6$qgt@quandong.itd.adelaide.edu.au>, gpointer@guest.adelaide.edu.au (Geoff Pointer) wrote: > all windows will be using the same copy of the XCMD code. What I am not > clear about, is what can happen to the code resource in between event > calls. I am aware that it can be moved in memory but can it ever be > purged? > My problem involves how I use certain globals (via A4, I use Code > Warrior). I use RefCon stuff for the globals that go with each individual > window, but I need special action for the first window open and the last > window closed, which involves retaining knowledge across individual event > calls. Yes, your xcmd can be purged in between event calls. If you want to use "global globals" I know of two options: 1. Tell HC that you have interrupt code by calling XWHasInterruptCode. Evil, evil, evil, but it'll keep your code resource resident and locked. 2. Use a HC global to store your globals. You could store the address of a handle containing the globals, or you could store the globals themselves in text form in the HC variable. I'd be curious to hear if anyone has any other suggestions. Eric Baumgartner * Email: e-baumgartner@nwu.edu Learning Sciences * Phone: 708/467-2816 School of Education and Social Policy * Northwestern University * +++++++++++++++++++++++++++ >From ari@world.std.com (Ari I Halberstadt) Date: Tue, 20 Sep 1994 01:01:20 GMT Organization: The World Public Access UNIX, Brookline, MA In article <35jqe6$qgt@quandong.itd.adelaide.edu.au>, Geoff Pointer <gpointer@guest.adelaide.edu.au> wrote: > I am trying to manage an external window for Hypercard. It is geared >to handle several windows open at once and I have handled the fact that >all windows will be using the same copy of the XCMD code. What I am not >clear about, is what can happen to the code resource in between event >calls. I am aware that it can be moved in memory but can it ever be >purged? I am presently basing my logic on the code not being purged and >being copied from its original location in memory when it is moved rather >than recopied from the original resource. Is it possible to get definitive >answers?? > My problem involves how I use certain globals (via A4, I use Code >Warrior). I use RefCon stuff for the globals that go with each individual >window, but I need special action for the first window open and the last >window closed, which involves retaining knowledge across individual event >calls. > You can mark the XCMD resource as non-purgeable. But that still doesn't prevent HyperCard, or anyone else, from explicitely purging it. Better to set a HyperCard global variable from within your XCMD. There are a couple of call-backs for setting and retrieving a global variable's value. When your XCMD exits, it sets the value of the global to a handle to some structure containing the state information. When the last window is disposed of, you clear the global (set it to the empty string). You should give the global some unlikely name. For instance, if the XCMD is called "MyXCMD", I'd call the global "gMyXCMD". The "g" is just that Apple pseudo-standard for global variables, and the "MyXCMD" part makes it clear to anyone looking at the global in the debugger that it's part of your XCMD, and also reduces the chance that someone will use the same name for their own global variable. -- Ari Halberstadt ari@world.std.com One generation passes away, and another generation comes: but the earth abides for ever. -- Ecclesiastes, 1:4. +++++++++++++++++++++++++++ >From jkc@apple.com (John Kevin Calhoun) Date: 22 Sep 1994 16:45:21 -0700 Organization: Apple Computer Inc, Cupertino, CA In article <35jqe6$qgt@quandong.itd.adelaide.edu.au>, Geoff Pointer <gpointer@guest.adelaide.edu.au> wrote: > I am trying to manage an external window for Hypercard. It is geared >to handle several windows open at once and I have handled the fact that >all windows will be using the same copy of the XCMD code. What I am not >clear about, is what can happen to the code resource in between event >calls. I am aware that it can be moved in memory but can it ever be >purged? I am presently basing my logic on the code not being purged and >being copied from its original location in memory when it is moved rather >than recopied from the original resource. Is it possible to get definitive >answers?? It's not possible to prevent an XCMD or XFCN resource from being purged unless you also prevent it from being moved. You can do this with the callback XWHasInterruptCode, which, in effect, locks the resource in memory. However, leaving something locked in an unpredictable location in HyperCard's heap is a very unfriendly thing to do, unless it's absolutely necessary. Furthermore, Apple does not guarantee that HyperCard's handling of XCMD and XFCN resources will remain the same with each release of HyperCard; in fact, it changed between 1.x and 2.x and might change again. Therefore I think it's not wise to rely on the way HyperCard currently executes external code. > My problem involves how I use certain globals (via A4, I use Code >Warrior). I use RefCon stuff for the globals that go with each individual >window, but I need special action for the first window open and the last >window closed, which involves retaining knowledge across individual event >calls. Instead of relying on A4 globals, you can store and update a count of your windows in a HyperTalk global, which you can access via the SetGlobal and GetGlobal callbacks. With HyperCard 2.2, it's possible to count your windows on the fly, as follows: function countWindowsOf externalName put 0 into count repeat with thisWindow = 1 to the number of windows if the owner of window thisWindow is externalName then add 1 to count end repeat return count end countWindowsOf >From an external you could execute similar HyperTalk code by using the RunHandler callback. Kevin Calhoun jkc@apple.com --------------------------- End of C.S.M.P. Digest **********************