flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > saving result of preprocessing

Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7106
Location: Slovakia
vid
hi, how does the result of preprocessing look now? is it clear text?

I remember some it's parts were rewriten by storing values at place of text (like at macro declaration). Is it still there?

I would appreciate a little utility, which will only preprocess file using fasm syntax and save result. It will be very ususable tool for general usage, and for learning FASM macrosyntax too.
Post 07 Dec 2005, 14:36
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: 7434
Location: Kraków, Poland
Tomasz Grysztar
The FASMW has the code that converts single line from preprocessed code back into text form (it goes from "error_in_preprocessed" label in FASM.INC file) to display it in the error report box - but it displays only those lines, that after preprocessing go to the parser/assembler. In other types of lines (that got interpreted by preprocessor and don't go into parser), there are still some cases, when some of the symbols get altered/destroyed, like the invocation of structure macroinstruction.
Post 07 Dec 2005, 14:51
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7106
Location: Slovakia
vid
could you make executable which just outputs data that go to parser as normal text? Or guide how to alter FASM, but standalone utility looks better to me, because of many uses it could have.

Maybe it could be command-line switch, but as i know you, you wouldn't like it :]
Post 07 Dec 2005, 16:20
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: 7434
Location: Kraków, Poland
Tomasz Grysztar
OK, here you are - this is the Win32 console version of fasm reduced to preprocessor only and extended to convert preprocessed source back to text and write it into output file.
The output is in the form that can be then also assembled using fasm.


Description: pure fasm's preprocessor
Download
Filename: fasmpre.zip
Filesize: 10.59 KB
Downloaded: 806 Time(s)

Post 07 Dec 2005, 17:28
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1095
Location: Poland
decard
wow Shocked I preprocessed Fresh and got 13mb file.
Could you write how to change it to generate output without comments (just pure code that goes to parser)?
Why it generates so many empty lines?
Post 07 Dec 2005, 17:49
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7434
Location: Kraków, Poland
Tomasz Grysztar
The lines that have only comments inside become the empty ones. The parser then strips them out.
Post 07 Dec 2005, 17:56
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1095
Location: Poland
decard
Here's my version (actually I wrote it for fun Wink), that generates output without preprocessor stuff in comments and without empty lines. My addition is terrible (when you look at source), but it took me only 5 minutes to write and test it, and it does its job well.


Description:
Download
Filename: fasmpre.ZIP
Filesize: 11.01 KB
Downloaded: 658 Time(s)

Post 07 Dec 2005, 19:00
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7106
Location: Slovakia
vid
great job. i thought symbols containing "?" are split during pre-preprocessing, so they can't be used directly. btw, about 3Mb is generated only by win32axp.
Post 07 Dec 2005, 21:23
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: 7434
Location: Kraków, Poland
Tomasz Grysztar
And to go into opposite direction than decard Wink here's the version that additionally indents the lines generated by macroinstruction, so you can see the overall structure better (each next level of macro causes deeper indent).


Description:
Download
Filename: fasmpre.zip
Filesize: 10.76 KB
Downloaded: 845 Time(s)

Post 07 Dec 2005, 22:41
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7106
Location: Slovakia
vid
i have 2 ideas

1. Make these things adjustable, i mean mode without macro line, with them, and with them indented. (well, second one doesn't have to be there). You would choose with some command line parameter. Or just command line parameter to remove macrolines from output.

2. put the code into some module (like "PREWRITE") and just call some write_preprossed_file after call preprocess. It fills more into source logic (i think) and is nicer to much work with.
Post 07 Dec 2005, 23:07
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
aq83326



Joined: 25 Jun 2011
Posts: 21
aq83326
Tomasz Grysztar wrote:
And to go into opposite direction than decard Wink here's the version that additionally indents the lines generated by macroinstruction, so you can see the overall structure better (each next level of macro causes deeper indent).


I can compile with both fasm and fasmw but fasmpre gives me an 'out of memory' error.
Post 10 Jan 2012, 10:58
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7434
Location: Kraków, Poland
Tomasz Grysztar
This is an obsolete thread. In modern versions of fasm you can get preprocessed source with "prepsrc" program from TOOLS subdirectory.
Post 10 Jan 2012, 11:04
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.