flat assembler
Message board for the users of flat assembler.
Index
> Main > [fasmg] Catching nested includes |
Author |
|
Tomasz Grysztar 21 Jan 2022, 08:46
To catch the nested ones, you need a recursive macro:
Code: macro include: path display "INCLUDE: ",`path,13,10 INCLUDE path end macro In the above snippet I used case-sensitivity to distinguish the macro from the original directive (you need an access to both of them in order to break recursion). You could also achieve that with a distinct namespace context, but this requires a little more work, for example: Code: define __include__ include ; symbolic link remembers context namespace enclosing postpone end namespace end postpone match INCLUDE, __include__ macro include?: path ; now we can make it case-insensitive display "INCLUDE: ",`path,13,10 INCLUDE path end macro end match |
|||
21 Jan 2022, 08:46 |
|
Calanor 21 Jan 2022, 09:41
Thanks for the - as always - quick reply! I'll try out your suggestions - however, wouldn't mvmacro work instead of using case-sensitivity?
|
|||
21 Jan 2022, 09:41 |
|
Tomasz Grysztar 21 Jan 2022, 10:24
Calanor wrote: Thanks for the - as always - quick reply! I'll try out your suggestions - however, wouldn't mvmacro work instead of using case-sensitivity? |
|||
21 Jan 2022, 10:24 |
|
Calanor 21 Jan 2022, 12:05
Aha, got it! Thanks, Tomasz!
|
|||
21 Jan 2022, 12:05 |
|
fabbel 31 Mar 2023, 08:46
hi Tomasz
trying to check actual full path of included files in some project am working on... ... below seems to be working, but just would like some expert second look, to make sure no side-effect / loophole I might have overlooked... Code: macro dispfile path*, cmd display "INCLUDING: ",path, " (",__FILE__, ")",13,10 cmd end macro macro include:path*,cmd INCLUDE path, dispfile path, cmd end macro include 'struct.inc' (....) ... can u pls comment ? ... also how to properly make overriding include macro case-insensitive to be fully generic (while obv. preserving access to native include directive... ) ... unsure about the postpone version u suggested... ... finally some side comment / question : full reported path from __FILE__ is always including '/' i/o '\' for last level in directory hierarchy... (working on windows..) ... .. might be a prob if need to parse the path string... |
|||
31 Mar 2023, 08:46 |
|
Tomasz Grysztar 31 Mar 2023, 09:13
fabbel wrote: ... can u pls comment ? fabbel wrote: ... also how to properly make overriding include macro case-insensitive to be fully generic (while obv. preserving access to native include directive... ) If this doesn't work for you for any reason, you can also forgo defining it as a recursive macro, and just re-define the override for every included file: Code: macro include_override nextline& macro include? path*, cmd& include path, include_override dispfile path, cmd purge include? end macro nextline end macro include_override fabbel wrote: full reported path from __FILE__ is always including '/' i/o '\' for last level in directory hierarchy... (working on windows..) ... |
|||
31 Mar 2023, 09:13 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.