🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #2046

Re: rsc_gaddr() bug

#2046
From: Jens Schmidt
Date: Thu, 22 Jun 1989 19:59
29 lines
1964 bytes
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), .....
No, the resource has tables (indexed by type, 0..16) of all kinds of data.
Number 0 are the object trees, which are easy. Number 5 are strings, aka
alerts, they work too. The other data types usually don't exist by themselves
in a resource, but are included in a tree. So to get the address of eg. a
button OK_BUTTN in tree ABOUTBOX you say:
	OBJECT *p;
	rsrc_gaddr (0, ABOUTBOX, &p);
	p += OK_BUTTN;  /* this is pointer-arithmetic, equivalent to
			   p = & p[OK_BUTTN];  */
If you want the address of some item inside that, use eg.:
	char *s;
	s = p->string;
Summary: rsrc_gaddr() does work, but types other than 0 and 5 are mostly
useless, because you don't know the correct index into the resource. Use the
index into the tree instead.
===============================================================================
Jens Schmidt		Email: jschmidt@fbihh.uucp
Technical Details
Message-ID: <292@fbihh.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!cs.utexas.edu!uunet!mcvax!unido!fbihh!jschmidt
References: <43ed07d6.14a1f@gtephx.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!cs.utexas.edu!uunet!mcvax!unido!fbihh!jschmidt
From: jschmidt@fbihh.UUCP (Jens Schmidt)
Newsgroups: comp.sys.atari.st
Subject: Re: rsc_gaddr() bug
Summary: Not a bug, it's a feature
Keywords: c,AES,st
Message-ID: <292@fbihh.UUCP>
Date: 22 Jun 89 19:59:47 GMT
References: <43ed07d6.14a1f@gtephx.UUCP>
Organization: University of Hamburg, FB Informatik, W-Germany
Lines: 29