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: 20299
Location: In your JS exploiting you and your system
revolution 13 Feb 2010, 11:13
Does compile:
Code:
db 0,\
1,\
\
3    
Does not compile:
Code:
db 0,\
1,\
\/*  2,\ */
3    
Post 13 Feb 2010, 11:13
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 13 Feb 2010, 11:17
revolution wrote:
Does not compile:
Code:
stdcall Something,value1,\ 
  value2,\
/*  value3,\ */
  value4
    
Does not compile ? NORMAL ! ("value4" is "alone" !)


Code:
stdcall Something,value1,\  
  value2,\ 
/*  value3,\ */\   <---- This compiles without any problems!
  value4



that being said, this (below) doesn't compile any more !!
==========================================================

stdcall Something,value1,\ 
  value2,\
;  value3,\
  value4

    

(But is this really a problem in this case ? the "logic" is preserved)

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


Last edited by ouadji on 13 Feb 2010, 20:01; edited 9 times in total
Post 13 Feb 2010, 11:17
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 13 Feb 2010, 11:55
Code:
db 0,\ 
1,\ 
\x/*  2,\ */  <--- x = space
3
    


This works.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 13 Feb 2010, 11:55
View user's profile Send private message Send e-mail Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 13 Feb 2010, 19:46
Thank you ouadji for your support, I really appreciate it. Very Happy

Yes, this patch (introduction of the C-style multiline comments) was made and presented by me here, on this forum, almost three years ago, so it is fully understandable that this version of 'PREPROCE.INC' should work perfectly with older versions of the FASM compiler and may cause some problems with newer versions. I haven't changed it since 2007 but it isn't too difficult to upgrade it to match also newer versions. I may consider it, however actually making corrections in the FASM sources isn't on the top of my task list. Wink
Post 13 Feb 2010, 19:46
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 13 Feb 2010, 22:03

I improved it.

Code:
Does compile
============
-------------------------------------------ok
/* don't look here */
-------------------------------------------ok
/* xor eax,eax ;zero eax */
-------------------------------------------ok
db 0,\ 
1,\ 
\/*  2,\ */ <----- @revolution : without space now. (with or without)
3
-------------------------------------------ok
/*
    cmp     ebx,'/*'
*/
-------------------------------------------ok
stdcall MyProc ,eax,\  
ebx,\
/*  ecx,*/\    <- "\" is Mandatory. But with ";" and without "\" in the end,
edx                           it does not compile any more !

-------------------------------------------ok for all cases below

/*
comment
*/

    mov     eax, /* comment */ 'halt'

/* comment */   mov     eax , eax


stdcall /* comment */ MyProc, eax, ebx /*
comment */ , ecx, edx


MyProc /* comment */ : /* comment */ ret


