flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Is there a way to make a SafeInclude?

Author
Thread Post new topic Reply to topic
jbojarczuk



Joined: 21 Jun 2006
Posts: 27
jbojarczuk 14 Jan 2007, 20:57
Hi,

I wanted to be able to make something like:

SafeInclude dir@file

And let Fasm discover that this symbol is not yet declared, and then include only once in the file.
This way, if I have two equal includes, there would be no problem, and I would not have to alter the code inside the included files.

I was thinking of something like
[code]
macro SafeInclude a_strFile{
\match =a_strFile#_INCLUDED , a_strFile#_INCLUDED\{
INCLUDE_@ a_strFile
a_strFile#_INCLUDED equ TRUE
\}
}
[/code]

The problem, obviously, would be in the INCLUDE_@ macro. I just can't seem to make a macro that would turn the @ sign into a slash at preprocessor time (tried load char from ... and some other stuff, but didn't work).

Any ideas?

Thanks all
Post 14 Jan 2007, 20:57
View user's profile Send private message Reply with quote
jbojarczuk



Joined: 21 Jun 2006
Posts: 27
jbojarczuk 14 Jan 2007, 22:15
I am sorry, I am even feeling kind of stupid. (I don't really like those messages that are posted and answered to by the same person, but I do not intend to make any of you waste your unnecessarily).

Solved the problem using the C++ preprocessor.

Thanks for everybody's time.
Post 14 Jan 2007, 22:15
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.