diff options
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | debug.c | 4 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | match.c | 7 | ||||
-rw-r--r-- | parser.h | 1 | ||||
-rw-r--r-- | parser.l | 2 | ||||
-rw-r--r-- | parser.y | 2 | ||||
-rw-r--r-- | txr.1 | 18 |
8 files changed, 43 insertions, 9 deletions
@@ -1,5 +1,21 @@ 2012-02-24 Kaz Kylheku <kaz@kylheku.com> + * debug.c (debug): Use new way of getting line number. + + * eval.c (eval_error): Use source_loc_str to get source location. + + * match.c (debuglf, sem_err, file_err): Likewise. + + * parser.h (source_loc_str): Declared. + + * parser.l (parse_init): form_to_ln_hash must be equal based now. + + * parser.y (rl): Store new form of read-time source location info. + + * txr.1: Documented load. + +2012-02-24 Kaz Kylheku <kaz@kylheku.com> + * match.c (v_load): Sanity checking on target path. Check if it is absolute and do not substitute parent file's directory. @@ -60,7 +60,7 @@ static void show_bindings(val env, val stream) val debug(val form, val bindings, val data, val line, val pos, val base) { uses_or2; - val lineno = source_loc(form); + val lineno = car(source_loc(form)); if (!step_mode && !memqual(lineno, breakpoints) && (debug_depth > next_depth)) @@ -74,7 +74,7 @@ val debug(val form, val bindings, val data, val line, val pos, val base) val input, command; if (print_form) { - format(std_output, lit("stopped at line ~a\n"), lineno, nao); + format(std_output, lit("stopped at ~a\n"), source_loc_str(form), nao); format(std_output, lit("form: ~s\n"), form, nao); format(std_output, lit("depth: ~s\n"), num(debug_depth), nao); print_form = nil; @@ -103,7 +103,7 @@ noreturn static val eval_error(val form, val fmt, ...) va_start (vl, fmt); if (form) - format(stream, lit("(~a:~a) "), spec_file_str, source_loc(form), nao); + format(stream, lit("(~a) "), source_loc_str(form), nao); (void) vformat(stream, fmt, vl); va_end (vl); @@ -70,8 +70,7 @@ static void debuglf(val form, val fmt, ...) if (opt_loglevel >= 2) { va_list vl; va_start (vl, fmt); - format(std_error, lit("~a: (~a:~a) "), prog_string, - spec_file_str, source_loc(form), nao); + format(std_error, lit("~a: (~a) "), prog_string, source_loc_str(form), nao); vformat(std_error, fmt, vl); put_char(chr('\n'), std_error); va_end (vl); @@ -85,7 +84,7 @@ static void sem_error(val form, val fmt, ...) va_start (vl, fmt); if (form) - format(stream, lit("(~a:~a) "), spec_file_str, source_loc(form), nao); + format(stream, lit("(~a) "), source_loc(form), nao); (void) vformat(stream, fmt, vl); va_end (vl); @@ -100,7 +99,7 @@ static void file_err(val form, val fmt, ...) va_start (vl, fmt); if (form) - format(stream, lit("(~a:~a) "), spec_file_str, source_loc(form), nao); + format(stream, lit("(~a) "), source_loc(form), nao); (void) vformat(stream, fmt, vl); va_end (vl); @@ -41,6 +41,7 @@ int yylex(void); void parse_init(void); void parse_reset(val spec_file); val source_loc(val form); +val source_loc_str(val form); val rl(val form, val lineno); INLINE val rlcp(val to, val from) { @@ -692,7 +692,7 @@ void parse_init(void) protect(&yyin_stream, &prepared_error_message, &form_to_ln_hash, (val *) 0); - form_to_ln_hash = make_hash(t, nil, nil); + form_to_ln_hash = make_hash(t, nil, t); } void parse_reset(val spec_file) @@ -995,7 +995,7 @@ static val choose_quote(val quoted_form) val rl(val form, val lineno) { - sethash(form_to_ln_hash, form, lineno); + sethash(form_to_ln_hash, form, cons(lineno, spec_file_str)); return form; } @@ -1272,6 +1272,9 @@ as a filter. See Function Filters below. The filter directive passes one or more variables through a given filter or chain or filters, updating them with the filtered values. +.IP @(load) +The load directive loads another TXR file and interprets its contents. + .PP .SS The Next Directive @@ -3822,6 +3825,21 @@ Example: convert a, b, and c to upper case and HTML encode: @(filter (:upcase :to_html) a b c) +.SS The Load Directive + +The syntx of the load directive is: + + @(load EXPR) + +Where EXPR evaluates to a string giving the path of the file to load. +Unless the path is absolute, it is interpreted relative to the directory of the +source file from which the @(load) form was read. If there was no such +source file (for instance, the script was read from standard input), +then it is resolved relative to the current working directory. + +Loading is performed at evaluation time; it is not a source file inclusion +mechanism. A TXR script is read from beginning to end and parsed prior to +being evaluated. .SH EXCEPTIONS |