flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > rept bugs

Author
Thread Post new topic Reply to topic
idle



Joined: 06 Jan 2011
Posts: 359
Location: Ukraine
idle
Code:
display 13,10,'rept bugs',13,10

! = 5

if ! = 1
  rept 1{display 13,10,'you can see me'}

else if ! = 2
  rept 1{
    display 13,10,'you can see me'
    macro m1{display 13,10,'such nesting not allowed'}
    m1
    display 13,10,'you can not see me'
  }

else if ! = 3
  rept 1{
  display 13,10,'you can see me'
  macro m1\{display 13,10,'such nesting allowed'\}
  m1
  display 13,10,'you can see me'
  }

else if ! = 4
  rept 0{
    display 13,10,'you can see me'
    macro m1{display 13,10,'fasm ok here'}
  }

else if ! = 5
;uncomment me
;  rept 0{
;    display 13,10,'you can see me'
;    macro m1{display 13,10,'such nesting not allowed'}
;  }
end if         
    
Post 24 Jan 2011, 15:08
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17339
Location: In your JS exploiting you and your system
revolution
You have to "escape" the closing curly brackets to show the depth.
Code:
rept ... {
  macro ... \{ ;<--- escaped for readability here
  \} ;<--- must be escaped else we close the wrong block
}    
Post 24 Jan 2011, 15:22
View user's profile Send private message Visit poster's website Reply with quote
idle



Joined: 06 Jan 2011
Posts: 359
Location: Ukraine
idle
i know that, thanks
Code:
rept 1{
  macro m1{display 'fasm ignores wrong declared macro'}
  m1
  display 'fasm broken here'
  display 'set rept counter to 0, and all comes ok'
}
    

help me with those please
Code:
var1 equ 1

match =1, var1{
  rept 1\{
    display 'who is recognized first?'
  \}
}

; is this correct ?
match =1, var1{
  rept 1{
    display 'who is recognized first?'
  }
}
    
Post 31 Jan 2011, 07:03
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17339
Location: In your JS exploiting you and your system
revolution
idle wrote:
Code:
; is this correct ?
match =1, var1{
  rept 1{
    display 'who is recognized first?'
  }
}
    
This is a special case.

First the match block:
Code:
match =1, var1{
  rept 1{
    display 'who is recognized first?'
  }    
is matched and expanded to this:
Code:
  rept 1{
    display 'who is recognized first?'    
Note the lack of closing bracket "}".

And then the final closing bracket is seen to complete the rept block.

So the whole block is like this:
Code:
match =1, var1{ ;<--- open match
  rept 1{       ;<--- open rept
    display 'who is recognized first?'
  }             ;<--- close match
}               ;<--- close rept    
Post 31 Jan 2011, 07:20
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:  


< 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.