🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #20849

Re: INITs

#20849
From: Juri Munkki
Date: Tue, 27 Oct 1987 06:59
37 lines
2049 bytes
In article <3917@watdragon.waterloo.edu> palarson@watdragon.waterloo.edu (Paul Larson) writes:
>A wild urge to write an INIT recently came over me.  The problem is that I have not been able to find any documentation as to how to go about it.  The LSP 
>Release 1.0 Supplement claims that code resources, a set in which INITs are 
>included, are documented in Inside Macintosh.  I have not been able to find any referece to them among these hallowed pages.  

You really don't need much documentation anyway. Just imagine you're writing
for an ancient computer that has never heard of initializing managers or loading
programs dynamically...

Ok...I'm not an expert in INIT resources, I've only written three of them.
Here's a really short init. It is in Lightspeed C 2.11 and works only on a
Mac II. You should set the file type and make the INIT resource locked. I
also make it preload, but I guess that doesn't mean anything for an init.
It "randomly" plays a 'snd ' resource. You can put the resources in the file,
but it might play one of your beepsounds.

/* StartupSound.c */
#include <MacTypes.h>

void	main()
{
	Handle		foo;
	Ptr		channel;
	unsigned long	time;
	int		theid;
	
	theid=CountResources('snd ');
	GetDateTime(&time);
	
	foo=(Handle)GetIndResource('snd ',time % theid + 1);
	SndPlay(0,foo,0);
}

Juri Munkki
Helsinki University of Technology Computing Centre
jmunkki@santra.hut.fi
jmunkki@fingate.bitnet
Technical Details
Message-ID: <8308@santra.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!enea!tut!santra!jmunkki
References: <3917@watdragon.waterloo.edu>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!enea!tut!santra!jmunkki
From: jmunkki@santra.UUCP (Juri Munkki)
Newsgroups: comp.sys.mac
Subject: Re: INITs
Message-ID: <8308@santra.UUCP>
Date: Tue, 27-Oct-87 01:59:23 EST
Article-I.D.: santra.8308
Posted: Tue Oct 27 01:59:23 1987
Date-Received: Sat, 31-Oct-87 02:54:55 EST
References: <3917@watdragon.waterloo.edu>
Reply-To: jmunkki@santra.UUCP (Juri Munkki)
Organization: Helsinki University of Technology, Finland
Lines: 37
Keywords: Sounds, Mac II, Startup
Summary: 'snd ' again...