flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > [DONE] function(params) -> invoke function,params

Author
Thread Post new topic Reply to topic
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
this is a demonstrate of fasm preprocessor power Very Happy

ther are two files.
one file have macroses to change syntax, second file contains the names of functions.

this macroses only replace some part of string.

for example:
Code:
;first declare it:

hllToFuncProcEx my_func:invoke

;and then you can use it:

my_func(param1,param2)

;and these macroses will change this string to:

invoke my_func,<param1>,<param2>
    


or something else:
Code:
hllToFuncProcEx text.write:libcall

;use it!

text.write(stream.stdout,\<"test string",10\>)

;it will be:

libcall text.write,<stream.stdout>,\<"test string",10\>    


why in last example \< needed see this topic:
http://board.flatassembler.net/topic.php?t=6293

nesting is supported.

example:

Code:
hllToFuncProcEx my_func1:invoke,my_func2:stdcall,my_func3:my_call_function


my_func1(my_func2(1,<"test",13,10>,my_func3()),my_func3(argument1))

;will be like next:

invoke my_func1,<stdcall my_func2,<1>,<'test',13,10>,<my_call_function my_func3>>,<my_call_function my_func3,<argument1>>
    


Description:
Download
Filename: syntax_script.zip
Filesize: 1.33 KB
Downloaded: 73 Time(s)

Post 20 Dec 2006, 22:13
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7797
Location: Kraków, Poland
Tomasz Grysztar
A little additional macro for another syntax modification:
Code:
macro pushd arg
{
  define arg@pushd
  irps x,arg
  \{ define tmp@pushd x
     match ~,tmp@pushd \\{ arg@pushd equ arg@pushd,
                           define tmp@pushd \\}
     match s,tmp@pushd \\{ arg@pushd equ arg@pushd tmp@pushd \\} \}
  match converted,arg@pushd \{ pushd <converted> \}
}    

Combined with your allows:
Code:
MessageBox(HWND_DESKTOP,"First line"~13~10~'Second line',"Example message",MB_OK)    

What do you think? Wink
Post 20 Dec 2006, 23:52
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
i have own version of pushd used with libcall Razz

Wouldn't it work by fixing ( and ) to <> just inside processing macro, and then fix them back?
Post 20 Dec 2006, 23:58
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
Quote:
What do you think?


unusual, but interesting.

this officially? Question
Post 21 Dec 2006, 07:36
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7797
Location: Kraków, Poland
Tomasz Grysztar
Not, it's not official. Just an interesting thought about simulating D syntax. Smile
Post 21 Dec 2006, 07:42
View user's profile Send private message Visit poster's website Reply with quote
Raedwulf



Joined: 13 Jul 2005
Posts: 375
Location: United Kingdom
Raedwulf
Very pretty
Post 21 Dec 2006, 10:59
View user's profile Send private message MSN Messenger 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.