Environment: CW4.5, S12XDP512, C.
I have a structure declaration as follows:
typedef struct w4MsgWindowUDT_t
{
W4PositionUDT curxy; /* the cursor current coordinates*/
W4PositionUDT orgxy; /* the orginal coordinates, when scrolling, it will change*/
W4WindowUDT DispWin; /* the window location and size*/
W4WindowUDT MsgWin; /* the window location and size*/
unsigned char IsActive ; /* the tag of Active*/
unsigned char IsVisible ; /* the tage of visible*/
unsigned char UnitLength;
unsigned char Refresh;
unsigned char IsAllRowDisplayed;
unsigned char IsAllColDisplayed;
unsigned char IsEditable;
unsigned char IsMsgDataDirty;
unsigned char IsDispDataDirty;
unsigned char IsPhaseData;
unsigned char IsKeyEntered;
unsigned char PageNo;
unsigned char PageID;
u_int8 (*pt2Get)(void);
u_int8 (*pt2Put)(void);
u_int8 (*pt2KeyProc)(void);
struct w4MsgWindowUDT_t *hw; /* horizontal window*/
struct w4MsgWindowUDT_t *vw; /* vertical window*/
struct w4MsgWindowUDT_t *nw; /* next chained display window*/
struct w4MsgWindowUDT_t *ow; /* overlaped active window*/
struct w4MsgWindowUDT_t *np; /* next chained page window for data display*/
unsigned char *msg;
}W4MsgWindowUDT;
Then, I define a variable initialized with default data:
/* cur , org, Disp win Msg Win Ac, Vi,UL,RF,RD,CD,ED,MD,DD,PD,KE,PN,PI,Get Put Key Hw Vw Nw Ow Np*/
W4MsgWindowUDT Table6DW = {{1,16},{0,0},{{2,25},{8,40}},{{1,1},{31,16}},1, 1, 16, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0,&GetDataT6,&SaveDataT6,TableDataKeyProc,&Table6HW,&Table6VW,&Table6VW,NULL, NULL,NULL};
The problem is that one of the members "np" should be pointed to NULL according to declaration. However, it is pointed to a non-null data after having a check in Debug mode. It will have it right value unitl I explicitly re-assign it as NULL in my iniitial routine like this:
Table6DW.np = NULL;
I guess this CW compiler or linker cause me a lot of trouble. Since I have the samiliar code running on the Operating System OS-9 without any problem, in which I am using Radisys Hawk.
Any inputs will be appreciated greately.
Pang