flat assembler
Message board for the users of flat assembler.

Index > Main > Use preprocess string variable in include

Author
Thread Post new topic Reply to topic
hellomachine



Joined: 18 May 2023
Posts: 22
Location: I don't even exist
hellomachine 19 May 2023, 07:03
Hello, I need to use a preprocess variable (string) in an include path, for example:

Code:
BASE_DIR equ '../../../../'

macro include_src path {
 include BASE_DIR#'/src/'#path
}
    


But there is a problem with this implementation, how can I use a string variable in include path ?[/b]
Post 19 May 2023, 07:03
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 952
Location: Russia
macomics 19 May 2023, 07:38
Code:
BASE_DIR equ '../../../../'

macro path, include_src { match base, BASE_DIR \{
 include base\#'/src/'\#path
\} }    
Code:
BASE_DIR fix '../../../../'

macro path, include_src {
 include BASE_DIR#'/src/'#path
}    
Post 19 May 2023, 07:38
View user's profile Send private message Reply with quote
hellomachine



Joined: 18 May 2023
Posts: 22
Location: I don't even exist
hellomachine 19 May 2023, 07:55
macomics wrote:
Code:
BASE_DIR equ '../../../../'

macro path, include_src { match base, BASE_DIR \{
 include base\#'/src/'\#path
\} }    
Code:
BASE_DIR fix '../../../../'

macro path, include_src {
 include BASE_DIR#'/src/'#path
}    


The second solution chosen and it worked. Thanks a lot.
Post 19 May 2023, 07:55
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.