Guys,
I have hit a strange behavior with C68 in the qptr windows
environment. Perhaps someone has some idea of what is going on. It
has to do with trying to use menu structures for app windows.
When I try to use the following structure for one of my app windows,
it seems to be reserving the wrong size when I setup it up, causing
problems with accesses to any app windows following the first use of
the structure.
static struct WM_menw mw0 =
{
...
}
static struct WM_appw aw1 =
{
...
}
static struct WM_appw aw2 =
{
...
}
static struct WM_appl appl[4] = {(struct WM_menw *)&mw0, &aw1, &aw2,
NULL};
It draws OK but when I access the structure from the WM_appl_t part,
it has problems.
What I found is:
sizeof(struct WM_menw) = 172 -> correct
sizeof(struct WM_appw) = 104 -> correct
&mw0 = 0x9da162 &aw1 - &mw0 = 0xAC = 172 ->
correct
&aw1 = 0x9da20e &aw2 - &aw1 = 0x68 = 104 ->
correct
&aw2 = 0x9da276
ww.pappl->pappw[0] = 0x9da162 == &mw0 -> correct
ww.pappl->pappw[1] = 0x9da1ca != &aw1 -> error
ww.pappl->pappw[2] = 0x9da232 != &aw2 -> error
I would have assumed that the struct WM_appl would be storing the
true values for the addresses of mw0, aw1, and aw2. But as you can
see, the values are different when I read them back.
In fact, the difference between pappw[1] and pappw[0] = 0x68.
Further tests show that no matter what I do, the values stored in the
pappl structure always seem to be incremented by 0x68, no matter what
the real address that each entry points to.
In qptr_h:
struct WM_appl
{
WM_appw_t *pappw;
}
It looks like this is actually a pointer as I would have expected.
This would seem to be either a bug in C68 where C68 is overwriting
the pointer values in the WM_appl structure based on the first entry
and the standard space for struct WM_appw. Or it is something that I
am just not understanding.
Since the original data structure is reserving the correct spaces and
there is no problem with that, my current work around is to save off
some global variables pointing to &mw0, &aw1 and &aw2 and not rely on
the ww.pappl-> entries.
Any suggestions/comments?
Thanks,
jim
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm