composites are defined as :
|
Code
PACKED RGBA_F
SINGLE .r
SINGLE .g
SINGLE .b
SINGLE .a
END TYPE
TYPE MENU_COLOR_SET
RGBA_F .text
RGBA_F .base
END TYPE
TYPE MENU_CONTROLER
ULONG .font
ULONG .nMenus
ULONG .focused
MENU_COLOR_SET .focus
MENU_COLOR_SET .active
MENU_COLOR_SET .inactive
END TYPE |
|
and the function is :
|
Code
FUNCTION MENU_Create (pX,pY,width,title$)
SHARED MENU_CONTROLER mControl
SHARED MENU_HANDLER menu[]
cMenu=mControl.nMenus
IF cMenu>$$MAX_MENUS THEN RETURN -1
'mControl.nMenus = mControl.nMenus + 1
INC mControl.nMenus
menu[cMenu].flags=0
menu[cMenu].nItems=0
menu[cMenu].pos.x=pX
menu[cMenu].pos.y=pY
menu[cMenu].width=width
menu[cMenu].name =title$
RETURN cMenu
END FUNCTION
|
|
Alone this code causes exception.If i clear carry flag before using INC/DEC (composite.member), the exception does not occur.If the carry flag is set before any INC/DEC (composite.member), exception raises each time.
|
Code
ASM clc
INC mControl.nMenus
|
|
will not cause exception
|
Code
ASM stc
INC mControl.nMenus
|
|
will cause exception each time
|
Code
PRINT "someting"
INC mControl.nMenus
|
|
will avoid exception (i suppose PRINT clears carry flag) This problems seems to occur only with composites ULONG members. I attached a bit of code that reproduces problem.In this program, i suppose the 'IF THEN' code set the carry flag so the problem occurs.This is dependency walker output :
Quoted Text
00:00:00.203: First chance exception 0x80000003 (Breakpoint) occurred in "TESTINC.EXE" at address 0x0040105A by thread 1.
 |
This post contains attachments; to download them you must login. |
|
|