Ohai,
__file__ currently holds the name of the file, that is compiled. It would be nice, if this is the list of files from the main-file to the file, which actually used __file__, e.g.
main:
include 'file1'
include 'file3'
foo
file1:
include 'file2'
macro foo
bar
end macro
file2:
macro bar
fail 'just fail'
end macro
file3:
macro fail message&
irpv item, __file__
display '->', __file__ ;the last value of __file__ would be 'file3', but thats ok
restore __file__
end irpv
display '->', message, 10
end macro
IMHO custom errors are nice, but it is sometimes a bit hard to find the actual cause, when I use a lot of macros. sometimes, I do not even know where I defined the macro.
A Plus would be, if I can just restore __line__ to get the line number in this file:
macro fail message&
irpv item, __file__
display '->', __file__, ':'
displayDecimal __line__ ;displays the line number as decimal value
restore __line__
restore __file__
end irpv
display '->', message, 10
;in this case:
;->main:3->file1:3->file2:2->file3:2->just fail
end macro