flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > multi-line comments in FASM

Author
Thread Post new topic Reply to topic
cyberakl



Joined: 18 Apr 2013
Posts: 1
cyberakl 30 Jul 2013, 08:05
Hi, dear friends!

I'd love to see in FASM multi-line comments, like in MASM:

Code:
COMMENT marker

text

marker    


or by analogy with the C language:

Code:
/*

text

*/    


it would be very nice if the author has implemented the directive....

p.s. I apologize for my bad English.
Post 30 Jul 2013, 08:05
View user's profile Send private message Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 839
Location: Jakarta, Indonesia
TmX 30 Jul 2013, 08:26
MHajduk once proposed a patch to enable multiline comments:
http://board.flatassembler.net/topic.php?t=7115

I don't think the patch was accepted.
Post 30 Jul 2013, 08:26
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8205
Location: Kraków, Poland
Tomasz Grysztar 30 Jul 2013, 08:36
Post 30 Jul 2013, 08:36
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 30 Jul 2013, 08:45
cyberakl, multi-line comments are context type, steam construction and in general contradicts the context-less, line based assembly syntax. That is why IMO, such comments are not acceptable.

Of course, working with FASM macros, it is relatively easy to make context dependent structures. (Including multiline comments), but it is not the same and (again IMO) is a little bit more acceptable.

Code:
macro comment {
  match +,- \{
}

end_comment fix }    
Post 30 Jul 2013, 08:45
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
dogman



Joined: 18 Jul 2013
Posts: 114
dogman 30 Jul 2013, 12:49
If you have to have this you could probably run the C preprocessor over your source. It also might be interesting to write a preprocessor in fasm. That might be a little better argument for including it in the tools.
Post 30 Jul 2013, 12:49
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1521
Location: Toronto, Canada
AsmGuru62 30 Jul 2013, 14:30
I think the IDEs these days have the ability to comment/uncomment blocks of code by
inserting/removing ';' at the beginning of every line in the block.
Post 30 Jul 2013, 14:30
View user's profile Send private message Send e-mail Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1898
DOS386 10 Aug 2013, 08:43
Post 10 Aug 2013, 08:43
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1178
Location: Unknown
HaHaAnonymous 07 Apr 2015, 00:32
One of the simpler ways to have block comments in FASM is by doing the following:

    1.Backup files.
    2.Run external program to remove comments.
    3.Rename file to original name.
    4.Assemble file with FASM.
    5.Recover from backup file regardless of FASM being executed successfully.

You can download the example implementation by using makefile from here: http://201.46.215.18/download.js?sample.tar.bz2

Remove custom block comments by running: "crm <comment_start> <comment_end> <source_file>".

Example:
bash: crm '/*' '*/' /path/to/source.asm > /path/to/output.asm

Notes:
Comment nesting is ignored.
Input file must be UTF-8 or ordinary ASCII. Detected end of line modes are CR, CRLF or LF.

If there is any problem of using this method, please let me know. I could not find any till now.

I apologize for any inconveniences I may have caused.


Description:
Download
Filename: sample.tar.bz2
Filesize: 35.54 KB
Downloaded: 766 Time(s)

Post 07 Apr 2015, 00:32
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 19470
Location: In your JS exploiting you and your system
revolution 07 Apr 2015, 00:59
HaHaAnonymous wrote:
One of the simpler ways to have block comments in FASM is by doing the following:

    1.Backup files.
    2.Run external program to remove comments.
    3.Rename file to original name.
    4.Assemble file with FASM.
    5.Recover from backup file regardless of FASM being executed successfully.
Yes, this will work to a point. But for projects that use multiple files it becomes quite cumbersome. And rather than overwriting the original and then recovering it later perhaps you can make a temporary comment-stripped-file instead and assemble that. That way the original is not touched which gives better immunity to crashes and other unexpected events.
Post 07 Apr 2015, 00:59
View user's profile Send private message Visit poster's website Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1178
Location: Unknown
HaHaAnonymous 07 Apr 2015, 01:16
Quote:

That way the original is not touched which gives better immunity to crashes and other unexpected events.

But the original file is not touched in practice... D:
Post 07 Apr 2015, 01:16
View user's profile Send private message Reply with quote
PeExecutable



Joined: 26 Jun 2015
Posts: 181
PeExecutable 14 Jul 2015, 20:27
Write help files instead of huge comments. When you create subroutines that you re-use frequently, put it in a general help file that documents its usage. When you have finished that, drink a cup of coffee.
Post 14 Jul 2015, 20:27
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-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.