[comp.sys.amiga.tech] RKM: Libs and Devs

rlcarr@athena.mit.edu (the Wizard of Speed and Time) (01/20/90)

I just picked up the new Libs and Devs RKM and typed in the first example
(pp. 7-9).  A couple of questions:

1) there is the line
struct IntuitionBase *IntuitionBase = NULL;

I was under the impression that Lattice included an IntuitionBase in lc*.lib,
so that this line should be
extern struct etc. etc.

Also, for the program, the compiler options are given as
-b1 -cfist -L -v -w

Now, -w selects 16 bit ints.  Is there any reason this was used?  Should
it have been -y instead (load A4 with LinkerDB)?

Now for the problem.  Despite (1) the code compiles and links fine.
However, when I run it, instead of "Our Own Screen" in the title bar, I
get a blank ORANGE titlebar (the screen gadgets ARE drawn and are in their
correct colors).  However, the  window DOES have "graniteWindow" in its
titlebar.  Also, the program works fine and returns all its memory.

I have tried compiling with just about every option, with the same
result.  I am using Lattice 5.04 [no patches beyond that, however].
It also happens with the -b0 option.

Has anyone else had this problem?

Rich Carreiro - Most Biased Boston Celtics Fan!   "So long, farewell, and may
ARPA: rlcarr@space.mit.edu                         the forces of evil become
UUCP: ...!mit-eddie!space.mit.edu!rlcarr           confused on the way to your
BITNET: rlcarr@space.mit.edu                       door!" - George Carlin
--
Rich Carreiro - Most Biased Boston Celtics Fan!   "So long, farewell, and may
ARPA: rlcarr@space.mit.edu                         the forces of evil become
UUCP: ...!mit-eddie!space.mit.edu!rlcarr           confused on the way to your
BITNET: rlcarr@space.mit.edu                       door!" - George Carlin

valentin@cbmvax.commodore.com (Valentin Pepelea) (01/21/90)

In article <1990Jan20.042239.12232@athena.mit.edu> rlcarr@space.mit.edu (the Wizard of Speed and Time) writes:
>I just picked up the new Libs and Devs RKM and typed in the first example
>(pp. 7-9).  A couple of questions:
>
>1) there is the line
>struct IntuitionBase *IntuitionBase = NULL;
>
>I was under the impression that Lattice included an IntuitionBase in lc*.lib,

Yeah, so?

>so that this line should be        extern struct etc. etc.

The author wanted to automatically initialize the pointer to NULL. The line
"extern struct IntuitionBase *IntuitionBase = NULL;" would have been
translated to "struct IntuitionBase *IntuitionBase = NULL;" anyway because
you cannot auto-initialize externs.

>Also, for the program, the compiler options are given as
>-b1 -cfist -L -v -w
>
>Now, -w selects 16 bit ints.  Is there any reason this was used?

I guess smaller data size, a slight incresed speed are it.

> Should it have been -y instead (load A4 with LinkerDB)?

What for? A4 get loaded with the LinkerDB upon program entry. You want to use
-y only when some of your routines (assembler modules for ex.) trash A4, or
when the code is intented to be used by other tasks or interrupts.

>Now for the problem.  Despite (1) the code compiles and links fine.
>However, when I run it, instead of "Our Own Screen" in the title bar, I
>get a blank ORANGE titlebar (the screen gadgets ARE drawn and are in their
>correct colors).  However, the  window DOES have "graniteWindow" in its
>titlebar.  Also, the program works fine and returns all its memory.

Look at your typed-in code once again. I think the pointer to the "Our Own
Screen" does not get initialized correctly. Maybe you forgot a comma somewhere?

Valentin

cmcmanis@stpeter.Sun.COM (Chuck McManis) (01/22/90)

In article <1990Jan20.042239.12232@athena.mit.edu> (Rich Carreiro) writes:
>1) there is the line
>struct IntuitionBase *IntuitionBase = NULL;
>
>I was under the impression that Lattice included an IntuitionBase in lc*.lib,
>so that this line should be
>extern struct etc. etc.

Correct, however having your own define is "OK" too as long as all of your
subroutines reference the same one. The examples in the RKM seem to be
written so that you don't need to link with lc.lib in which case there  
wouldn't be a define for IntuitionBase.

>Also, for the program, the compiler options are given as
>-b1 -cfist -L -v -w

These options are fine.

>Now for the problem.  Despite (1) the code compiles and links fine.
>However, when I run it, instead of "Our Own Screen" in the title bar, I
>get a blank ORANGE titlebar (the screen gadgets ARE drawn and are in their
>correct colors).  However, the  window DOES have "graniteWindow" in its
>titlebar.  Also, the program works fine and returns all its memory.

Yes, it is a pretty stupid BUG on the the part of the code, although harmless.
You will notice that in the example the NewScreen structure uses (-1, -1)
for the DetailPen and BlockPen, this is completely bogus. In the new WINDOW
structure you can use -1 for either the BlockPen or the DetailPen and it
will pick them up out of the SCREEN structure, but if you use them in the
screen structure it will simply set your two pens to the same color (which
in this case is color 3 because that is the highest color available in a
two bitplane screen). You will notice that in the NewWindow structure the
programmer uses 0, and 1 which allows the title to be read. Note that the
title is being rendered in the Screen just with the same background and 
foreground colors. If you take the 0, 1 out of the NewWindow structure and
put it into the NewScreen structure and then put -1, -1 in the NewWindow
structure you get the effect the programmer probably intended.


--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@Eng.Sun.COM
These opinions are my own and no one elses, but you knew that didn't you.
"If it didn't have bones in it, it wouldn't be crunchy now would it?!"