dudek@utai.UUCP (09/10/87)
Having played around with MultiFinder and Hypercard a little, I have a few questions and some wishes for HC. Under MultiFinder, Does anybody know how you can tell you're running in this environment? I presume that the switcher globals are still used, but how do you know you're not under switcher or servant? You could check out the name of the application running the show, but that would hardly be robust. If you do a sublaunch, I thought this adds another partition with the new program in it. Presumably your program exits at this point as it used to? Is there a way to fork off a new partition and application WITHOUT closing the current application? ---- Playing around with HC scripts a bit, I get the feeling the script language could use a little more string manipulation power. In particular, it seems like it could really use some simple regular expression matching. Even simpler, it would be nice to be able to test whether an argument is numeric so you can decide how to handle it. Ain't there any way to do this simple thing without resorting to absolute brute force?? (brute force: got any 0s?, got any 1s, got any 2s, ....) Ideally, I guess it would be nice if it had the power of ICON or SNOBOL or something, but maybe that's being unreasonable. Greg Dudek -- Dept. of Computer Science (vision group) University of Toronto Usenet: {linus, ihnp4, allegra, decvax, floyd}!utcsri!dudek CSNET: dudek@ai.toronto.edu ARPA: dudek%ai.toronto.edu@csnet-relay DELPHI: GDUDEK Paper mail: Dept. of Comp Sci, Univ of Toronto, Toronto, Canada
lsr@apple.UUCP (Larry Rosenstein) (09/12/87)
In article <4060@utai.UUCP> dudek@ai.UUCP (Gregory Dudek) writes: > > Does anybody know how you can tell you're running in this environment? >I presume that the switcher globals are still used, but how do you know I have a review copy of a Tech Note on Multifinder. (Since it hasn't been oficially released, I won't go into specific details, but just give you the basic ideas.) The question is why do you need to know whether you are running under Multifinder? Usually, you just want to know if one of the Multifinder features is available (eg, WaitNextEvent, temporary memory allocation, etc.) In this case, you just see if the appropriate trap is implemented or not. Multifinder does not use the same Switcher globals, since its does not provide the same programmatic interface. (If it did use the same globals, applications that could work directly with Switcher might get confused.) In fact, part of the test to see if Multifinder is installed is to check the Switcher globals to make sure Switcher is not running. > If you do a sublaunch, I thought this adds another partition >with the new program in it. Presumably your program exits at this >point as it used to? Is there a way to fork off a new partition and >application WITHOUT closing the current application? Tech Note #126 describes how to do sublaunching, by passing extra parameters to the Launch trap. I believe that if you follow this Tech Note, then Multifinder will launch the application in its own partition without terminating the parent. -- Larry Rosenstein Object Specialist Apple Computer AppleLink: Rosenstein1 UUCP: {sun, voder, nsc, mtxinu, dual}!apple!lsr CSNET: lsr@Apple.com
keith@apple.UUCP (Keith Rollin) (09/12/87)
In article <4060@utai.UUCP> dudek@ai.UUCP (Gregory Dudek) writes: > Under MultiFinder, > Does anybody know how you can tell you're running in this environment? >I presume that the switcher globals are still used, but how do you know >you're not under switcher or servant? You could check out the name of the >application running the show, but that would hardly be robust. > > If you do a sublaunch, I thought this adds another partition >with the new program in it. Presumably your program exits at this >point as it used to? Is there a way to fork off a new partition and >application WITHOUT closing the current application? You may want to check out Mec TechNote #158 (released in the September batch) called "Frequently asked MultiFinder Questions". In it, Jim Friedlander answers the questions "How can I tell if WaitNextEvent is implemented?", "How can I tell if the MultiFinder temporary Memory Allocation calls are implemented?", "How can I tell if my program is running in the background?", "When does juggling (context switching) take place?", "Can I disable SUSPEND/RESUME events?", etc. It also makes a reference to the "MultiFinder Developer's Package" presumably available from Mac DTS and soon from APDA. > Playing around with HC scripts a bit, I get the feeling the script >language could use a little more string manipulation power. In particular, >it seems like it could really use some simple regular expression >matching. > Even simpler, it would be nice to be able to test whether an >argument is numeric so you can decide how to handle it. Ain't there any >way to do this simple thing without resorting to absolute brute force?? > (brute force: got any 0s?, got any 1s, got any 2s, ....) > > Ideally, I guess it would be nice if it had the power of ICON or SNOBOL >or something, but maybe that's being unreasonable. I'd suggest maybe writing a simple XCMD to do those things for you. As for testing to see if a string is numeric, try the "value" function (Syntax: "the value of <source>", or "value(<source>)"). This function evaluates the string in <source>. However, I don't know how it chokes if you set <source> to "MarseyDotes" or something like that. Keep those HyperCard suggestions coming; I noticed that Dan Winkler subscribes to this group. Keith Rollin Sales Tech Support Apple Computer Disclaimer: Any rumours I spread I got somewhere else first.
daveb@geac.UUCP (Brown) (09/14/87)
In article <6209@apple.UUCP> lsr@apple.UUCP (Larry Rosenstein) writes: >In article <4060@utai.UUCP> dudek@ai.UUCP (Gregory Dudek) writes: >> Does anybody know how you can tell you're running in this environment? >>I presume that the switcher globals are still used, but how do you know > >The question is why do you need to know whether you are running under >Multifinder? Usually, you just want to know if one of the Multifinder >features is available (eg, WaitNextEvent, temporary memory allocation, etc.) >In this case, you just see if the appropriate trap is implemented or not. Well, one may want to know if a group of capabilities are present and give an application global a mnemnonic name... like MultiFinderUsed... For single capabilities, the test is trivial. But can one conveniently infer that capability XXX exists if YYY does? Ie, are later Apple products proper supersets of earlier ones? This is part of the "version problem", and a technique which works well is to have a "Capabilities" variable in the program, containing a named bit for each capability used, and setting it from a set of constants. The constants are generated from a manual survey of capabilities for each version (to date) of an operating system. This in turn implies a means of identifying a version of the operating system. Were I Apple, I might want to provied either a version number or a convenient method of asking for the capabilities vector (ie, a bitmap in the ROM might be nice and cheap). Apple/developers are invited to get details by mail... --dave (note the quote below re the above) c-b -- David Collier-Brown. {mnetor|yetti|utgpu}!geac!daveb Geac Computers International Inc., | Computer Science loses its 350 Steelcase Road,Markham, Ontario, | memory (if not its mind) CANADA, L3R 1B3 (416) 475-0525 x3279 | every 6 months.
jww@sdcsvax.UCSD.EDU (Joel West) (09/16/87)
The information you describe is contained in Macintosh Technical Note #129, which describes the use of the SysEnvirons library call. -- Joel West (c/o UCSD) Palomar Software, Inc., P.O. Box 2635, Vista, CA 92083 {ucbvax,ihnp4}!sdcsvax!jww jww@sdcsvax.ucsd.edu or ihnp4!crash!palomar!joel joel@palomar.cts.com
lsr@apple.UUCP (09/17/87)
In article <1365@geac.UUCP> daveb@geac.UUCP (Dave Collier-Brown) writes: > This is part of the "version problem", and a technique which works >well is to have a "Capabilities" variable in the program, containing a >named bit for each capability used, and setting it from a set of constants. This has been implemented. Tech Note #129 describes the SysEnvirons trap, which will give programs information about the system. The mechanism uses version numbers on the information records, so it is extensible. The first version does not include information about Multifinder (since it hadn't been released at the time), but I would expect that future SysEnvirons version will include that information. MacApp 1.1 has its own capabilities record, which is automatically filled in when the application starts up. -- Larry Rosenstein Object Specialist Apple Computer AppleLink: Rosenstein1 UUCP: {sun, voder, nsc, mtxinu, dual}!apple!lsr CSNET: lsr@Apple.com
lsr@apple.UUCP (09/17/87)
In article <4066@utai.UUCP> dudek@ai.UUCP (Gregory Dudek) writes: > > How do you determine if a trap is implemented? You mean check the >system version? Regardless of whether the traps are there, I need to >know if MF is running since under MF, I may get very special behavior >(concurrent execution) which I want/need to handle specially (see below). Toolbox trap number $9F is unimplemented on all machines. You do a GetTrapAddress on the trap in question and see if the address is the same as the uninmplemented trap. The Multifinder Tech Note is out now (#158). WaitNextEvent is Toolbox trap number $60. Multifinder also has a generic dispatch trap (Toolbox $8F). Testing to see if WaitNextEvent is implemented is not the same as testing whether Multifinder is running. (Future systems may include WaitNextEvent w/o Multifinder.) The Tech Note gives the example oftesting for Multifinder temporary memory calls. First you test if Switcher is not active (the long word at location $282 is -1 or 0); then you test if the Multifinder trap exists. I assume that this same test would tell you if Multifinder exists or not. > Are you sure about that? This sounds like it would be tricky since >in the "normal" (old) environment, a launch, even a sublaunch, causes >the program to exit. If sublaunching under MF *DOES NOT* cause the program >to exit (i.e. the launch returns), programs for the "old" environment >may bust since they don't expect to execute the code following the >Launch trap. The sublaunching Tech Note does mention that the Launch trap might return in the future, so I believe that what I said before is true. (It also warns that applications that call Launch could be broken in the near future.) > The reason I would like to be able to detect *IF* MF running is so >that I know how to resume next time I get control. If I can "fork" off >a new concurrent process, I don't have to save the state information I >would need with an old-style sublaunch. MPW Shell does this also. If Multifinder is around, it does not run its suspend script, since the Shell will not be terminated. I don't know how it tests for this case, however. > Re. hypercard: if the task exit abnormally (for example a DA is nasty >enough to call ExitToShell directly) HC does not remove it's trap patches. >As a well-behaved application, shouldn't HC use that ExitToShell hook that >allows it to be notified on exit & clean up after itself? I think this is a bug, although one could argue that ExitToShell should not normally be called except under application control. (A DA that does so is definitely unfriendly, and the next most likely way this could happen is from a debugger.) Using the IAZNotify global is problematical (see Tech Note #64). At the time it has been called, your program's global variables might have been wiped out, and the application's resource file has been closed, so you have to make sure that only resident code does the cleanup. In MacApp, we cleaned up after ourselves by patching the ExitToShell trap itself and doing the cleanup there. This solves the problem except for Macsbug's EA command, which does a Launch instead of an ExitToShell. -- Larry Rosenstein Object Specialist Apple Computer AppleLink: Rosenstein1 UUCP: {sun, voder, nsc, mtxinu, dual}!apple!lsr CSNET: lsr@Apple.com