flat assembler
Message board for the users of flat assembler.

Index > Main > comment feature?

Author
Thread Post new topic Reply to topic
iklin



Joined: 20 Mar 2004
Posts: 120
Location: Russia, Siberia
iklin 12 Sep 2004, 07:12
Maybe it would be useful to make many-string comment feature in fasm? Idea
Something like
Code:
comment
....anything....
end comment
    

or
Code:
comment {
....anything....
}
    


I think it's not so hard to implement...
In a macro way it is so stupid
Code:
macro comment {
  macro __comment {
}
endcomment fix }
    

but it require to make this macro known to fasm before using...
And what if want have my big comment in the beginng of file?..

_________________
O, tempora! O, mores!
Post 12 Sep 2004, 07:12
View user's profile Send private message ICQ Number Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 12 Sep 2004, 08:00
You could always do something like this:

Code:
if 0
  This is a comment with multiple lines
  It will not be assembled by FASM
end if
    
Post 12 Sep 2004, 08:00
View user's profile Send private message Visit poster's website Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld 12 Sep 2004, 09:44
Code:
comment fix macro _comment {
endc fix }

comment
  Comments here
endc    
Post 12 Sep 2004, 09:44
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
iklin



Joined: 20 Mar 2004
Posts: 120
Location: Russia, Siberia
iklin 12 Sep 2004, 10:37
Thanx!
I'm so stupid time to time... Crying or Very sad

_________________
O, tempora! O, mores!
Post 12 Sep 2004, 10:37
View user's profile Send private message ICQ Number Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 12 Sep 2004, 11:22
Multi-line comments are sometimes errorprone when no nesting is
implemented(C-style):
Code:
Useful code
/*
Some code
not needed right now
*/
Useful code
    

ok, nice Cool
but what if you wanted to comment out these *useful* lines Shocked
Code:
/*
Useful code
/*
Some code
not needed right now
*/          <==ok, what happens here is that comments end
Useful code
*/          <==this has no use here
    

_________________
My updated idol Very Happy http://www.agner.org/optimize/
Post 12 Sep 2004, 11:22
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 12 Sep 2004, 12:43
Quote:
but what if you wanted to comment out these *useful* lines


My solution would work Smile
Post 12 Sep 2004, 12:43
View user's profile Send private message Visit poster's website Reply with quote
silkodyssey



Joined: 02 Oct 2003
Posts: 198
Location: St.Vincent & the Grenadines
silkodyssey 12 Sep 2004, 12:48
crc,

How does your solution work?

_________________
silkodyssey
Post 12 Sep 2004, 12:48
View user's profile Send private message MSN Messenger Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 12 Sep 2004, 12:53
Here's an example:

Code:
if 0
 Forth code:  drop swap .
end if
  add si, 2
  xchg ax, [si]
  call print
    


The if's can be nested, so it doesn't require any macros, and is fairly clean (I prefer to prefix comments by a ; though) Smile
Post 12 Sep 2004, 12:53
View user's profile Send private message Visit poster's website Reply with quote
silkodyssey



Joined: 02 Oct 2003
Posts: 198
Location: St.Vincent & the Grenadines
silkodyssey 12 Sep 2004, 13:59
crc.

I haven't tried the code but I am curious about the logic behind it. When you write "if 0" what are you testing?

_________________
silkodyssey
Post 12 Sep 2004, 13:59
View user's profile Send private message MSN Messenger Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 12 Sep 2004, 16:44
You're testing if "0" is defined (at least in NASM). As far as I can tell, this is never met, so it works well for block comments. (At least this has worked under NASM and FASM during the six years I've been writing assembly programs.)
Post 12 Sep 2004, 16:44
View user's profile Send private message Visit poster's website Reply with quote
Imagist



Joined: 13 Jun 2004
Posts: 114
Location: Pennsylvania (USA)
Imagist 12 Sep 2004, 18:59
I remember seeing somewhere that you can do this:

Code:
comment !
.... anything except exclamation point
!
    


The ! could be replaced by any symbol. I don't remember this too clearly though, so it might be from MASM, or it might be "bloc_comment" or something.
Post 12 Sep 2004, 18:59
View user's profile Send private message Visit poster's website Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld 12 Sep 2004, 19:15
Code:
comment fix if 0=1 ; something familiar, yea Wink
endc fix end if

comment
  useful code 1
  comment
    mike.dld
  endc
  useful code 2
endc    
Post 12 Sep 2004, 19:15
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 12 Sep 2004, 19:49
actually solution with defining unused macro should be better, as it throws away unnecessary text on preprocessing stage.
Post 12 Sep 2004, 19:49
View user's profile Send private message Visit poster's website Reply with quote
uri



Joined: 09 Apr 2004
Posts: 43
Location: L'viv, Ukraine
uri 12 Oct 2005, 11:42
like this:
Code:
macro comment [dummy]
{
        if defined blablabla
        'error: you must do not use blablabla'
}

macro   endc [dummy]
{
        end if
}
    


if user defines elsewhere 'blablabla' it will have error, but not an unexpected compilation of commented block.
Post 12 Oct 2005, 11:42
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias 12 Oct 2005, 12:31
Imagist wrote:
...The ! could be replaced by any symbol. I don't remember this too clearly though, so it might be from MASM, or it might be "bloc_comment" or something.

You are right. It is from TASM, and the symbol is the caret: ^
comment ^
whatever....
endcomment ^
everything between the two carets is ignored.
Smile
Post 12 Oct 2005, 12:31
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.