Newsgroups: comp.sys.mac.programmer
Path: utzoo!utgpu!watserv1!watmath!att!cbnewsk!ech
From: ech@cbnewsk.att.com (ned.horvath)
Subject: Re: New convention for owned resources--addendum
Organization: AT&T Bell Laboratories
Date: Thu, 18 Oct 90 20:42:27 GMT
Message-ID: <1990Oct18.204227.600@cbnewsk.att.com>
References: <12084@neptune.inf.ethz.ch>
Lines: 36

In article <1990Oct17.220257.26134@comp.vuw.ac.nz> newbery@rata.vuw.ac.nz (Michael Newbery) writes:
>Why not follow the 'BNDL' approach ('bndl' perhaps, which would of course
>require Apple's blessing)? The 'bndl' resource could simply be a list of
>associated resources. Much more general and easier to localise.

From article <12084@neptune.inf.ethz.ch>, by mneerach@iiic.ethz.ch (Matthias Ulrich Neeracher):
> This wouldn't work because you need to be able to have such a bundle for 
> every resource ID of every possible resource type, not just of one type.
> You can't express that with one 16-bit resource ID, unless you do a lot
> of collision detection and renumbering.

The assumption would be that any given file would have a (fairly small)
number of code objects contained in it, so the "neoBNDL" name space could
be shared by all possible code resource types.

A BNDL's first two fields are
	signature : OSType;
	versionID : INTEGER;
If we assume that the neoBNDL replaces that with
	ownerType : OSType;
	ownerResID : INTEGER;
then a simple hashing scheme (like summing the Type and ResID to get a
trial hash key, and just incrementing on a collision) would suffice for
any code resource that knew its own name to rapidly "guess" its neoBNDL
resID.  The initial key must be chosen a BIT more carefully to avoid conflicts
with preassigned "owned" resIDs.  Notice, however, that the entire
application namespace (resIDs 128..32767) is open for neoBNDLs.

A ResCopy facility could apply the same heuristic to quickly discover 
whether an arbitrary resource has "owned" resources, once the convention
was sufficiently widespread.

There, I've almost written the code.  Perhaps I SHOULD write the code
(unless there's a volunteer...)

=Ned Horvath=
