Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: net.micro.mac Subject: Re: Init Resources in another file... Message-ID: <999@hoptoad.uucp> Date: Fri, 15-Aug-86 06:55:12 EDT Article-I.D.: hoptoad.999 Posted: Fri Aug 15 06:55:12 1986 Date-Received: Fri, 15-Aug-86 20:41:21 EDT References: <4657@decwrl.DEC.COM> <96900032@uiucuxc> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Centram Systems, Berkeley Lines: 43 Summary: It's easy, and fun for the whole family. As per Steve Dorner's request, I am posting information on INIT resources outside the system file. A new INIT resource, INIT 31, was written at Apple some months ago. It searches for files of type 'INIT' and 'RDEV' at system startup time, and executes any 'INIT' resources in those files. The files may be anywhere on the volume under MFS, but must be in the blessed folder under HFS. (I don't think putting them in the root works, but it might.) That's really about all there is to it. I have written two different ones for projects at Centram, and the initialization for Centram's main project, the file server/client TOPS, is in another of these external INIT resources. I don't know what the recently alluded-to problems were, but we never had any trouble getting ours to execute. The INIT 31 resource is in the new ROMs, but in the old ROMs the INIT resource has to be in the system file. There are slight differences between the two versions; mostly, in the ROM version, the files will be opened in alphabetical order, but not so in the RAM version. The INIT resource is assumed to contain 68000 object code; the entry point is at the first byte of the resource. Naturally, the resource should be locked and unpurgeable. Return to the operating system is via an RTS. No parameters are passed to the INIT resource. The OS handles disposing of the resource, so you don't have to. The environment of an INIT resource is a little strange, but not very. Avoid the Window, Dialog and Control managers; if you need them, simulate them in QuickDraw (which isn't all that hard). Obviously, you shouldn't do application-specific things like messing with the segment loader or the scrap. There are also weirdnesses you won't expect. For instance, I was doing some graphics in an INIT resource and for boring reasons I wanted to avoid having to go to the disk to get a font in the middle of them. So I called SetFontLock. This caused a fun explosion on the Hyperdrive, because it used a startup screen and so there was no "last font used"! So it pays to be on the conservative side, and to test your resource in a variety of environments before selling it. (If you give it away free, let the receiver beware can be your motto...) -- Tim Maroney, Electronic Village Idiot {ihnp4,sun,well,ptsfa,lll-crg,frog}!hoptoad!tim (uucp) hoptoad!tim@lll-crg (arpa) Give me food, or give me slack (or kill me).