flat assembler
Message board for the users of flat assembler.

Index > Main > Is DEFINE defined?

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20309
Location: In your JS exploiting you and your system
revolution 10 Jan 2024, 22:05
Let's review.

First block:
Code:
        match reg =, =StupidSum =( num =), args \{
                mov reg, num + 5
        rept 0 \{\} ; <--- match ends here, this is its closing brace    
Second block:
Code:
                    rept 1 \{
                mov args
        \}    
There are no inner or outer blocks. They are two linear blocks one after the other.
Post 10 Jan 2024, 22:05
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 798
Location: Russian Federation, Sochi
ProMiNick 10 Jan 2024, 22:32
revolution wrote:
Let's review.

First block:
Code:
        match reg =, =StupidSum =( num =), args \{
                mov reg, num + 5
        rept 0 \{\} ; <--- match ends here, this is its closing brace    
Second block:
Code:
                    rept 1 \{
                mov args
        \}    
There are no inner or outer blocks. They are two linear blocks one after the other.

yes in unsuccess match - match preprocessor block acts as every other preprocessor block - match closed at first valid closed bracket for that nesting level of preprocessor blocks. why it acts differ in success match?

_________________
I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.
Post 10 Jan 2024, 22:32
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: 20309
Location: In your JS exploiting you and your system
revolution 11 Jan 2024, 00:00
Let's review the result after successful match:
Code:
               mov reg, num + 5            ; match outputs this line
        rept 0 {                           ; match outputs this line
                    rept 1 { ; <--- extra open brace has no effect. 
                mov args
        } ; <--- rept 0 closes here    
Post 11 Jan 2024, 00:00
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 798
Location: Russian Federation, Sochi
ProMiNick 11 Jan 2024, 00:17
revolution wrote:
Let's review the result after successful match:
Code:
               mov reg, num + 5            ; match outputs this line
        rept 0 {                           ; match outputs this line    

Code:
}                         ; where this one, how rest goes if here is match closed or rept closed    

revolution wrote:
Code:
                    rept 1 { ; <--- extra open brace has no effect. 
                mov args
        } ; <--- rept 0 closes here    

_________________
I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.
Post 11 Jan 2024, 00:17
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: 20309
Location: In your JS exploiting you and your system
revolution 11 Jan 2024, 00:29
I showed the next five lines encountered after match has finished. The preprocessor simply continues on to process those five lines as if you had typed then exactly like that.
Post 11 Jan 2024, 00:29
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 798
Location: Russian Federation, Sochi
ProMiNick 11 Jan 2024, 00:42
Question not answered. Why preprocessing of success match differ from documentation, differ from behavior of any other preprocessor block, differ from match itself in unsuccess state?
Where missed } that I point - why it not closes match or rept?
Post 11 Jan 2024, 00:42
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: 20309
Location: In your JS exploiting you and your system
revolution 11 Jan 2024, 00:47
It doesn't differ from the docs. It works exactly as described. Same behaviour.
Code:
match a,b {
 ; something
 rept 0 {
} ; finish match
rept 1 {
 ; other thing
} ; close either rept 0 or rept 1    
Post 11 Jan 2024, 00:47
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 798
Location: Russian Federation, Sochi
ProMiNick 11 Jan 2024, 00:53
behavior as described has only unsuccess match case.
Why in one case } - closes match and its inner block content, in other case same } not closes match and its inner block content?
Post 11 Jan 2024, 00:53
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: 20309
Location: In your JS exploiting you and your system
revolution 11 Jan 2024, 00:59
If match fails then the output is
Code:
rept 1 {
 ; other thing
} ; close rept 1    
If match succeeds then the output is:
Code:
 ; something
 rept 0 {
rept 1 {
 ; other thing
} ; close rept 0    
Post 11 Jan 2024, 00:59
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 798
Location: Russian Federation, Sochi
ProMiNick 11 Jan 2024, 01:06
revolution wrote:
If match succeeds then the output is:
Code:
 ; something
 rept 0 {
rept 1 {
 ; other thing
} ; close rept 0    

why succes match case inner block parsed differently from everithing else that exist in preprocessor stage?
Code:
 ; something
 rept 0 {
} ;where gone this one bracket?
rept 1 {
 ; other thing
} ; close rept 0    

_________________
I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.
Post 11 Jan 2024, 01:06
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: 20309
Location: In your JS exploiting you and your system
revolution 11 Jan 2024, 01:11
";where gone this one bracket?"

That is the closing brace for the match block. Macros don't output their own braces.
Code:
 ; match a,b { ; starting match opening brace, not outputted only things inside the braces are output
 ; something
 rept 0 {
; } ; finish match closing brace not outputted
rept 1 {
 ; other thing
} ; close either rept 0 or rept 1    
Post 11 Jan 2024, 01:11
View user's profile Send private message Visit poster's website Reply with quote
pfranz



Joined: 13 Jan 2007
Posts: 116
Location: Italy
pfranz 11 Jan 2024, 03:49
Thanks for your replies, but maybe I wasn't clear.
I used "mov" as an example, but I would need functions to be used with every instruction that takes parameters, without having to re-define each of them.
Post 11 Jan 2024, 03:49
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20309
Location: In your JS exploiting you and your system
revolution 11 Jan 2024, 04:51
Code:
irp inst,mov,cmp,xor,add,... {
  macro inst ... \{
 ;...
 \}
}    
Post 11 Jan 2024, 04:51
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 11 Jan 2024, 08:49
pfranz wrote:
Thanks for your replies, but maybe I wasn't clear.
I used "mov" as an example, but I would need functions to be used with every instruction that takes parameters, without having to re-define each of them.
There is an inline macro processor for fasmg: https://raw.githubusercontent.com/tgrysztar/fasmg/master/packages/utility/inline.inc
Works with fasm 2, too. There is no such easy solution for fasm 1, though (see above post).
Post 11 Jan 2024, 08:49
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

< 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.