flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Tomasz Grysztar 06 Jan 2006, 08:54
Read the answer to fourth question in the FAQ and the section 2.3.7 of the manual (I feel like deja vu).
As for your particular problem, this macro will include each file only once, but only if the path given for such file is exactly the same each time (it's case sensitive): Code: macro includeonce path { file@include equ path match head path tail,files@included \{ file@include equ \} match head path,files@included \{ file@include equ \} match file, file@include \{ include file \} files@included equ files@included path } PS. Do not overuse FIX directive - it is no longer to widely used, the section 2.3.7 might explain to you, why. |
|||
![]() |
|
halyavin 06 Jan 2006, 09:53
Thanks for this macro idea. It can be improved (if necessary) a little:
Code: macro includeonce [path] { reverse file@include equ path forward match head path tail,files@included \{ file@include equ \} match head path,files@included \{ file@include equ \} match path tail, files@included \{ file@include equ \} match path,files@included \{ file@include equ \} common match file, file@include \{ include file \} forward files@included equ files@included path } for using as includeone "real path","mirror1","mirror2" PS When fix disappear from fasm syntax I manually execute "fix fix equ" command for my source files ![]() |
|||
![]() |
|
revolution 20 Jun 2024, 23:45
Matching by file name is fraught with many problems. Having different roots to the same file can't be identified by string matching. For a simple example the following can all be the same file.
Code: include 'myfile.inc' include './myfile.inc' include '../mydir/myfile.inc' Code: #ifndef _C_SOURCE_H #define _C_SOURCE_H 1 // C code goes here #endif /* c_source.h */ Code: irpv any, unique_identifier { rept 0 {} rept 1 { unique_identifier equ ; assembly code goes here } Using this allows each file to handle its own multiple inclusion guard. The downside being that if the code contains any closing braces then they must be escaped. Both x86 and ARM have syntax that uses braces, and fasm native macros use them also. Code: irpv any, unique_identifier { rept 0 {} rept 1 { unique_identifier equ macro foo \{ vprolvd xmm1{k1\\}{z\\},xmm2,xmm3 ; escape the closing braces \} foo } |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.