flat assembler
Message board for the users of flat assembler.

flat assembler > Macroinstructions > undesdending of local (not macro)...

Author
Thread Post new topic Reply to topic
Galkov



Joined: 23 Jul 2005
Posts: 10
Location: Novosibirsk
I don't undestand, why, anythings about this, work wrongly:
Code:
macro onTest data,_exit 
  local ..end
  cmp data,0 ;only for example
  jz _exit       ;only for example
  invoke SendMessage,MainForm,WM_DESTROY,0,0 ;only for example
..end

macro doTest data,_exit 
  local ..end
  ;invoke MoveToEx,ebx,esi,0,0 ;but work true, if this is uncomments !!!
  onTest data,__end
..end

; any codes...
  doTest  dwordebx,entry_loop    


Help me, please, for undestanding this !!!
((Note please, for last comments...))

P.S. Sorry for bad english.....
Post 23 Jul 2005, 03:59
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16702
Location: In your JS exploiting you and your system
Inside fasm "local some_label" will make the label "some_label?01234567" where 01234567 is a unique count value each time the macro is used.
Code:
macro onTest data,_exit  
  local ..end ;<-- becomes ..end?00000000
  cmp data,0 ;only for example 
  jz _exit       ;only for example 
  invoke SendMessage,MainForm,WM_DESTROY,0,0 ;only for example 
..end ;<-- becomes ..end?00000000
 
macro doTest data,_exit  
  local ..end ;<-- becomes ..end?00000001
  ;invoke MoveToEx,ebx,esi,0,0 ;but work true, if this is uncomments !!! 
  onTest data,__end 
..end ;<-- becomes ..end?00000001
 
; any codes... 
  doTest  dwordebx,entry_loop
    

Actually my notes above are not truly correct, the labels and made each time the macro is used not when it is declared, but I hope you get the idea.

BTW: you never used the ..end labels in your example.
Post 23 Jul 2005, 17:26
View user's profile Send private message Visit poster's website Reply with quote
Galkov



Joined: 23 Jul 2005
Posts: 10
Location: Novosibirsk
revolution,
I was thinking at the same way Exclamation
But I have error message (symbol already defined) after compiling example above Laughing
And I have no error ( Idea ), after uncomments line, as noted above.

That was a really reason of this topic

BTW: That was simplified (very much) version of complex system of macros

_________________
sorry for my bad english Sad
Post 23 Jul 2005, 19:55
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16702
Location: In your JS exploiting you and your system
Your macros can be minimised like this:
Code:
macro a local z
z
macro b local z
a
z
b     


I think this may be a bug in FASM. It gives symbol already defined error.
Post 24 Jul 2005, 00:54
View user's profile Send private message Visit poster's website Reply with quote
Galkov



Joined: 23 Jul 2005
Posts: 10
Location: Novosibirsk
And what can we do, for fixing this BUG Question

At present time, I have no adequate erudition for this assertion Sad

_________________
sorry for my bad english Sad
Post 24 Jul 2005, 02:52
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16702
Location: In your JS exploiting you and your system
I'm not sure if this is intended or a bug, either way we will have to wait for the author to comment and/or fix.
Post 24 Jul 2005, 05:29
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1095
Location: Poland
unfortunately author is on holidays now, but he should be back in a few days.
Post 24 Jul 2005, 05:44
View user's profile Send private message Visit poster's website Reply with quote
Galkov



Joined: 23 Jul 2005
Posts: 10
Location: Novosibirsk
BTW: It's good idea... About holidays Very Happy
Post 24 Jul 2005, 07:12
View user's profile Send private message Reply with quote
Galkov



Joined: 23 Jul 2005
Posts: 10
Location: Novosibirsk
Nevertheless, I decide to look at the source-code, before my own holidays Smile:

1) Function increase_counter (it is just text-counter for local labels) is called only from close_macro_block-function
And close_macro_block is called at the each repeates of macro_block, and at the and of macro.

2) Consequently, there are no close_macro_block call's between two local-macro_directives in above example

3) As indirectly test, null-macro (for example) before <local> macro_directive, or at the begining of each macro - remove error message in above example (I was checked up it)

4) Removing this code:
Code:
        push    ecx
        mov     eax,locals_counter
        call    increase_counter
        pop     ecx    

from close_macro_block-function to the begining of local_symbols-blok, fixed the BUG too...
For example:
Code:
local_symbols ;line 1917 of PREPROCE.INC I have v1.62-sources
        push    ecx                ;this code is removed from close_macro_block
        mov     eax,locals_counter ;it seems, ebx is free for scratch this
        call    increase_counter   ;may be inlining ?
        pop     ecx                ;if eax is free, xchg eax,ecx should be faster
        lods    byte esi
        cmp     al,1Ah
        jne     invalid_argument
        mov     byte edi-1,3Bh
        xor     al,al
        stos    byte edi
      make_local_symbol
        ...................    


But it may be not correct at all cases Sad (although, I don't see in what - now I am only beginer in Fasm)
All of that, was for additional notes fom Author Smile

_________________
sorry for my bad english Sad
Post 25 Jul 2005, 14:30
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16702
Location: In your JS exploiting you and your system
Good job, Galkov. Nice work in tracking down the problem.
Post 26 Jul 2005, 01:06
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7310
Location: Kraków, Poland
Thanks for the report. Will be fixed soon.
Post 26 Jul 2005, 08:56
View user's profile Send private message Visit poster's website Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
Back from holiday? Or even working on Fasm IN holidays?? Shocked
Post 26 Jul 2005, 14:11
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
heh, whis is whati call support.
Post 27 Jul 2005, 13:35
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7310
Location: Kraków, Poland
For such a small fixes it's not much of a trouble. Wink
Post 28 Jul 2005, 15:18
View user's profile Send private message Visit poster's website 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.