flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > suggestion /*Comments*/ (final rev.8 - over for me)

Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20445
Location: In your JS exploiting you and your system
revolution 24 Feb 2010, 15:25
ouadji wrote:

"highlight/lowlight" is not a feature of the compiler, but a feature of the text editor.
This is not a special feature of FASMW. I have this feature also with UEStudio.
I must just specify what is the symbol that marks the beginning of a comment.
FASMW is a "integrated product" (text editor + fasm).
FASMW does not have this option (choice of symbol)

So can you post a set of patches for fasmw that will make it show commented blocks in alternate colours?
Post 24 Feb 2010, 15:25
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 05 Mar 2010, 08:04

I just saw this,
I use UEStudio clic here
and with it, no problem with block and multiline comment.
it has a configuration file (fasm.uew)
where you can specify the symbols start/end of block comment.
Quote:

UEStudio - fasm.uew
-----------------------
....
Line Comment = ;
Block Comment On = /* Block Comment Off = */
....

with my fasm code (/**/), it's really a nice work environment for comments

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 05 Mar 2010, 08:04
View user's profile Send private message Send e-mail Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko 05 Mar 2010, 08:28
Quote:

clic here

do you have a crack
Post 05 Mar 2010, 08:28
View user's profile Send private message Reply with quote
booter



Joined: 08 Dec 2006
Posts: 67
booter 07 Mar 2010, 08:59
There is another problem with current processing of comments.
It's impossible to comment multi-line constants.
Code:
longexample db \  ; doesn't work here
   "aaaa aaaaaaa aaaaaaaa",10,13,\  ; doesn't work here
   "aaaa aaaaaaa aaaaaaaa",10,13,\  ; doesn't work here
   "aaaa aaaaaaa aaaaaaaa",10,13    ; here it does
    
Post 07 Mar 2010, 08:59
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 07 Mar 2010, 09:58

This, below, compiles without problem.
where is the problem ?
Give me a specific example that does not compile.
thank you.
Code:
this, below, compiles without problem,

longexample db \  /* comment */ ;fasm
/* comment */
/* comment */   "aaaa aaaaaaa aaaaaaaa",/* comment */ 10,13,\  /* comment */ ;fasm
/*

 comment 

*/
/* comment */   "aaaa aaaaaaa aaaaaaaa",/* comment */ 10,13,\  /* comment */ ;fasm
/* comment */   "aaaa aaaaaaa aaaaaaaa",/* comment */ 10,13    /* comment */ ;fasm

and more simply this too,

longexamplex db \  ; does compile 
   "aaaa aaaaaaa aaaaaaaa",10,13,\  ;  does compile 
   "aaaa aaaaaaa aaaaaaaa",10,13,\  ;  does compile 
   "aaaa aaaaaaa aaaaaaaa",10,13    ;  does compile 
    

sorry, I don't understand your comment about that !

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 07 Mar 2010, 09:58
View user's profile Send private message Send e-mail Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 07 Mar 2010, 12:16
ouadji,

Probably booter is talking about regular ; comments that indeed break line continuation.

__________
booter,

How do you expect FASM to interpret that lines if you've commented out db directive? Second and third lines can be easily commented out with \;.
Post 07 Mar 2010, 12:16
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 07 Mar 2010, 12:36

i don't understand (my english ... "about regular" ? ... Embarassed )

like this ?
Code:
longexamplex db \  
   "aaaa aaaaaaa aaaaaaaa",10,13,\ 
 ; fasm comment 
   "aaaa aaaaaaa aaaaaaaa",10,13,\  
   "aaaa aaaaaaa aaaaaaaa",10,13
    


_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 07 Mar 2010, 12:36
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 07 Mar 2010, 14:56

with regular fasm 1.69.12, this does compile without problem.
Code:
longexample db \  ; fasm comment
   "aaaa aaaaaaa aaaaaaaa",10,13,\  ; fasm comment
   "aaaa aaaaaaa aaaaaaaa",10,13,\  ; fasm comment
   "aaaa aaaaaaa aaaaaaaa",10,13    ; fasm comment
    


