home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
code
/
ras_swit.sit
< prev
next >
Wrap
Text File
|
1988-06-20
|
2KB
|
111 lines
18-Jun-88 14:45:45-MDT,2362;000000000000
Return-Path: <u-lchoqu%sunset@cs.utah.edu>
Received: from cs.utah.edu by SIMTEL20.ARPA with TCP; Sat, 18 Jun 88 14:45:41 MDT
Received: by cs.utah.edu (5.54/utah-2.0-cs)
id AA22675; Sat, 18 Jun 88 14:45:41 MDT
Received: by sunset.utah.edu (5.54/utah-2.0-leaf)
id AA24815; Sat, 18 Jun 88 14:45:39 MDT
Date: Sat, 18 Jun 88 14:45:39 MDT
From: u-lchoqu%sunset@cs.utah.edu (Lee Choquette)
Message-Id: <8806182045.AA24815@sunset.utah.edu>
To: rthum@simtel20.arpa
Subject: Switch.ras
Program Switch;
(*
Switch
Written By Scott Gillespie
With the Rascal Development System
Desk Accessory which switches the Finder name in low memory.
*)
Uses __ToolTraps, __QuickDraw, __OSTraps,
(*$U+*) uOSIntf ;
Link __NoSysCall, __OSTraps :;
Const
MenuID = -2001;
FNameLoc = $2E0L; (* Location of Finder Name in low memory *)
BootDrive = $210L;(* System Vref location in low memory *)
Type
Fptr = ^Byte[16];
Var
Menu: PtrL;
AppName: Byte[256];
Param: ParamBlockRec;
PROCEDURE getfinfo(ind,vref: integer; err: ^OSErr);
{
Param.IONamePtr := @AppName;
Param.IOVRefNum := vref;
Param.IOFDirIndex := ind;
Param.IOVersNum := 0;
err^ := PBGetFInfo(Param,False);
};
Proc Make(Name: Byte[16]); (* Put a new name in low mem *)
{
If Name[0]>15 Then Return; (* There's only room for 15 characters *)
Fptr(FNameLoc)^ := Name;
};
Proc SetUpMenu();
Var
Err,i: OSErr;
Appl: Longint;
{
Appl := PtrL(" APPL"+2)^;
Menu := NewMenu(MenuID,"Switch");
InsertMenu(Menu,0);
AppendMenu(Menu,"Finder");
Loop(,i:=1,++i,) { (* Get all of the applications on
the System disk *)
GetFInfo(i,Ptrw(BootDrive)^,@Err);
If Err Then Break; (* Assume the index is too high, so
no more files to check *)
If Appl = PtrL(@Param.ioFlFndrInfo.FDType)^ Then
AppendMenu(Menu,AppName);
};
DrawMenuBar();
};
Proc _Init();
{
MoveTo(0,2);
Writeln();
SetUpMenu();
DrawString(FnameLoc);
};
Proc _Halt();
{
DeleteMenu(MenuID);
DisposeMenu(Menu);
DrawMenuBar();
};
Proc _Menu(id,item: Integer);
Var P: Ptrl;
{
GetPort(@P);
SelectWindow(P);
GetItem(Menu,item,@AppName);
Make(AppName);
Writeln();
DrawString(FnameLoc);
ReqHalt();
HiliteMenu(0);
};