Path: utzoo!mnetor!uunet!husc6!mailrus!ames!pasteur!ucbvax!CORY.BERKELEY.EDU!dillon From: dillon@CORY.BERKELEY.EDU (Matt Dillon) Newsgroups: comp.sys.amiga.tech Subject: Re: RESOURCES (as in disk-resources) Message-ID: <8805080154.AA23107@cory.Berkeley.EDU> Date: 8 May 88 01:54:07 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 48 >I have one comment. You need to tag each resource somehow: > > BITMAP *bm = GetResource("MyTitleScreen", "BITMAP"); > >Otherwise, what happens when you change it into an audio sample? It blows up. Of course, since the programmer defined that resource to be a BitMap, he knows what it is. You bring up a good point here. The resources are tagged, obviously, since the resource library needs to know the structure to 'decode' them. The question is, should I *force* the application program to also specify a structure name along with the resource name? >Also, given the large number of things you might want, I can potentially >see this becoming quite a large library. > >So far it seems very termcap-like. A printable version of the resources >would be handy. Huge in fact... think of all the neat things you could put in there! So far, a particular resource 'file' is broken up into three parts: (1) structure defs (2) dictionary of resource names (3) Data pertaining to the resources I.E. (1) and (2) would be quite small in size ... one could read all the structure defs and resource name dictionary in a single operation, while (3) would be huge since it contains the actual data... but since we know the location of the data we want from (2), access to (3) would be fast. >Question in another posting on the structure format A structure is made of other structures. For instance, a BitMap is made up of the following structures: (uword,uword,ubyte,ubyte, uword,ubyte*[0..N]). Each 'structure' in a structure is referenced by a 2 byte descriptor. The upper two bits identify whether you want to embed the sub-structure or have a pointer to the sub-structure (and other possibilities). This is what distinguishes, say, a MsgPort from a pointer to a MsgPort. For structures containing pointers to sub-structures, the DATA part of the resource would be not only for the master structure, but also for any sub-strutures (or sub-sub-structures, etc...) -Matt