🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.atari16
Article #1006

Re: rsc info

#1006
From: Johnie Wardlaw
Date: Wed, 02 Jul 1986 18:41
48 lines
2834 bytes
> Question:
> How can one get the address of te_ptext, te_ptmplt, etc. of a loaded resource?
> Using the rsrc_gaddr call seems to be paradoxical.
> It seems that to find the address, one must supply the index number in the
> resource file.  Problems arise when one discovers that one cannot assign
> an index value to anything but a tree or an object in the RCS.

Here is how I would copy from one text field to another using MegaMax C 
(which I use every day, by the way!):

	DIALOG	*d1,*d2;
	int	dx,dy,dw,dh,dret;

	rsrc_gaddr(0,D1_INDEX,&d1);
	form_center(d1,&dx,&dy,&dw,&dh);
	form_dial(FMD_BEGIN,dx,dy,dw,dh,dx,dy,dw,dh);
	objc_draw(d1,0,MAX1_INDEX,dx,dy,dw,dy);
	dret = form_do(d1,D1TEXT_INDEX);
	form_dial(FMD_FINISH,dx,dy,dw,dh,dx,dy,dw,dh);
	rsrc_gaddr(0,D2_INDEX,&d1);
	strcpy(((TEDINFO *) d2[D2TEXT_INDEX].ob_spec)->te_ptext,
	       ((TEDINFO *) d1[D1TEXT_INDEX].ob_spec)->te_ptext);
	form_center(d2,&dx,&dy,&dw,&dh);
	form_dial(FMD_BEGIN,dx,dy,dw,dh,dx,dy,dw,dh);
	objc_draw(d2,0,MAX2_INDEX,dx,dy,dw,dy);
	dret = form_do(d2,D2TEXT_INDEX);
	form_dial(FMD_FINISH,dx,dy,dw,dh,dx,dy,dw,dh);

You can get fancy and do the "growbox" stuff, but this is all that I do.
I haven't actually tried this code, so it may have a bug or two...I typed
it in from the top of my head (I was working on dialog stuff last night so
it was still floating around in there!)   The only problem that I forsee is
that the second dialog (destination string of copy) should be initialized
in the MMRCP program to be spaces to allocate the memory needed for the 
"strcpy".  Let me know how it goes...I would be interested in any tips on
how to get the EDIT stuff working...I can only make it work correctly when
I initialize PTEXT in MMRCP with a default string or spaces.  Maybe I have
to allocate more memory for it and change the te_ptxtlen (???) value?
Good luck!  -- Johnie

	/*********************************************************\
	** Johnie Wardlaw,      Undergraduate:  Computer Science **
	** University of California, Riverside                   **
	** {ucbvax!ucdavis, ihnp4!ucla-cs} ucrmath!hope!wardlaw  **
	**							 **
	** "If that was foreplay, I'm a dead man!"		 **
	**			-- Cocoon (alien sex scene)      **
	\*********************************************************/
Technical Details
Message-ID: <536@hope.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!nike!ucbcad!ucbvax!ucdavis!ucrmath!hope!wardlaw
References: <8607020432.AA12058@ucbvax.Berkeley.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!watmath!clyde!caip!nike!ucbcad!ucbvax!ucdavis!ucrmath!hope!wardlaw
From: wardlaw@hope.UUCP (Johnie Wardlaw)
Newsgroups: net.micro.atari16
Subject: Re: rsc info
Message-ID: <536@hope.UUCP>
Date: Wed, 2-Jul-86 14:41:15 EDT
Article-I.D.: hope.536
Posted: Wed Jul  2 14:41:15 1986
Date-Received: Fri, 4-Jul-86 03:12:21 EDT
References: <8607020432.AA12058@ucbvax.Berkeley.EDU>
Organization: University of California, Riverside
Lines: 48