flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > PROC32.INC: Why unused proc exclude from source?

Author
Thread Post new topic Reply to topic
Dimas



Joined: 02 Sep 2010
Posts: 17
Dimas 08 Sep 2010, 10:01
proc asdfgh
ret
endp

From PROC32.INC:
macro proc [args] ; define procedure
{ common
match name params, args>
\{ define@proc name,<params \} }
...
[skip]
...
macro define@proc name,statement
{ local params,flag,regs,parmbytes,localbytes,current
if used name
name:
...

In code:
call asdfgh
will preprocess proc to:
asdfgh: ret

But if proc unused it must be preprocess to:
ret ;without label

In fact if proc unused it preprocess to nouthing.

Why unused proc exclude from source? Where this line in PROC32.INC?

EDIT by DOS386 : moved from Main to Macroinstructions
Post 08 Sep 2010, 10:01
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8357
Location: Kraków, Poland
Tomasz Grysztar 08 Sep 2010, 10:11
This feature was once requested by users and since then it became a standard behavior of "proc". It is the "if used name" line that causes this (if you decide to remove it, you also have to remove the "end if" that pairs to it, it is the one at the end of "finish@proc" macro).
Post 08 Sep 2010, 10:11
View user's profile Send private message Visit poster's website Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 08 Sep 2010, 10:39
if you wish to leave proc in binary file you may use something like this:
Code:
dummyvar = myproc

proc myproc
...    
Post 08 Sep 2010, 10:39
View user's profile Send private message Visit poster's website Reply with quote
Dimas



Joined: 02 Sep 2010
Posts: 17
Dimas 08 Sep 2010, 11:10
To Tomasz:
Yes, in fist time I made this. After I find another way.

But question in this:

MyMacro
... any code here <- this code don't exclude in any way
MyMacro2

but

proc label <- macro
... any code here <- may be exclude !!!!!!!!!!!!!!!!!!!!!!!!
endp <- macro

Is it feature of macro or fasm core? In which stage fasm leave out code.
Post 08 Sep 2010, 11:10
View user's profile Send private message Reply with quote
Dimas



Joined: 02 Sep 2010
Posts: 17
Dimas 08 Sep 2010, 11:32
macro MyMacro {
if ~ used Name
virtual
end if
}

macro MyMacro2 {
if ~ used Name
end virtual
end if
}

In this case code between MyMacro and MyMacro2 will be skip.
But I find nothing of the kind in PROC32.INC

Who cut code between proc and endp macro?
Post 08 Sep 2010, 11:32
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8357
Location: Kraków, Poland
Tomasz Grysztar 08 Sep 2010, 11:39
It is done this way:
Code:
macro MyMacro { 
if ~ used Name 
} 

macro MyMacro2 { 
end if 
}    
Post 08 Sep 2010, 11:39
View user's profile Send private message Visit poster's website Reply with quote
Dimas



Joined: 02 Sep 2010
Posts: 17
Dimas 08 Sep 2010, 11:58
Yes!
end if <- in macro finish@proc called from endp macro.

end if \} } <- in macro
\} end if } <- in my mind, sorry...

Thanks!
Post 08 Sep 2010, 11:58
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.