[net.micro.atari16] queries about GEM and Lattice C

fkc@warwick.UUCP (Frank K Carver) (05/06/86)

Hi,

I hope there are some peole out there with experience of ROM TOS and
C. I have a 1040stf and have just bought Metacomco-Lattice C.

I have a few questions that are bothering me:

1. Why, in all the examples I have seen (C manual, "Gem on the Atari
ST", "Anatomy of Atari ST" ..) do they use 'forward slashes' (a la
UNIX) as directory separators. I have tried in vain to use these, but
my computer will only accept 'back slashes' (a la MSDOS).

2. In the linker section of the Lattice C manual, and the supplied
C.LNK file, there is a line of the form
	INPUT *
which is supposed to read in the .BIN file specified on the command
line. I wish to keep the source files and compiler/linker in separate
directories, and so have changed that to read
	INPUT \src\*
but this ignores the command line. It will load in the alphabetically
first .BIN file in the \src\ directory. Is this a bug? Does anyone have
a work-around for it?

3. I have been trying to get to grips with window handling. As a first
attempt I typed in the AESC01.C example from "GEM on the Atari ST".
This crashed with two bombs as written. I had already copied the
supplied "gemlib.h" to "gemdefs.h" as required, and used short (16 bit)
integers for all the parameters. After some playing with it, and
reading the "Professional GEM" article posted here a few months ago, I
have now got it to compile, link, and run. But it steadfastly refuses to
put a name on the move bar. The current state of my program is given
below.

If anyone can help with these problems, I would appreciate news or mail.

Cheers,
Frank.

---------------------cut here---------------------------------------
/*
 * "AESC01.c" AES Window example from
 *	"GEM on the Atari ST", First Publishing, pp388-390
 *
 * Implemented into lattice C by F K Carver, 4 May 1986
 * Refused to run (2 bombs) as written. mods started 5 May 1986
 * Now compiles and runs but doesn't show a window name.
*/

#include "gemdefs.h"
typedef short INT; /* Lattice C uses 16 bit shorts and 32 bit ints */

INT contrl[12], intin[128], ptsin[128], intout[128], ptsout[128];
INT work_in[12], work_out[57];
INT handle, wi_handle;
INT gl_hhbox, gl_hwbox, gl_hhchar, gl_hwchar;
INT xdesk, ydesk, wdesk, hdesk;

open_work()
{	INT i;

	appl_init();
	handle = graf_handle(&gl_hwchar, &gl_hhchar, &gl_hwbox, &gl=hhbox);
	for (i=0; i<10; work_in[i++]=1);
	work_in[10] = 2;
	v_opnvwk(work_in, &handle, work_out);
}

close_work()
{	gemdos(0x1);
	v_clsvwk(handle);
	appl_exit();
}

open_window();
{	INT parts = NAME| MOVER| FULLER| SIZER| CLOSER;

	wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk);
	wi_handle = wind_create(parts, xdesk, ydesk, wdesk, hdesk);
	wind_set(wi_handle, WF_NAME, "Untitled", 0,0);
	wind_open(wi_handle, xdesk, ydesk, wdesk, hdesk);
}

main()
{	open_work();
	open_window();
	close_work();
}
/*--------------------------cut here---------------------------------
-- 
Frank K Carver   "In space ... no one can hear your laser sound-effect"
		Join the Group Against Gratuitous Acronyms (GAGA) NOW !

Computer Systems Engineering, University of Warwick, Coventry, UK
or "Magrathea", 5 Whitefields, Gibbet Hill Road, Coventry, CV4 7AL, UK

UUCP:		..mcvax!ukc!warwick!fkc
ARPA:             'fraid-not@THE-MOMENT