flat assembler
Message board for the users of flat assembler.

flat assembler > Macroinstructions > local structures NOT local with new proc/local macros

Author
Thread Post new topic Reply to topic
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
The consequence of what might be considered bad programming technique, caused a problem for me today. To demonstrate what I think shouldn't happen, I put together this demo. If a local structure has the same name as a previous local structure, the second local structure is given the same structure definition as the first local structure.:

Code:
test_proc       proc    hFti:DWORD, AllOrSome:DWORD
local   lvi:LVITEM
local   .buffer:BYTE    20      dup (?)
local   .row:DWORD
        lea             eax, [lvi.mask]
        lea             eax, [lvi.iItem]
        lea             eax, [lvi.iSubItem]
        lea             eax, [lvi.state]
        lea             eax, [lvi.stateMask]
        lea             eax, [lvi.pszText]
        lea             eax, [lvi.cchTextMax]
        lea             eax, [lvi.iImage]
        lea             eax, [lvi.lParam]
        lea             eax, [lvi.iIndent]
        lea             eax, [.buffer]
        lea             eax, [.row]
        ret
test_proc       endp

test_proc2      proc    hFti:DWORD, AllOrSome:DWORD
local   lvi:LVFINDINFO
local   .buffer:BYTE    20      dup (?)
local   .row:DWORD
        lea             eax, [lvi.flags]
        lea             eax, [lvi.psz]
        lea             eax, [lvi.lParam]
        lea             eax, [lvi.vkDirection]
        lea             eax, [lvi.mask]
        lea             eax, [lvi.iItem]
        lea             eax, [lvi.iSubItem]
        lea             eax, [lvi.state]
        lea             eax, [lvi.stateMask]
        lea             eax, [lvi.pszText]
        lea             eax, [lvi.cchTextMax]
        lea             eax, [lvi.iImage]
        lea             eax, [lvi.lParam]
        lea             eax, [lvi.iIndent]
        lea             eax, [.buffer]
        lea             eax, [.row]
        ret

test_proc2      endp     


The first four command lines of test_proc2 won't assemble because lvi here is considered LVITEM--as defined in test_proc--instead of LVFINDINFO. The remaining lines of test_proc2 will assemble if the first four are commented out. I tried everything I could think of: put a . before each lvi; put a . and a space before each lvi (that didn't assemble); but neither allowed lvi to be differentiated.

Thanks for any help. For now I'll just use unique names.

Thanks again for an impressive product!

farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 19 Jun 2005, 09:04
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7239
Location: Kraków, Poland
It's my stupid mistake in the variable localization macro, I'm updating it in the official package. For the quick fix, find this line in the "deflocal@proc" macro:
Code:
 match vars, all@vars \{ all@vars equ vars,name \}    

and correct it to:
Code:
 match vars, all@vars \{ all@vars equ all@vars,name \}    
Post 19 Jun 2005, 09:24
View user's profile Send private message Visit poster's website Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
Privalov,

Very Happy

Thanks!

That was fast!

Back to work, I'm really having fun.

farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 19 Jun 2005, 09:50
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.