_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 07 Mar 2010, 14:56
View user's profile Send private message Send e-mail Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 07 Mar 2010, 16:57
ouadji,

Something like that:
Code:
longexample db \  ; doesn't work here
;   "aaaa aaaaaaa aaaaaaaa",10,13,\  ; doesn't work here
   "aaaa aaaaaaa aaaaaaaa",10,13,\  ; doesn't work here
   "aaaa aaaaaaa aaaaaaaa",10,13    ; here it does

; This is my method which works:
longexample db \
\;   "aaaa aaaaaaa aaaaaaaa",10,13,\
\;   "aaaa aaaaaaa aaaaaaaa",10,13,\
   "aaaa aaaaaaa aaaaaaaa",10,13    
Post 07 Mar 2010, 16:57
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 07 Mar 2010, 18:16
cool Very Happy

thanks baldr, it was a big problem for me since i use a macro and multiline for this kind of code:
Code:
screens:
        Gnode 0,0,4000,3000,\
\;       .8_5,.cga,.wxga,.wsxgap,.wuxga,.wqxga,\
       .4_3,.qvga,.vga,.pal,.svga,.xga,.sxgap,.uxga,.qxga,\
       .5_4,.sxga,.qsxga,\
       .5_3,.wvgap,.wxgap,\
       .16_9,.hd480,.hd720,.hd1080
    


very cool trick that should be referenced in the official fasm user manual, isn't it TG?
Post 07 Mar 2010, 18:16
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 07 Mar 2010, 20:59

baldr wrote:
ouadji,

Something like that:
Code:
longexample db \  ; doesn't work here
;   "aaaa aaaaaaa aaaaaaaa",10,13,\  ; doesn't work here
   "aaaa aaaaaaa aaaaaaaa",10,13,\  ; doesn't work here
   "aaaa aaaaaaa aaaaaaaa",10,13    ; here it does

; This is my method which works:
longexample db \
\;   "aaaa aaaaaaa aaaaaaaa",10,13,\
\;   "aaaa aaaaaaa aaaaaaaa",10,13,\
   "aaaa aaaaaaa aaaaaaaa",10,13    

with my multiline-comment code, it's ok.
The backslash effect "jumps over" comment. Razz

Code:
longexample db \  ; doesn't work here 
/*  ;   "aaaa aaaaaaa aaaaaaaa",10,13,\  ; doesn't work here  */
   "aaaa aaaaaaa aaaaaaaa",10,13,\ 
   "aaaa aaaaaaa aaaaaaaa",10,13
    


_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 07 Mar 2010, 20:59
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 08 Mar 2010, 19:22

my last code (release __4)
perfect code, flawless operation.
(edit : below, release __5)
Code:
;<version 5> 09 Mar 2010

sorry ...
my release 5 is not good.
I'm working on release 6.


    


_________________
I am not young enough to know everything (Oscar Wilde)- Image


Last edited by ouadji on 21 Sep 2010, 20:29; edited 20 times in total
Post 08 Mar 2010, 19:22
View user's profile Send private message Send e-mail Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko 08 Mar 2010, 19:47
where to place it?
Post 08 Mar 2010, 19:47
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 08 Mar 2010, 20:00

at the very end of "PREPROCE.INC"
(release __5 above)

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 08 Mar 2010, 20:00
View user's profile Send private message Send e-mail Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 09 Mar 2010, 23:41
ouadji,

Few comments:

or eax, 05000005h don't have to be hardcoded: xor eax, "'..'" xor '".."' is (almost) self-commenting and does not depend on whether '"'<"'". Similar trick could be used for CR/LF pair testing:
Code:
CRLF_:  cmp     al, 0Dh
        je      .next
        cmp     al, 0Ah
        je      .next
        clc
        ret
.next:  xor     al, 0Ah xor 0Dh
        cmp     al, byte [esi]
        jne     .done
        inc     esi
.done:  inc     edx
        stc
        ret    


St_symbol should begin with symbol from symbol_characters (minus control characters, space and ';') - not a big limitation though, only !$%.?@^_ aren't there.

