flat assembler
Message board for the users of flat assembler.

flat assembler > Macroinstructions > Extending proc macro with "public"

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 201
Hello guys,

By default all our procs are "private" to our .asm module. We have to put "public OurProc" to make it public.

Would it be possible to extend the proc macro to accept "public" when we define our proc? Example:

Code:
myProc proc PUBLIC param1, param2

 ....

myProc endp    


Thanks!
Post 31 May 2010, 17:12
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16654
Location: In your JS exploiting you and your system
Extending proc to do that would be quite easy. In much the same way that stdcall and c are detected you can add public.

But, of course, it would only work with linkable output formats.
Post 31 May 2010, 17:16
View user's profile Send private message Visit poster's website Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Is there a way to tell what format is being used, like an internal variable or something? Kinda like % can be used to get the number of the current iteration of a "repeat."
Post 31 May 2010, 20:48
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
Tyler,

No, AFAIK. In most cases one can check for low $$ symbol value to detect COFF, but this is unreliable. (?)
Post 31 May 2010, 21:10
View user's profile Send private message Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 201
Thanks revolution.

I have been trying to extend the proc macro but cannot get it to work Sad Well, with my lack of knowledge in macros... Smile

I mean, I want that the "public" word can be added or not and not just make all procs public.

Any help?
Post 01 Jun 2010, 08:59
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16654
Location: In your JS exploiting you and your system
You can try to add this to PROC32.INC:
Code:
...
   match =params, params \{ params equ statement
                      flag = 0 \}
; ADD vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
   match =PUBLIC args, params \{ params equ args
                         public name \}
   match =PUBLIC, params \{ params equ
                   public name \}
; ADD ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   match =uses reglist=,args, params \{ regs equ reglist
                                 params equ args \}
...    
I have not tested it. But it should be able to give you a starting point to work from.
Post 01 Jun 2010, 09:10
View user's profile Send private message Visit poster's website Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 201
Thanks revolution!

I have checked it but unfortunately, the proc is not made public. The "PUBLIC" after proc is accepted by the assembler with your modifications, but the "public name" directive does not seem to make effect.

Code:
TestProc proc PUBLIC param1
   
    fffffff   ; this should produce error
    ret 

TestProc  endp    


The above is compiled correctly. Only when I put explicitly "public TestProc" the assembler gives error on "ffffffff" line.

Thanks
Post 01 Jun 2010, 12:08
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16654
Location: In your JS exploiting you and your system
alorent wrote:
Code:
TestProc proc PUBLIC param1    
Try with the fasm syntax.
Code:
proc TestProc PUBLIC param1    
Post 01 Jun 2010, 12:17
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
alorent wrote:
Only when I put explicitly "public TestProc" the assembler gives error on "ffffffff" line.
If function label is unused, function body is skipped altogether.
Post 01 Jun 2010, 12:34
View user's profile Send private message Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 201
Thanks a lot guys! Smile
Post 02 Jun 2010, 09:22
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.