Created
April 13, 2025 17:10
-
-
Save bitRAKE/b4a8b60e63cf09c372fc3a9c94328f31 to your computer and use it in GitHub Desktop.
#pragma once, for fasmg / fasm2:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; We can make a global "#pragma once" mechanism if we assume all files have | |
; a unique path. Non-cannonical path are fine as long as it's always the same | |
; form. Be mindful of file organization if you're going to use this. | |
; Primary benefits: | |
; + files are not loaded multiple times | |
; + no change to file needed (i.e. if/endif wrapper) | |
;macro onetime?: line& | |
; local name | |
; match any rest,line | |
; name equ any | |
; else match any,line | |
; name equ any | |
; else | |
; err | |
; end match | |
; | |
; repeat 1,N:name | |
; if ~ definite ONCE.N | |
; ONCE.N := 1 | |
; include line | |
; end if | |
; end repeat | |
;end macro | |
calminstruction onetime?: line*& | |
match name any?,line | |
jyes go | |
err 'filename expected' | |
done: exit | |
local val,var | |
go: compute val,+name ; convert string to number | |
arrange var,=ONETIME.val ; unique variable | |
check definite var | |
jyes done | |
compute val,0 | |
publish var:,val ; constant | |
arrange line,=include line | |
assemble line | |
end calminstruction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We can replace the
include
keyword with this feature:... based on the fix.inc macros.