info-mac@uw-beaver (info-mac) (07/15/84)
From: Bill Croft <croft@safe> I was curious about just how fast a program could be launched, so I tryed out the "mini Finder" below. Here are the times: Finder MiniFinder launch tiny program 7 secs 2 secs ExitToShell 16 secs 4 secs Of course the Finder does a lot of things besides starting programs, so this comparison is unfair. However I frequently find myself in a mode where I'm just running one program after another. For example, MacTerminal to download a program, followed by executing that program. Or MacPaint followed by MacWrite to insert pictures into a document. To use the miniFinder (called mFinder), you run it from the real Finder. mFinder then installs itself as the FinderName in locore, so that when other programs exit the Mac returns to mFinder. To run a program from inside mFinder, just double-click it, or type the first letter of its name followed by CR, or select it with the mouse and OPEN. If you select CANCEL, mFinder will deinstall itself and return to the real Finder. Note nothing on disk is changed, so that if you reboot, you'll get the normal Finder. Alternately, you could use the Finder menu item to install mFinder as the "startup file". Here's the program. If you don't want to compile it you can get <info-mac>mfinder.rsrc from SUMEX and download it with "macput -r mfinder". ---- mfinder.c /* mfinder.c 1.0 07/08/84 */ /* * Mini Finder. */ /* * history * 07/08/84 Croft Created. */ #include "mac/quickdraw.h" #include "mac/osintf.h" #include "mac/toolintf.h" #include "mac/packintf.h" #define NIL 0 #define FINDERNAME 0x2e0 short where[] = { 40, 40 }; char types[] = "APPL"; char myname[] = "mFinder"; struct launchparams { char *lnamep; long lunknown; short lsound; } lparams; char lname[32]; main() { struct QDVar newqd; SFReply sfr; char *old,*new; QD = &newqd; InitGraf(&thePort); InitFonts(); InitWindows(); InitDialogs((ProcPtr)NIL); SetCursor(&newqd.arrow); /* install myself as new finder */ strcpy(FINDERNAME, myname); c2pstr(FINDERNAME); SFGetFile((Point *)where, "",(ProcPtr)NIL, 2,types, (ProcPtr)NIL, &sfr); p2cstr(sfr.fName); if (sfr.good) Launch(sfr.fName); /* If cancel was selected, deinstall myself and exit to real Finder. */ strcpy(FINDERNAME, "Finder"); c2pstr(FINDERNAME); } Launch(name) char *name; { strcpy(lname,name); c2pstr(lname); lparams.lnamep = lname; _launch(); ExitToShell(); /* if Launch failed */ } ----mfindasm.s .globl _launch .globl lparams _launch: lea lparams,a0 .word 0xa9f2 rts .text .globl _sfgetfil _sfgetfil: moveq #2,d2 gopack: movl sp@+,a0 |get user's rts movw d2,sp@- |the routine selector movl a0,sp@- |push the rts back on .word /adea |__pack3 w/autopop |never gets here