Error in line that is continued from previous line incorrectly being reported as contained in the first line:
Code:
db \ /* error is reported here */
\
\
\
x; error is here    
To be fair, unmodified FASM reports it there too. FASMW, on the contrary, selects entire continuation block and shows preprocessed line as an instruction that caused an error:
Code:
db \; FASM reports an error and shows only this line, verbatim
\
\
\
x
; FASMW selects entire block and shows preprocessed "db x" as a source of an error    
Do you know that \/ and \* are valid symbol names?
Code:
\/ fix *
\* fix /
macro A {
  B equ \/* Hello
  C equ \*/ world
}
macro display_s v {
  match vv,v \{
    irps s,vv \\{ display \\`s \\}
    display 13, 10
  \}
}
A
display_s B; should display **Hello
display_s C; should display //world    
Keep up the good work!
Post 09 Mar 2010, 23:41
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 10 Mar 2010, 02:02

Code:
A
--
or eax, 05000005h don't have to be hardcoded: 
but ....  xor eax, "'..'" xor '".."'
B
--
Similar trick could be used for CR/LF pair testing:
...  xor al, 0Ah xor 0Dh  
    

A : very good idea, very good comment, thank you
B : very good idea too, thank you
Quote:

St_symbol should begin with symbol from symbol_characters
(minus control characters, space and ';')

I don't quite understand what you mean.
Please, can you explain with "other words".
with symbol from "symbol_characters" ? from PREPROCE.INC, is that right?
sorry, but here, I don't understand the meaning of your remark.
Code:
\/ fix * 
\* fix / 
macro A { 
  B equ \/* Hello 
  C equ \*/ world 
} 
macro display_s v { 
  match vv,v \{ 
    irps s,vv \\{ display \\`s \\} 
    display 13, 10 
  \} 
} 
A 
display_s B; should display **Hello 
display_s C; should display //world
    

Wink ...
with "my" fasm, the problem is here :

B equ \/* Hello
C equ \*/ world

/* Hello
C equ \*/ ..... == comment !

and the result is :

B equ \
word

display for me :

word
C

I'll think about that problem ...
a little extreme Wink , but there is a solution to every problem.
Quote:

db \ /* error is reported here */
\
\
\
x; error is here

... To be fair, unmodified FASM reports it there too

yes, indeed ! but here too, i will think about this,
maybe it's possible to find a better solution and better result.
I do not know, i will see.
Quote:
Keep up the good work!
Wink thank you.

thank you very much for your feedback
It helps me to improve my code.
it's very nice of you.

PS : ".next: xor al, 0Ah xor 0Dh" ... it's great this ! Wink i like it !

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 10 Mar 2010, 02:02
View user's profile Send private message Send e-mail Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 10 Mar 2010, 07:31
ouadji,

Yes, symbol_characters. I mean that if you try to change comment start to "!(" for example, it won't work because "!", as non-symbol character, will be handled before symbol_character: is reached (at convert_symbol: Wink).

The whole \/ issue is artificial. ';' comments are handled specifically after '\' (only \; is allowed, with intervening linear whitespace), probably it won't worth to resolve this (deserves note in mod documentation though).

I've been tinkering with textequ macro and decide to split it in two:
Code:
struc textequ [arg] {
common
  . equ
  irps s,arg \{
    match v,.\\#\\`s \\{
      restore .
      . equ v
    \\}
  \}
}
struc ! [arg] { common match v,arg \{ . v \} }
macro ! [arg] { common match v,arg \{ v \} }

; Usage:
@S_ ! textequ Start_symbol
@E_ ! textequ End_symbol    
First one looks familiar: it works similarly except commas are allowed inside arg and symbolic constants aren't expanded in it. This is the work for the following macros ("!" – I'm calling them "prefix macros", since they modify behavior of the following instruction) – it performs expansion and invokes expanded arg. Probably it is too powerful: even macro name will be substituted if there is appropriate equ/define. Wink
Post 10 Mar 2010, 07:31
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 10 Mar 2010, 09:56

Quote:

