News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Structure Definition length?

Started by redskull, May 18, 2006, 04:17:43 AM

Previous topic - Next topic

redskull

  When you're initializing data (in my case, arrays of structures), what is the maximum length you can use?  I have a bunch of constant data, which I was hoping to have spaced onto different lines for readability sakes, but anytime it creeps past about 10 physical lines, the assembler spits back a 'statement too complex' and 'line too long' errors.  I searched high and low for multi-line spanning definitions, but didn't find any size-restrictions on it...Am I messing up the declaration, or do I have to break it apart into several different arrays?

Here's the first couple lines, in case i'm declaring it wrong:

MyData POINT        {0,0},{50,100},{100,160},{200,175},{250,150},{320,50},\
                    {0,50},{50,150},{150,175},{200,150},{250,135},{320,125},\
                    {0,125},{55,125},{70,140},{60,150},{55,140},{20,135},{15,165},\
                    etc, etc, etc goes on like this for awhile
Strange women, lying in ponds, distributing swords, is no basis for a system of government

hutch--

Red,

Give this a blast and see if it works OK with a structure as a data type.


MyData POINT {0,0},{50,100},{100,160},{200,175},{250,150},{320,50}
       POINT {0,50},{50,150},{150,175},{200,150},{250,135},{320,125}
       POINT {0,125},{55,125},{70,140},{60,150},{55,140},{20,135},{15,165}
       etc .....
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

redskull

Strange women, lying in ponds, distributing swords, is no basis for a system of government

redskull

After some wicked bad debugging nightmares, i've come to realization that SIZEOF and LENGTHOF don't work when you declare things the new way?   :'(
Strange women, lying in ponds, distributing swords, is no basis for a system of government

hutch--

You can cheat though, put a dummy data item after it and subtract your start address from the start address of the dummy item and you have the length of the first array of data items in BYTES. Divide it by 8 and you have the number of POINT structures.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

KSS

Mr. Hutch,
I use other way, and it not need dummy item.
WndToolbarTbB\
TBBUTTON<STD_FILEOPEN ,IDMC_FileOpen ,TBSTATE_ENABLED,BTNS_BUTTON ,?,0,TXT_WndToolbar_FileOpen>
TBBUTTON<STD_FILESAVE ,IDMC_FileSave ,0 ,BTNS_BUTTON ,?,0,TXT_WndToolbar_FileSave>
TBBUTTON<NULL ,NULL ,TBSTATE_ENABLED,BTNS_SEP ,?,0,0>
TBBUTTON<STD_DELETE ,IDMC_ItemDelete,0 ,BTNS_BUTTON ,?,0,TXT_WndToolbar_ItemDelete>
TBBUTTON<STD_PROPERTIES ,IDMC_ItemEdit ,0 ,BTNS_BUTTON ,?,0,TXT_WndToolbar_ItemEdit>
TBBUTTON<NULL ,NULL ,TBSTATE_ENABLED,BTNS_SEP ,?,0,0>
TBBUTTON<STD_FIND ,IDMC_ItemFind ,0 ,BTNS_BUTTON ,?,0,TXT_WndToolbar_ItemFind>
WndToolbarTbB_Count=($-OFFSET WndToolbarTbB)/Sizeof(TBBUTTON);This string MUST follow directly after WndToolbarTbB

Ratch

redskull,
     If you want the length of a structure element or a group of structure elements, try the technique shown below.  No dum-dum names or other artifices--just labels.  It is more concise than trying to make LENGTHOF work for complicated constructions.  Also the length of a structure will be assembled by just inserting its name as shown below.  Ratch





PW STRUCT
PW$1     =     $
hBrush  DWORD ?
hdc     DWORD ?
rect    RECT  {}
PW$2     =     $
return  DWORD ?
PW$3     =     $
hwnd    DWORD ?
iColor  DWORD ?
iFigure DWORD ?
PW$4     =     $
PW ENDS

PaintWindow:
SUB ESP,PW$2-PW$1        ;byte length of local area needed
INVOKE GetDC,[ESP.PW.hwnd]
MOV [ESP.PW.hdc],EAX
;.....
;.....
;     
MOV EAX,PW               ;notice how PW will give the length of the structure in bytes
ADD ESP,PW$2-PW$1        ;byte length of local area to release
RET PW$4-PW$3            ;length of parameters PUSH'ed onto stack