flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Pb matching trailing part of symbol starting with a dot '.'

Author
Thread Post new topic Reply to topic
fabbel



Joined: 30 Oct 2012
Posts: 96
fabbel 05 Jan 2018, 17:14
Hello

Pls help little noobie struggling with fasm (not fasmg) macros...

Am having hard time trying to build macro to parse symbol starting with dot ('.') :
basically i wud like to pass param such as : .somelabel (note the leading dot .),
to some macro and strip out the leading dot internally to keep only the trailing part,
i.e. only 'somelabel'.
Can't find a way around this.

typ., e.g.:

----
macro dummy param {
match =.arg, param \{
arg equ foo
\}
}

dummy .somelabel
----

=> compiles but does not work : symbolic constant doesn't get defined

Desperate to find a way around this...
(i have tried a number of other alternatives .. with no more luck)


Would any of you experts out there pls kindly help me with this... ?
Tx


for ref. same thing using leading colon ':' i/o dot '.' works perfectly :
----
macro dummy param {
match =:arg, param \{
arg equ foo
\}
}

dummy :somelabel
----
=> this correctly define symbolic constant 'somelabel' with value = foo

Tx
Regards
Post 05 Jan 2018, 17:14
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20632
Location: In your JS exploiting you and your system
revolution 05 Jan 2018, 22:58
The problem you have is that the dots are not special. They are simply part of the name. So just pretend that they are a normal letter in a label.
Code:
macro dummy param {
  match arg, param \{
    arg equ foo
  \}
}     
Post 05 Jan 2018, 22:58
View user's profile Send private message Visit poster's website Reply with quote
fabbel



Joined: 30 Oct 2012
Posts: 96
fabbel 06 Jan 2018, 15:43
Tx but that doesnt answer my question : i am looking to get only the part following the dot. Is there no way around this?
Post 06 Jan 2018, 15:43
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8400
Location: Kraków, Poland
Tomasz Grysztar 06 Jan 2018, 16:43
Because "." is not treated as a special character by fasm 1 and the preprocessor does not have an ability to split or alter the name tokens, it is not possible. It is one of the limitations that led to the design of the successor engine (fasmg).
Post 06 Jan 2018, 16:43
View user's profile Send private message Visit poster's website Reply with quote
a



Joined: 10 Apr 2025
Posts: 17
Location: Ukraine
a 10 Apr 2025, 10:27
Tomasz, although preprocessor does not have an ability to split or alter the name tokens, it is still possible to detect if the name starts with a dot:

Code:
macro check_if_name_starts_with_a_dot a
   {
   local b
   b:
   if b#a eq a
      the_first_character_is_a_dot
   else
      the_first_character_is_not_a_dot
   end if
   }
    


some people might find this to be helpful
Post 10 Apr 2025, 10:27
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1939
Roman 10 Apr 2025, 10:34
And how using this macro ?
I try this:
Code:
macro namedot a
   {
   local b
   b:
   if b#a eq a
      display '1_character_is_a_dot'
   else
      display '2_character_is_not_a_dot'
   end if
   } 
Start:  
        namedot Start.aa ;get 2_character_is_not_a_dot
        namedot .aa      ;get 1_character_is_a_dot
        namedot aa       ;get 2_character_is_not_a_dot
.aa:   
    
Post 10 Apr 2025, 10:34
View user's profile Send private message Reply with quote
a



Joined: 10 Apr 2025
Posts: 17
Location: Ukraine
a 10 Apr 2025, 10:40
Roman,

Code:
check_if_name_starts_with_a_dot .wwwwwwwwwwwwwwwwwwwwwwwww    
it will show the correct error: the_first_character_is_a_dot


Code:
check_if_name_starts_with_a_dot wwwwwwwwwwwwwwwwwwwwwwwww    
it will show the correct error: the_first_character_is_not_a_dot


so you are supposed to replace the "the_first_character_is_a_dot" and "the_first_character_is_not_a_dot" with your custom code like you did.
also: it can only detect if it STARTS with a dot not if it HAS a dot
Post 10 Apr 2025, 10:40
View user's profile Send private message 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.