flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Code Comment Macro Goto page 1, 2 Next |
Author |
|
Joshua 15 Jul 2006, 12:09
or a much easier version:
Code: comment fix macro comment Code: comment { blah blahblah blahblahblah } |
|||
15 Jul 2006, 12:09 |
|
Ancient One 16 Jul 2006, 07:13
how about multiline comment that can really comment ANYTHING? e.g
./* macro incomplete { .*/ |
|||
16 Jul 2006, 07:13 |
|
vid 16 Jul 2006, 08:49
chris: "." already has somewhat special meaning in "struc", check manual
joshua - maybe it could be improved to purge macro immeadiately after declaration |
|||
16 Jul 2006, 08:49 |
|
Joshua 16 Jul 2006, 17:53
As in:
Code: comment fix macro __COMMENT { end_comment fix } purge __COMMENT Usage: Code: comment blah blahblah blahblahblah end_comment |
|||
16 Jul 2006, 17:53 |
|
vid 16 Jul 2006, 21:59
yup, but you can also fix "}" symbol to leave usage as it was
Code: comment { ... } (sorry, i am lazy to write it myself, take it as excercise ) |
|||
16 Jul 2006, 21:59 |
|
UCM 17 Jul 2006, 00:48
Then you get a problem, since any other macros will be messed up.
|
|||
17 Jul 2006, 00:48 |
|
vid 17 Jul 2006, 07:08
only those inside comments - which would be messed up with any other way mentioned here, too. maybe you forgot that you can unfix "}" back to original meaning
|
|||
17 Jul 2006, 07:08 |
|
revolution 17 Jul 2006, 07:31
I often use 'IF 0' and 'END IF' to temporarily disable parts of code when testing. Using the macro style of commenting has too many problems for my liking. For permanent comments I always use the semi-colon.
|
|||
17 Jul 2006, 07:31 |
|
vid 17 Jul 2006, 08:16
revolution: macro style has problem with commenting macros (more precisely: texts conatining "}"). And you can't comment these with "if" anyway.
|
|||
17 Jul 2006, 08:16 |
|
UCM 17 Jul 2006, 19:29
vid: Let's see how it would work then, "unfixing" } back to it's original meaning.
|
|||
17 Jul 2006, 19:29 |
|
vid 17 Jul 2006, 22:23
sorry, i got wrong, i tried it and now i think it isn't possible
unfixing "}" is done this way: "} fix }", but i thought i can use something like "\} \fix \}" inside macro, unfortunately fasm's preprocessor works in other way (well... it is stated in manual... my bad) |
|||
17 Jul 2006, 22:23 |
|
chris 18 Jul 2006, 03:29
Quote: or a much easier version: yeah, but I like the highlighting effects of the special characters and the flexibility. Unfortunately, you can not comment out macro definitions in this way either: Code: comment fix macro __COMMENT { end_comment fix } purge __COMMENT ; not work comment macro inner{ display 'inner' } end_comment ; unless you modify the inner macros comment macro inner \{ display 'inner' \} end_comment the same thing happens for another version of using 'fix' - all because of the { or } is messed up with the macros you are trying to comment. I don't know a way to comment out the preprocessor things like macros or strucs definitions using preprocessor macros, even if the 'fix' has some priority over other preprocessor directives, as you can see, it just get messed up. Quote:
well, you have to use semicolon. Basically, the comment macro works only at the assembler level, if does not prevent preprocessor from getting into the commentted parts(it does for the assembler!). IMO, I don't comment out a macro definition because if you don't use it anywhere in your code, it has nothing to do with the output file; however, if you do use it somewhere and you wanna disable it for a while, the comment macro plays the role: Code: macro foo { display 'I am alive!' } ... ; still dead ./* foo .*/ Quote:
you are right, I just overlooked it for the first time. Fortunately, fasm seems to "use some extra circuit" to handle the dot within a struc macro: Code: macro . { display 'dot' } struc bar x { . dd x } foobar bar 1 the dot within a struc definition is always replaced with the name of the struc, no matter if it has already some other definitions. In one word, the comment macro is used for the code that if it were outside this macro, it would be assembled into the output file, and not for the pure preprocessor constructions - consider the following situation: Code: macro prolog_comment_inside size { ./* push ebp mov ebp,esp sub esp,size .*/ } macro prolog size { push ebp mov ebp,esp sub esp,size } start_1: prolog_comment_inside 16 ; or start_2: ./* prolog 16 .*/ the comment macro used somewhat differently in the above examples, but the rule is that both of them are used for code that will be assembled into output file. I hope this clarifies some aspects of the code comment macro. |
|||
18 Jul 2006, 03:29 |
|
Joshua 19 Jul 2006, 18:00
hmm, maybe a cleaner version would be:
Code: comment fix rept 0 Code: comment { blah blahblah blahblahblah } On a side note, it doesn't appear possible to fix special chars... is it possible to change that in a future fasm version? |
|||
19 Jul 2006, 18:00 |
|
okasvi 19 Jul 2006, 19:25
I dont really get it, I see this as problem for editor used to be solved, fasm already provides ';' for commenting, and IF you really need faster way to comment blocks of code, use editor that supports commenting blocks of code with ';'.
edit: I think winasm studio or w/e it's called does that, or then it was radasm, or maybe them both. |
|||
19 Jul 2006, 19:25 |
|
rugxulo 19 Jul 2006, 20:17
The comment directive is supported by most other assemblers. I'm not saying that I really need it personally, but if it can't be done easily with macros, maybe Privalov should implement it natively.
|
|||
19 Jul 2006, 20:17 |
|
vid 19 Jul 2006, 22:06
honestly, how often are you commenting a complex macro definition?
|
|||
19 Jul 2006, 22:06 |
|
Nikolay Petrov 25 Jul 2006, 21:37
vid wrote: honestly, how often are you commenting a complex macro definition? rugxulo wrote: ...implement it natively... _________________ regards |
|||
25 Jul 2006, 21:37 |
|
Borsuc 29 Jul 2006, 17:56
Why can't you guys just use ";" at each line? This way you also look and "inspect" that line to see if it really needs to be commented.
Let's not make Fasm bloated design, having 7 different ways to comment a piece of code (I know I exaggerate here). |
|||
29 Jul 2006, 17:56 |
|
dead_body 30 Jul 2006, 06:43
Quote:
and if i must comment a page? it will eat much of time to comment big numbers of lines. |
|||
30 Jul 2006, 06:43 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.