mini Finder

Info-Mac discussion from 1984 - 2002.
Locked
User avatar
Info-Mac
Administrator
Posts:13716
Joined:December 21st, 1988, 11:00 am
mini Finder

Post by Info-Mac » August 28th, 1984, 1:24 am

Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 UW 5/3/83; site uw-beaver
Path: utzoo!watmath!clyde!burl!mgnetp!ihnp4!houxm!houxz!vax135!cornell!uw-beaver!info-mac
From: info-mac@uw-beaver (info-mac)
Newsgroups: fa.info-mac
Subject: mini Finder
Message-ID:
Date: Sun, 15-Jul-84 01:55:00 EDT
Article-I.D.: uw-beave.1152
Posted: Sun Jul 15 01:55:00 1984
Date-Received: Tue, 10-Jul-84 00:49:55 EDT
Sender: daemon@uw-beave
Organization: U of Washington Computer Science
Lines: 115

From: Bill Croft
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
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
Locked