flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [fasmg] [feature-request] __file__ as a list

Author
Thread Post new topic Reply to topic
_shura



Joined: 22 May 2015
Posts: 61
_shura 21 Aug 2017, 01:27
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:
Code:
include 'file1'
include 'file3'
foo
    

file1:
Code:
include 'file2'
macro foo
  bar
end macro
    

file2:
Code:
macro bar
  fail 'just fail'
end macro
    

file3:
Code:
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:
Code:
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
    
Post 21 Aug 2017, 01:27
View user's profile Send private message Visit poster's website 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.