[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gforth] #line directive?
From: |
Josh Grams |
Subject: |
[gforth] #line directive? |
Date: |
Sun, 24 Jul 2011 21:10:33 -0400 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
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
- [gforth] #line directive?,
Josh Grams <=