struc array /* comment */ [arg] {
common
      match n def, /* comment */ arg \{
/* comment */ rept 1 %:1 \\{ /* comment */ . def  \\}
/* comment */ rept n-1 %:2 \\{ .\\#_/* comment 
                      */\\#% def \\}
 \}
/* comment */ }

very many possible variations!
and certainly more powerful than just ";"

=================================================================
this doesn't compile
====================

/*
        mov     eax,'*/' <--- difficult to solve this, possible, but more complex
/*
here : --> ; mov eax,'*/'
-------------------------------
/* mov bx,"*/"  */   <---- identical to previous case
here : --> ; mov bx,"*/"
-------------------------------
stdcall KeGetCurrentIrql,eax,\  
ebx,\
/*  ecx,*/       <---- PS : with "; ecx," it doesn't compile any more !!
edx              <--- but it's normal, "edx" is alone !!

PS: with /* ecx,*/\ ... it's ok !
-------------------------------
xor eax,eax ;zero eax /*
ignore me */ 
             doesn't compile, normal ...  
             ";" has priority over "/* */" !
             therefore, "ignore me */" is alone, 
             without the sign "/*" of the beginning. !!                 
-------------------------------
    

not convinced yet guys ? Wink

The few cases that don't work, are either difficult to solve,
or it is logically understandable that they don't work.
They are not many compared to others.
And in these special cases, we can always use ";".

is it no more useful, easy and convenient that the only possibility with ";"?

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


Last edited by ouadji on 21 Sep 2010, 20:25; edited 1 time in total
Post 13 Feb 2010, 22:03
View user's profile Send private message Send e-mail Reply with quote
SFeLi



Joined: 03 Nov 2004
Posts: 138
SFeLi 14 Feb 2010, 06:47
Why don't you just use macros?
Post 14 Feb 2010, 06:47
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 14 Feb 2010, 07:12
Nested comments allowed? I tested it:

Compiles:
Code:
db /* 0    /**/
   */ 1    
So, I thought nesting was okay.

But, doesn't compile:
Code:
db /* 0    /* */
   */ 1    
Question
Post 14 Feb 2010, 07:12
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 14 Feb 2010, 09:03
Quote:

@SFeLi : Why don't you just use macros ?

for this ...
Code:
/* comment */ opcode
or,
invoke myproc, eax /*comment*/,ebx

and a thousand other cases.
    
Code:
@revolution : doesn't compile.

db /* 0    /* */ 
   */ 1
it's normal and logical that this does not compile, "*/ 1" is alone.

I never said that nested comments are allowed.
nested comments ...
theoretical concept which has the only goal of trying
to reverse rotation of the earth Smile

this works
-----------

db /* 0    /*  
   */ 1

this also works
----------------

db /* 0    /* */1
    


this, below, doesn't compile any more, it's a pity.
Code:
db /*   /* */ */ /* /* */ */ */ /*/*/***/*/*/   */ 1  Smile
    


if you want absolutely nested comments, it's quite possible.
Simply use a counter of nesting.
(Perhaps "n+1" counters for "n" levels of nesting)
But why to do ? To comment the comments ? Wink
and the comments about comments of comments ?
it makes no sense and even less useful !

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



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 14 Feb 2010, 19:45
Code:
Nested comments
----------------
everything below compiles without problem
------------------------------------------

       db 0,1,\/*comment  <-- ps: "\/*" (non-nested) == "\;"
 1,\ /*comment*/
    3  

     /*
          /*comment2*/comment1
        */

      /* don't look here */ ;'

      /* xor /*?*/eax,eax ;zero eax */

        mov     eax, /* comment - /*stop*/*/ 'halt'

   /* comment */   mov     eax , eax

       stdcall /* comment /* A/*B/*C*/D*/E*/ */ MyProc, eax, ebx /*
        comment */ , ecx, edx

   MyProc /* comment */ : /* /*C*/ comment */ ret

      stdcall KeGetCurrentIrql,eax,\
     ebx,\
      /*  ecx/*C/*not D*//*not E
  */*/,*/\
   edx

     /*
     cmp ebx,"/*" - cmp ecx,'/*' - '*/' but ?
   */

      /* comment *//* comment */

      mov   ecx,/*comment/*comment2*/*/'/*'
     mov   edx,'*/'

        dw/* 1 '/*' */'/*',/*null*/0

        mov /*a<-b/*not b<-a*/*/al,0/*but not/*al,'*/' */ok?*/ 

 mov     ecx,'/*'      /*
  movhlt  edx,"*/"      /* mov ecx,'/*' */*/

    

the simpler cases also work ! Wink

(the boss is still not interested ? this would be yet useful for FASM)

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


Last edited by ouadji on 21 Sep 2010, 20:27; edited 1 time in total
Post 14 Feb 2010, 19:45
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 15 Feb 2010, 20:41

It's pretty amazing to have no answers, or interest, from the boss about this proposal.
However, this is a real need CLIC 49%.

First, I started with the code of "MHajduk". I have optimized it, and then, to go even further,
i have modified it in particular to include nested comments. (thanks "revolution" Wink )

What is proposed here (MHajduk and me) is really an effective solution for multiline comments
It allows easily place comments (basic or multiline, nested or not) and in almost all cases.

Shame not to have more interest about this proposal.
Tomasz Grysztar certainly has his reasons to react this way, but I don't understand!

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


Last edited by ouadji on 15 Feb 2010, 21:29; edited 1 time in total
Post 15 Feb 2010, 20:41
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 15 Feb 2010, 20:48
Maybe Tomasz has not seen this topic.
Post 15 Feb 2010, 20:48
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 15 Feb 2010, 20:57

Yes revolution, it is indeed possible !

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



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 15 Feb 2010, 21:18

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


Last edited by ouadji on 16 Feb 2010, 10:16; edited 1 time in total
Post 15 Feb 2010, 21:18
View user's profile Send private message Send e-mail Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko 16 Feb 2010, 04:25
moderate liberalism ;Tomasz
&
person suppression ;we
&
indifference ;a baby out

talent approaches oddity
Post 16 Feb 2010, 04:25
View user's profile Send private message Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko 16 Feb 2010, 09:55
At least /**/ recognition begged from you, Tomasz.
Graphic aspect is not on the time.
Post 16 Feb 2010, 09:55
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 16 Feb 2010, 10:16

sorry, but i'm perfectionistic Razz

no difference in operation, but, more nice-looking code in PREPROCE.INC
(about "preserve line numbering", "Preserve_LineNum:" in PREPROCE.INC)

i modified the code of MHajduki about this.
i like the nice code, but it must also be perfectly logical.

I think it'll be the last release !
I don't see what I could still improve.
comment your sources just for the fun now ! Laughing

but, if you, you see something, tell me !
feedback and results of your tests are welcome !
(bad english ... i do my best)

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


Last edited by ouadji on 21 Sep 2010, 20:19; edited 1 time in total
Post 16 Feb 2010, 10:16
View user's profile Send private message Send e-mail Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 16 Feb 2010, 11:07
Good work ouadji but seems that there some corrections have to be made. Wink

I've just tested fasmw editor modified by you. Hmm... this simple code causes problems when compiled (Error: Invalid expression)
Code:
format PE GUI 4.0

include '%fasminc%/win32wx.inc'

.code

start:
        invoke  /***/ ExitProcess, 0


.end start    
and this one also
Code:
format PE GUI 4.0

include '%fasminc%/win32wx.inc'

.code

start:
        invoke  /* **/ ExitProcess, 0


.end start    
while this one compiles OK
Code:
format PE GUI 4.0

include '%fasminc%/win32wx.inc'

.code

start:
        invoke  /** */ ExitProcess, 0


.end start     
Post 16 Feb 2010, 11:07
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 16 Feb 2010, 11:30

thank you MHajduk, i will try to fix this ! Smile

it should certainly be possible !

but now, it's time to eat here 12.30 hrs ! Razz

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 16 Feb 2010, 11:30
View user's profile Send private message Send e-mail Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 16 Feb 2010, 11:34
ouadji wrote:
but now, it's time to eat here 12.30 hrs ! Razz
Bon appetit, ouadji!

Eet smakelijk, ouadji! Wink Very Happy
Post 16 Feb 2010, 11:34
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 16 Feb 2010, 11:51

ok, I saw where the problem was. (with syser)
I need a little time to solve it.

Quote:

Bon appetit, ouadji !

merci beaucoup , c'est gentil ça ! Very Happy

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 16 Feb 2010, 11:51
View user's profile Send private message Send e-mail 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.