The whole \/ issue is artificial ....

"artificial" Wink ... yes, but the séquence "\/" is not a problem !
Code:
with  :  ..... \/ fix * ....
or : ..... B equ \/* Hello ...
    

my code reacts well, (reacts ??? perhaps ... "my code is behaving normally")
and simply detects the comment that must detect.

B equ \/* Hello
C equ \*/
world

In fact, a ghost comment here ...
But "\/" isn't a problem in itself.
Quote:

I've been tinkering with textequ macro and decide to split it in two:
.....
; Usage:
@S_ ! textequ Start_symbol
@E_ ! textequ End_symbol

very nice ! After a while of thinking, i understood how it works (ouéééé Razz )
yes, very powerful. But this power is not really necessary in my case.
I prefer to keep your first solution
but nice work !

Quote:

but for "ghost comment" in :
--------------------------------

B equ \/* Hello
C equ \*/ world

and :
------

"symbol_characters" ... "if you try to change comment start to "!(" "

in both cases just above, i think there are ways to find a good solution.
maybe handle the FASM code earlier, to handle "non-symbol" character.
It's possible and it should not be a problem ... but is it necessary?
yes, why not ... I'll try that.

and for "ghost comment" (for very difficult and complex cases)
maybe, a command that allow to disable "multiline comments" on a piece of code.
It's possible to do this, it's not a big problem.
(for very complex cases, and ... baldr's cases Wink ... I tease you).

but, jokes aside, e.g. : "stop_com/go_com"
you would be able to place this command anywhere,
even inside "struc" or "macro", why not ?

like this:
Code:
\/ fix *  
\* fix /  
macro A {  
  B equ \stop_com/* Hello  
  C equ \*/go_com world  
}  
macro display_s v {  
  match vv,v \{  
    irps s,vv \\{ display \\`s \\}  
    display 13, 10  
  \}  
}

or else, for those who don't really know where is the problem

stop_com
\/ fix *  
\* fix /  
macro A {  
  B equ \stop_com/* Hello  
  C equ \*/go_com world  
}  
macro display_s v {  
  match vv,v \{  
    irps s,vv \\{ display \\`s \\}  
    display 13, 10  
  \}  
}
go_com
    


thank a lot, have a good day.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 10 Mar 2010, 09:56
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 12 Mar 2010, 17:29

baldr, look at this below :

i'm working on revision 6.
I allow some control words (format: /*name!! + data)
Code:
- to disable/enable multiline comment.       /*idle!!        (no data)
- to change the symbols start/stop.        /*init!!xxxx    (xxxx = data = new start/stop)
    

"!()!" will be allowed too.

like this:
Quote:

this, below, does compile without problem
-------------------------------------------
\/ fix *
\/*idle!!* fix / <------------------------- start idle mode
macro A {
B equ \/* Hello
C equ \*/ world
}
macro display_s v {
match vv,v \{
irps s,vv \\ /*idle!!{ display \\`s \\} <<-- stop idle mode (anywhere)
display 13, 10
\}
}
A
display_s B; should display **Hello
display_s C; should display //world

;now, it displays **Hello and //word, correct.

/*init!!(!!) <-------------------- change symbols to "(! xxx !)"

db 0,\ (!comment!)
(!comment!)1

/*init!!/+-) <-------------------- change symbols to "/+ xxx -)

db 0, /+comment-)1

mov /+comment-)/*init!!/**/eax,/*comment*/ebx <-- back to "/* */"
; command "/*init!!xxxx , anywhere too.

db 0,\/* /* comment
*/ hello */1

Wink

_________________
I am not young enough to know everything (Oscar Wilde)- Image


Last edited by ouadji on 12 Mar 2010, 23:35; edited 3 times in total
Post 12 Mar 2010, 17:29
View user's profile Send private message Send e-mail Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 12 Mar 2010, 19:14
mov /*comment*/ eax,/*comment*/ebx ;comments?

no comment. i don't see the use of such a feature, even in 2010.
Wink
Post 12 Mar 2010, 19:14
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:  
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next

< 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.