[comp.sys.atari.st.tech] DESKTOP ACC.

D.M.Johnson@newcastle.ac.uk (Dave Johnson) (01/30/91)

Hi, I am interested in writing a few D.A.s but I need to know a few things. 

	I want to include resource files in the program, but as the prgoram is a D.A.
it should be in the code. How do I find the objects in the resource file
if I have just forced it to be included with the compiled code.


	Any tips on writing D.A.s is very useful as I have seen no documention
on how to write them.

Yours

Dave

+------------------------------------+----------------------------------------+
| David M. Johnson                   | Janet : D.M.Johnson@uk.ac.newcastle    |
| c/o Electrical and Electronic Eng. | ARPA  : D.M.Johnson@newcastle.ac.uk    |
|     Merz Court                     | UUCP  : ...ukc!newcastle!D.M.Johnson   |
|     Newcastle University           |                                        |
|     Newcastle upon Tyne            |                                        |
|     NE1 7RU                        |                                        |
+------------------------------------+----------------------------------------+
| 'There are only three just wars in American history: The American Civil War,|
| World War II and the Star Wars Trilogy,                                     |
|       Peace Dudes'                                                          |
+------------------------------------+----------------------------------------+

warwick@batserver.cs.uq.oz.au (Warwick Allison) (01/31/91)

In <1991Jan30.144626.16658@newcastle.ac.uk> D.M.Johnson@newcastle.ac.uk (Dave Johnson) writes:


> I want to include resource files in the program, but as the prgoram is a D.A.
>it should be in the code. How do I find the objects in the resource file
>if I have just forced it to be included with the compiled code.

Why put them in the DA? I think this is being a bit presumptuous of you...
How do you like it when you get software with a German RSC?  At least with
a resource file you can change it.  And on this point, I wish people would
stop using form_alert(2,"[Are you sure?][Yes|No]"), rather than a free
string, or Resource Alert from a .RSC file.  Human-Language dependent
programs are a bit rude, especially on a system that has heaps of
European support... ANYWAY...

>	Any tips on writing D.A.s is very useful as I have seen no documention
>on how to write them.

Have you written a GEM program?  DA's are similar...


Do you initialisation:
(if "initialisation" was in a .RSC, you could change it to initialization)

	1. Get your appl id (using appl_init, as for a GEM program)
	2. Register the name of your application (use menu_register)
	3. Load your RSC (use rsrc_load)
	4. Whatever else you want (create buffers, etc.)

Then:

	while (1)
	{
		get an event (using event_multi, or event_msg)

		if the event is an AC_OPEN, do whatever you want to do.
	}

Basically, it is a GEM program + menu_register + AC_OPEN handling,
so you should be able to convert a GEM program pretty well. One note
though, I don't think DA's are given access to keyboard events, so
you may have to circumvent this somehow. (Any clues?)

WARNING:
	I am a Modula-2 programmer, and my FTL M2 compiler, or my memory
may cause slight differences from the normal identifiers.

--
________________________________________________________

	This .signature intentionally left blank
________________________________________________________

sstreep@next.com (Sam Streeper) (02/02/91)

In article <1991Jan30.144626.16658@newcastle.ac.uk> D.M.Johnson@newcastle.ac.uk (Dave Johnson) writes:
>
>Hi, I am interested in writing a few D.A.s but I need to know a few things. 
>
>I want to include resource files in the program, but as the prgoram is a D.A.
>it should be in the code. How do I find the objects in the resource file
>if I have just forced it to be included with the compiled code.
>
>
>	Any tips on writing D.A.s is very useful as I have seen no documention
>on how to write them.

Hi Dave,  I posted source to the atari sources group awhile ago called DUBL_VIS
that is a disk formatter that runs as a program or an accessory.  You should
be able to get it from an archive server (although I haven't looked for it
myself...)

That program also has its resource built into the source code, so it can
show you how to use this trick.

What compiler are you using?  and what program are you using to get your
resource into source code form?  Many compilers require a different
startup routine linked in to compile a resource file.  Accessory startup
code for the Sozobon compiler was posted here about a month ago, its called
SOZOINIT.

Mail me if this is still totally confusing...
-sam  (sam_s@NeXT.com)

sstreep@next.com (Sam Streeper) (02/02/91)

In article <7089@uqcspe.cs.uq.oz.au> warwick@batserver.cs.uq.oz.au writes:
>> I want to include resource files in the program, but as the prgoram is a D.A.
>Why put them in the DA? I think this is being a bit presumptuous of you...
>How do you like it when you get software with a German RSC?  At least with
>a resource file you can change it.

Gem has some bugs with memory management - If a resource file is loaded in,
that memory is lost every time you change resolution.  If 3 DAs have 10K
resource apiece, you lose 30K of memory every time you change resolution. Ack!

Besides, old Tos versions can only safely Malloc() between 20 and 40 blocks
of memory, and each DA that loads a resource Mallocs one of those blocks
away, increasing the Malloc risk for the main program.  For these reasons,
DA's should build in their resources.

> Human-Language dependent
>programs are a bit rude, especially on a system that has heaps of
>European support... ANYWAY...

In principle, I agree with you completely.
-sam

sstreep@next.com (Sam Streeper) (02/05/91)

In article <243@rosie.NeXT.COM> sstreep@next.com (Sam Streeper) writes:
>What compiler are you using?  and what program are you using to get your
>resource into source code form?  Many compilers require a different
>startup routine linked in to compile a resource file.  Accessory startup
                                        ^^^^^^^^^^^^^
>code for the Sozobon compiler was posted here about a month ago, its called
>SOZOINIT.

Ack! of course this shouldn't read "resource file", it should say
"desk accessory."  I must have been sleepy.

-sam