******************************************************************************
*                                                                            *
* IR - an Init (and Desk accessory and maybe driver) Restarter               *
*                                                                            *
* IR also is the Spanish verb meaning "to go" and is thus pronounced "ear".  *
* This, incidentally, has little or no relevance.                            *
*                                                                            *
* By Matt Deatherage.  Copyright 1990 Apple Computer, Inc.                   *
*                                                                            *
******************************************************************************

IR by itself doesn't do anything.  In fact, if you just launch IR it will simply quit back to your launcher.  It only performs actions based on messages in the Message Center, as are created by the Finder when you double-click on a document icon.

You'll find in this folder IR, this file, and IR.Icons.  If you want to put IR in your system folder (*/System/IR), you're set to go.  Just put IR in your system folder and the Icons in your Icons folder.  If you want to put IR elsewhere, you'll have to use an icon editor to change the pathname of the IR icons.

IR comes with five icons (no icon is included for IR itself).  IR claims CDAs, NDAs, drivers and permanent and temporary inits.  When you double-click a file of one of these types, IR will be launched.

IR performs the following actions:

*     Installs and executes permanent and temporary inits
*     Installs classic and new desk accessories
*     Installs GS/OS non-supervisory drivers

IR does not copy these to the system folder; they're only installed until you reboot.

Installing inits can be useful in many cases.  I sometimes unload GSBug for various reasons; IR lets me reinstall it without rebooting.  You can also reexecute things like start-up sounds or pictures, if it floats your boat.  Inits are installed the proper way, including the word on the stack above the RTL address that permanent inits can change to non-zero if they want to be shut down anyway (System Software 4.0 and later).

Installing DAs helps tremendously when writing them, especially if you're using MPW IIgs cross-development and therefore probably spend a lot of idle time in the Finder.  You can also keep lots of DAs around in your Desk.Accs folder and keep most of them inactive, using IR to install the ones you only need occasionally when you need them.  Double-clicking an inactive DA (or init or driver) works; the inactive flag just means the thing isn't installed at boot time.

Installing GS/OS drivers isn't that useful, as the installation mechanism isn't well-defined.  The installation happens asynchronously (it doesn't happen when IR calls INSTALL_DRIVER, it happens on the next device call) so IR has no way of knowing if the Driver_Startup call was successful or not.  Some drivers don't like this too much anyway.  In my experiments, using IR to load a third-party hard disk driver did not successfully replace the generated driver, and using IR to load either the SCSIHD.Driver or SCSICD.Driver crashes the system.  This may get fixed in the future.

For now, though, IR does work very nicely with the AppleDisk5.25 driver.  You can set slot 6 to "Disk Port" and keep the driver inactivated; GS/OS won't poll the drives (or even recognize them) until you use IR to install the driver, and then they magically appear without rebooting.  (Note that the drives will always appear in P8.)

IR has two other options while executing.  If the Command (Open-Apple) key is down, IR will attempt to restart the DA/Init/Driver from memory before trying InitialLoad to create a new copy.  If the Shift key is down, IR will call UserShutDown on this file's user ID before calling InitialLoad.  You can hold down both keys at once, but since the file will be shut down before _Restart is called, this doesn't make much sense.

These options are provided for the use of people who need them.  BE VERY CAREFUL WHEN USING THE COMMAND OR SHIFT KEYS WITH IR.  You can easily get yourself into a LOT of trouble (nothing rebooting can't fix, usually) if you don't know exactly what you're doing.  I imagine most people will stay away from these options (I do).

A few notes about using IR with GSBug:  GSBug through 1.5b9 has an "unload" command that works a little strangely.  It successfully disposes of its own handle but it doesn't call UserShutDown on itself.  This means that the Loader has a handle which can get reallocated to point to memory that GSBug no longer occupies.  If you "unload" GSBug and try to reinstall it with the Command key held down, Restart will return an address that doesn't contain GSBug.  If you use the Shift key, the Loader will dispose of a handle that probably doesn't contain GSBug anymore.  DON'T USE EITHER SPECIAL KEY WHEN RELOADING GSBUG.  This means you'll have a bogus user ID in the loader's tables with a bogus address, but as long as you stay clear of it nothing bad will happen.

If you have any comments or suggestions for IR, please contact me.

America Online:  Matt DTS
CompuServe:      72277,2476
GEnie:           M.DEATHERAGE
AppleLink:       Deatherage1
Internet:        mattd@apple.com (not checked frequently)

I hope IR is useful to you.

--Matt