I have been doing a bit of literate programming, and so of course then I
want gforth to report errors relative to the original source and not the
generated files.  After a bit of poking around in the source, I came up
with the following (which is easily wrapped in a parsing version that
handles the C #line syntax):

        : >sourcefile ( u.line# c-addr u -- )
                2dup included? 0= if 2dup add-included-file then
                loadfilename 2!  1- loadline ! ;

The first line is there because the functions in source.fs work with an
index into included-files rather than the actual filename string.  Are
there other gotchas that I need to watch out for?

--Josh

Reply via email to