diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-04-11 10:58:40 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-04-11 10:58:40 -0700 |
commit | b43d605b8986b8ef2edd11abf7ed5b7e4313d318 (patch) | |
tree | 9ce7f29dc950cae340edd7477aff9a6f8e692729 /eval.c | |
parent | be004953796f8286ce614d40670b3b14d61d80ef (diff) | |
download | txr-b43d605b8986b8ef2edd11abf7ed5b7e4313d318.tar.gz txr-b43d605b8986b8ef2edd11abf7ed5b7e4313d318.tar.bz2 txr-b43d605b8986b8ef2edd11abf7ed5b7e4313d318.zip |
Provide access to line number info and source path.
* eval.c (eval_init): New intrinsic functions source-loc
and source-loc-str. New variable *self-path*.
* txr.1: Stub doc sections.
* txr.c (self_path): New variable.
* txr.h (self_path): Declared.
* txr.vim: Syntax highlighting for source-loc, source-loc-str
and *self-path*.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -44,6 +44,7 @@ #include "match.h" #include "rand.h" #include "filter.h" +#include "txr.h" #include "eval.h" typedef val (*opfun_t)(val, val); @@ -2411,6 +2412,11 @@ void eval_init(void) reg_fun(intern(lit("time"), user_package), func_n0(time_sec)); reg_fun(intern(lit("time-usec"), user_package), func_n0(time_sec_usec)); + reg_fun(intern(lit("source-loc"), user_package), func_n1(source_loc)); + reg_fun(intern(lit("source-loc-str"), user_package), func_n1(source_loc_str)); + + reg_var(intern(lit("*self-path*"), user_package), &self_path); + eval_error_s = intern(lit("eval-error"), user_package); uw_register_subtype(eval_error_s, error_s); } |