The following code (part of a simple GUI running on a 251 platform with an LCD) attempts to pass a struct which is a member of another struct on the stack. A pointer to the container struct is dereferenced using the '->' operator. The call to DrawRect below is supposed to pass certain members of the WindowContext struct, namely two ScreenPoint structs and a byte. Instead the compiler appears to be incorrectly passing the entire WindowContext struct on the stack, and therefore the DrawRect routine that receives the faulty parameters becomes hopelessly confused.
What is going on here? (Using C251 4.00) Thanks...
struct ScreenPoint { unsigned char x; unsigned char y; }; typedef struct ScreenPoint SCREENPT; typedef struct ScreenPoint SCREENSZ; struct WindowContext { SCREENPT OrgPt; SCREENSZ TotalSz; unsigned char BorderColor; /*Etc...*/ }; typedef struct WindowContext *WinPtr; void DrawRect(SCREENPT Org, SCREENSZ Sz, unsigned char Color) reentrant; TestFunction(WinPtr pWin) reentrant { DrawRect(pWin->OrgPt, pWin->TotalSz, pWin->BorderColor); }