flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [request] Single-dot mixed with double-dot labels in struc

Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 19277
Location: In your JS exploiting you and your system
revolution 13 Jul 2010, 06:41
Fails to compile:
Code:
struc foo bar {
      label . at ..table-$
        db bar
}
..table:
lab foo '123'     ;error: undefined symbol 'lab..table'.    
------------------------------------------------------------------------------------------

Successful compile:
Code:
struc foo bar {
        label . at table-$
  db bar
}
table:
lab   foo '123'    


Last edited by revolution on 13 Jul 2010, 14:09; edited 1 time in total
Post 13 Jul 2010, 06:41
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8142
Location: Kraków, Poland
Tomasz Grysztar 13 Jul 2010, 10:38
It is not a bug, it follows exactly the documented behavior - as you can read in section 2.3.4 of the manual, "[struc's] label will be (...) attached at the beginning of every name starting with dot in the contents of macroinstruction".

That's an interesting problem, however, since it clearly would be more useful if preprocessor allowed symbols starting with double dots to pass through and be interpreted by assembler, as this is what programmer might expect.

For now the solution is to tell preprocessor explicitly to pass such symbol through:
Code:
struc foo bar {
        label . at \..table-$
        db bar 
} 
..table: 
lab     foo '123'    
However I may consider redefining the "struc" behavior for the double-dotted symbols. Do we have any real-life example of where prepending struc name to the double-dotted symbol is actually useful?
Post 13 Jul 2010, 10:38
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 19277
Location: In your JS exploiting you and your system
revolution 13 Jul 2010, 10:55
Tomasz Grysztar wrote:
It is not a bug, it follows exactly the documented behavior - as you can read in section 2.3.4 of the manual, "[struc's] label will be (...) attached at the beginning of every name starting with dot in the contents of macroinstruction".
Yeah I read that before I posted. But I read is wrongly thinking that "name starting with dot" meant "name starting with one dot". Embarassed

I shall downgrade to [request] level.
Post 13 Jul 2010, 10:55
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-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.