Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!snjsn1!bilbo!greg From: greg@bilbo (Greg Wageman) Newsgroups: comp.sys.atari.st Subject: Re: rsc_gaddr() bug Message-ID: <1107@snjsn1.SJ.ATE.SLB.COM> Date: 21 Jun 89 22:05:09 GMT References: <43ed07d6.14a1f@gtephx.UUCP> Sender: news@SJ.ATE.SLB.COM Reply-To: greg@sj.ate.slb.com (Greg Wageman) Organization: Schlumberger ATE, San Jose, CA Lines: 52 In article <43ed07d6.14a1f@gtephx.UUCP> covertr@gtephx.UUCP (Richard E. Covert) writes: > > The March/April issue of "Atari Explorer" has an article by John >Jainschigg titled "An introduction to the resource files". In this article John >describes how to use the rsc_gaddr() function. John also said that you should only >attempt to locate the address of "tree" objects. To quote John: > > OBJECT *p; > > rsc_gaddr( type, index, &p); > >where "type" is an integer between 0 and 16 denoting the type of object >sought (there are bugs in the function that make it useless for object >types other then trees; type 0), ..... > > > Anyway, is this a generic bug in GEMDOS, for all versions of TOS?? >Is it a bug in the compiler that John uses?? Does Mark Williams C, 3.09, have >this bug?? > > This bug reduces the usefullness of rsc_gaddr() if it does exist. >There are times were you want a child of a tree, and it is easily to get the >child's address then to get the tree's address and have to index off of it. I have not seen the article. However, I have successfully used rsc_gaddr() to obtain the address of free strings and alerts, which are not type-zero objects. I have not tried to obtain the address of children, and it is not clear to me how one would, since while the index of a tree is unique among all trees, the index of a child isn't unique among all children. I suppose one could set "p" equal to the address of the desired tree object, but the documentation didn't make it clear that that would work. In any event, why is it so difficult to do &tree[CHILD]? Even in assembler, this is just a load of the address of tree into an address register, a load of the index of child ("CHILD") into a data register, a multiply of CHILD by the size of the object structure, and an add of the resulting byte offset to the address of the tree (or an indexed load). Am I missing something here? Longish .signature follows. Skip now. Greg Wageman DOMAIN: greg@sj.ate.slb.com Schlumberger Technologies UUCP: ...!uunet!sjsca4!greg 1601 Technology Drive BIX: gwage San Jose, CA 95110-1397 CIS: 74016,352 (408) 437-5198 GEnie: G.WAGEMAN ------------------ "Live Free; Die Anyway." ------------------ Opinions expressed herein are solely the responsibility of the author.