函数指针运行时跑飞,急等分析
应用程序:
GUI_FLASH const GUI_FONT_PROP GUI_FontHZ17x19_Prop_a1 =
{
0xa1a1,
0xa1fe,
&GUI_FontHZ17x19_CharInfo[96],
(void *)&GUI_FontHZ17x19_Prop_a2
};
GUI_FLASH const GUI_FONT_PROP GUI_FontHZ17x19_Prop_ASC =
{
0x0020, // first character
0x007f, // last character
&GUI_FontHZ17x19_CharInfo[0], // address of first character
(void *)&GUI_FontHZ17x19_Prop_a1 // pointer to next GUI_FONT_PROP
};
GUI_FLASH const GUI_FONT GUI_FontHZ17x19 =
{
//GUI_FONTTYPE_PROP_SJIS, // type of font
19, // height of font
19, // space of font y
1, // magnification x
1, // magnification y
(void GUI_FLASH *)&GUI_FontHZ17x19_Prop_ASC
};
extern void Uart_Printf(char *fmt,...);
void printftest()
{
const GUI_FONT_PROP *p = (const GUI_FONT_PROP *)GUI_FontHZ17x19.pProp;
Uart_Printf ("GUI_FontHZ17x19.pProp=0x%x\n", GUI_FontHZ17x19.pProp);
Uart_Printf ("&GUI_FontHZ17x19_Prop_ASC=0x%x\n", &GUI_FontHZ17x19_Prop_ASC);
Uart_Printf ("p=0x%x\n", p);
Uart_Printf ("GUI_FontHZ17x19.pProp->First=0x%x\n", GUI_FontHZ17x19.pProp->First);
Uart_Printf ("GUI_FontHZ17x19_Prop_ASC.First=0x%x\n", GUI_FontHZ17x19_Prop_ASC.First);
Uart_Printf ("GUI_FontHZ17x19_Prop_ASC.pNext=0x%x\n", GUI_FontHZ17x19_Prop_ASC.pNext);
Uart_Printf ("&GUI_FontHZ17x19_Prop_a1=0x%x\n", &GUI_FontHZ17x19_Prop_a1);
Uart_Printf ("&GUI_FontHZ17x19_Prop_a2=0x%x\n", &GUI_FontHZ17x19_Prop_a2);
Uart_Printf ("&GUI_FontHZ17x19_Prop_a3=0x%x\n", &GUI_FontHZ17x19_Prop_a3);
Uart_Printf ("&GUI_FontHZ17x19_Prop_a4=0x%x\n", &GUI_FontHZ17x19_Prop_a4);
Uart_Printf ("&GUI_FontHZ17x19_Prop_a5=0x%x\n", &GUI_FontHZ17x19_Prop_a5);
Uart_Printf ("&GUI_FontHZ17x19_Prop_a6=0x%x\n", &GUI_FontHZ17x19_Prop_a6);
Uart_Printf ("&GUI_FontHZ17x19_Prop_a7=0x%x\n", &GUI_FontHZ17x19_Prop_a7);
Uart_Printf ("&GUI_FontHZ17x19_Prop_a8=0x%x\n", &GUI_FontHZ17x19_Prop_a8);
for ( ; p; p = (const GUI_FONT_PROP *)(p->pNext))
{
Uart_Printf ("p=0x%x\n",p);
}
}
typedef struct
{
I16P c0;
I16P c1;
} GUI_FONT_TRANSLIST;
typedef struct
{
U16P FirstChar;
U16P LastChar;
const GUI_FONT_TRANSLIST* pList;
} GUI_FONT_TRANSINFO;
typedef struct {
U8 XSize;
U8 XDist;
U8 BytesPerLine;
void* pData;
} GUI_CHARINFO;
typedef struct
{
U16P First; /* first character */
U16P Last; /* last character */
const GUI_CHARINFO* paCharInfo; /* address of first character */
void* pNext; /* pointer to next */
} GUI_FONT_PROP;
typedef struct
{
U8 YSize;
U8 YDist;
U8 XMag;
U8 YMag;
const GUI_FONT_PROP* pProp;
//U8 Baseline;
} GUI_FONT;