The MASM Forum Archive 2004 to 2012

Project Support Forums => GoAsm Assembler and Tools => Topic started by: donkey on February 27, 2006, 02:13:55 AM

Title: Equating structures for UNICODE et al
Post by: donkey on February 27, 2006, 02:13:55 AM
Hi Jeremy,

I was wondering why I can't use an equate for structures, for example...

HD_ITEM STRUCT
mask DD
cxy DD
pszText DD
hbm DD
cchTextMax DD
fmt DD
lParam DD
iImage DD
iOrder DD
type DD
pvFilter DD
ENDS

HDITEM equ HD_ITEM


This would be handy for the STRINGS UNICODE switch in INC files, for example you could have 2 structures...

MYSTRUCTW STRUCT
uString DW 16 DUP (?)
ENDS

MYSTRUCTA STRUCT
aString DB 16 DUP (?)
ENDS

#IF STRINGS UNICODE
MYSTRUCT=MYSTRUCTW
#ELSE
MYSTRUCT=MYSTRUCTA
#ENDIF


Allowing a block of definitions at the end of the file as opposed to spread out through it. It would make it easier to have nested #IF/#ENDIF blocks for IE and Windows versions as well as UNICODE.

Edgar
Title: Re: Equating structures for UNICODE et al
Post by: jorgon on March 01, 2006, 03:20:27 PM
Actually the examples you give do compile ok.  I found the problem arises when you try to provide an override when declaring the structure eg. MyData MYSTRUCT <"hello struct">
What seems to be happening is that GoAsm deals with the structure properly and applies the overrides, but because MYSTRUCT is really an equate, this confuses GoAsm when it finishes assembling the sructure.  It tries to deal with the override a second time.  This bug will need some careful attention so I shall fix it as soon as I have a quiet moment.
Thanks for bringing this to my attention, Donkey.
Title: Re: Equating structures for UNICODE et al
Post by: donkey on March 01, 2006, 06:08:45 PM
Hi Jeremy,

The bug also appears when you declare the structure as LOCAL, it will not recognize the new structure label.

Edgar
Title: Re: Equating structures for UNICODE et al
Post by: jorgon on March 06, 2006, 10:19:54 PM
Edgar

Got to the bottom of this one!
The fix is in GoAsm Version 0.55.03 beta available from here (http://www.jorgon.freeserve.co.uk/GoasmBeta.zip).

Many thanks
Title: Re: Equating structures for UNICODE et al
Post by: donkey on March 07, 2006, 12:59:59 AM
Thanks Jeremy,

A quick test shows it working perfectly, the macro problem as well.

Edgar