Found another interesting thing (IE: lots of hours) in the C68
implementation of qptr.
If one needs to use a spacing list for a menu (IE: columns or rows
have different spacings versus all columns have the same or all rows
have the same), it seems that the C68 compiler has a problem with
Unions.
When trying to assign a pointer to a spacing list in the following
structure, the compiler always complained regardless of what I did,
saying that it was looking for a short.
struct WM_menw
{
...
short yoff; /* yoffset */
/* -xsize, -xspce or
*xspc spacing list [ PROBLEM is here ] */
union {
struct {
short _size;
short _spce;
} c;
WM_splst_t *xspc;
} xs;
The compiler seems to only be aware of the first option of a union
when putting together the data structure from the C68 qptr
structures, not understanding the Union concept where either version
is OK. After giving the 'short' warning, it looks for a second short
variable which would not be the case if the pointer was used instead.
The work around is simple. Simply assign short 'dummy' values in the
initial structure to c._size and c._spce. Then in the main code
before drawing the window, assign the pointer there which works fine.
For example, I put into the data structure:
{ -24, -26 }, -> this was accepted as expected
Then in my code, I assigned the list to this location by:
pmw1->xs.xspc = lxspc; /* lxspc is the pointer to the list,
pmw1is the
address of the menu data structure */
Cheers,
jim
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm