summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* defstruct: order function slots before other static slots.Kaz Kylheku2016-01-032-15/+48
| | | | | | | | | | | | | | | | | This allows the initializer expressions for static slots to instantiate objects, and those instances can rely on methods being set up. * share/txr/stdlib/struct.tl (sys:prune-nil-inits): Recognize :function keyword as denoting a static slot. (defstruct): Represent methods and functions as (:function ...) items rather than (:static ...) so they can be distinguished. Function slots appear before other static slots in the static slot list, and their initializing code is placed into the the static-initfun lambda of the sys:make-struct-type call in this order. * txr.1: Documented.
* Better bad slot syntax diagnostic in defstruct.Kaz Kylheku2016-01-031-1/+4
| | | | | | * share/txr/stdlib/struct.tl (defstruct): Issue different error message for a slot specifier which isn't a symbol, and wasn't recognized as a special syntax.
* Bad formatting under destruct.Kaz Kylheku2016-01-021-1/+1
| | | | * txr.1: Missing .desc macro call.
* Bad formatting under RangesKaz Kylheku2016-01-021-0/+3
| | | | * txr.1: Add missing .desc macro invocations.
* Wording change in error_trace.Kaz Kylheku2016-01-021-2/+2
| | | | | * eval.c (error_trace): Change "possibly triggered by" to "during evaluation of".
* Use last-form-evaled mechanism for pattern language.Kaz Kylheku2016-01-023-6/+20
| | | | | | | | | | | | | | We need this now, since file system errors aren't handled in the pattern language any more, after the complex_open refactoring. * eval.c (set_last_form_evaled): New function. * eval.h (set_last_form_evaled): Declared. * match.c (do_match_line, match_files): Save, set up and restore last_form_evaled via set_last_form_evaled function.
* Bugfix: premature open of data source.Kaz Kylheku2016-01-011-1/+1
| | | | | | | | | match.c (open_data_source): complex_open was being called before the check against opening the data source because the query starting with a non-matching directive. This is moved down into a more nested scope. This bug was found thanks to complex_open now throwing exceptions.
* Handle nothrow semantics down in complex_open.Kaz Kylheku2016-01-011-37/+12
| | | | | | | | | * match.c (file_err): Static function removed. (complex_open): New argument, nothrow. Catch exceptions derived from error only if nothrow is true. (v_output, open_data_source): Pass nothrow flag down to complex_open. Eliminate unnecessary error checking.
* Hacky struct fpip gone; complex_open returns stream.Kaz Kylheku2016-01-011-74/+26
| | | | | | | | | | | | | | | * match.c (enum fpip_close): Removed. (struct fpip, fpip_t): Removed. (complex_open): Use high level Lisp library function to return appropriate stream type, and return it directly. Exceptions are turned to a nil return to emulate old behavior. (complex_open_failed, complex_snarf, complex_stream): Static functions removed. (v_output, open_data_source): Use new interface of complex_open. complex_open_failed is just a nile check. complex_stream is a noop, and complex_snarf is just lazy_stream_cons.
* Record-delimiting stream adapter.Kaz Kylheku2016-01-015-0/+313
| | | | | | | | | | | | | | | | | | | | | | | | | | * regex.c (read_until_match): New function. (regex_init): Registered read-until-match intrinsic. * regex.h (read_until_match): Declared. * stream.c (struct delegate_base): New struct type. (delegate_base_mark, delegate_put_string, delegate_put_char, delegate_put_byte, delegate_get_char, delegate_get_byte, delegate_unget_char, delegate_unget_byte, delegate_close, delegate_flush, delegate_seek, delegate_truncate, delegate_get_prop, delegate_set_prop, delegate_get_error, delegate_get_error_str, delegate_clear_error, make_delegate_stream): New static functions. (struct record_adapter_base): New struct type. (record_adapter_base_mark, record_adapter_mark_op, record_adapter_get_line): New static functions. (record_adapter_ops): New static structure. (record_adapter): New function. (stream_init): Registered record-adapter intrinsic. * stream.h (record_adapter): Declared. * txr.1: Documented read-until-match and record-adapter.
* Copyright year bump.Kaz Kylheku2015-12-3171-72/+72
| | | | | | | | | | | | | | | | | | | | | | | * LICENSE, METALICENSE, Makefile, args.c, args.h, arith.c, arith.h, cadr.c, cadr.h, combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h, filter.c, filter.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, jmp.S, lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, rand.c, rand.h, regex.c, regex.h, share/txr/stdlib/cadr.tl, share/txr/stdlib/except.tl, share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl, share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl, share/txr/stdlib/struct.tl, share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl, share/txr/stdlib/with-resources.tl, share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl, signal.c, signal.h, stream.c, stream.h, struct.c, struct.h, sysif.c, sysif.h, syslog.c, syslog.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h: Add 2016 copyright. * linenoise/LICENSE, linenoise/linenoise.c, linenoise/linenoise.h: Bump one principal author's copyright from 2014 to 2015. The code is based on a snapshot of 2015 upstream work.
* linenoise: submit and stay in history.Kaz Kylheku2015-12-312-0/+33
| | | | | | | | | | * linenoise/linenoise.c (struct lino_state): New member save_hist_idx. (edit): If save_hist_idx is set, jump to that history position and clear it. Handle ENTER in extended (Ctrl-X) mode similarly to regular ENTER, but setting save_hist_idx. * txr.1: Documented.
* linenoise: bugfix: Ctrl-X bails out of hist searchKaz Kylheku2015-12-311-1/+1
| | | | | | | * linenoise/linenoise.c (history_search): Add CTL('X') to set of characters which terminate search and are processed again in the main editing function, so that Ctrl-X commands work in search.
* C++ breakage: multiple definition of name_s.Kaz Kylheku2015-12-304-6/+5
| | | | | | | | | | | | | * lib.c (name_s): Defined here now. (obj_init): name_s initialized here. * lib.h (name_s): Declared. * match.c (name_s): Definition removed. (syms_init): Initialization of name_s removed. * sysif.c (name_s): Definition removed. (sysif_init): Initialization of name_s removed.
* Fix regression in tab completion.Kaz Kylheku2015-12-303-2/+3
| | | | | | | | | | | Same issue as with Vim syntax highlighting. * eval.c (mboundp): Externalize static function. * eval.h (mboundp): Declared. * parser.c (find_matching_syms): Expand fboundp check to encompass mboundp and special_operator_p.
* Version 129.txr-129Kaz Kylheku2015-12-296-361/+482
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* last_form_evaled must track argument evaluation.Kaz Kylheku2015-12-291-4/+3
| | | | | | | * eval.c (do_eval): Set last_form_evaled to form before evaluating the arguments, so that any errors which are not attributed to their own sub forms (such as unbound symbols) are attributed to this form.
* Propagate macro ancestry info across macrolet.Kaz Kylheku2015-12-291-1/+4
| | | | | | | | | * eval.c (expand_macrolet): Install a macro ancestor for the expansion of the macrolet. If the original form has a macro ancestor, then use that grandparent ancestor. Otherwise use the original form itself. This way intermediate macrolets which are generated by macros are abbreviated out of ancestry traces.
* Detect loop in error_trace.Kaz Kylheku2015-12-291-0/+3
| | | | | | * eval.c (error_trace): If a form has itself as its macro ancestor, bail the loop. (This only happens in deliberately contrived pathological cases, useful for testing).
* Suppress "which is located at nil".Kaz Kylheku2015-12-291-3/+9
| | | | | * eval.c (error_trace): If info is nil, print alternative message about the location being unavailable.
* Don't suppress detailed error trace for eval-error.Kaz Kylheku2015-12-291-2/+2
| | | | | | | | * eval.c (error_trace): The original idea behind the eval_error_s check is that eval errors already carry line number info, so we don't want to print redundant information. However, the scope of the detailed information has greatly increased, so we need to do this check in the loop.
* Don't record nil as the macro ancestor of a form.Kaz Kylheku2015-12-291-1/+2
| | | | | * eval.c (set_origin): Don't store nil value in the origin_hash.
* New variables for floating-point printing control.Kaz Kylheku2015-12-284-19/+92
| | | | | | | | | | | | | | | | | * lib.c (obj_print_impl): Instead of hard-coded "~s", obtain the format string for floats from the *print-flo-format* special variable, whose default value is "~s". * stream.c (print_flo_digits_s, print_flo_format_s): New symbol variables. (formatv): Use *print-flo-digits* value for default precision for ~f and ~e, rather than hard-coded 3. (stream_init): Initialize print_flo_digits_s and print_flo_format_s, and register special variables under those symbols. * stream.h (print_flo_digits_s, print_flo_format_s): Declared. * txr.1: Documented new specials.
* Whitespace in lazy_str_force.Kaz Kylheku2015-12-281-1/+1
| | | | * lib.c (lazy_str_force): Remove trailing whitespace.
* Overhaul printing of lazy strings.Kaz Kylheku2015-12-283-56/+123
| | | | | | | | | | | | | | | | | | The #<lazy-string ...> print syntax is gone. Lazy strings are now printed by traversing their structure, without forcing them to the flat representation. * lib.c (lazy_str_put): New function. (out_str_char, out_str_pretty, out_lazy_str): New static functions. (obj_print_impl): Use out_str_pretty for standard-printing regular strings. Use lazy_put_str for pretty-printing lazy strings, and out_lazy_str for standard-printing them. * lib.h (lazy_str_put): Declared. * stream.c (put_string): Check for a lazy string and route to lazy_str_put, so the string doesn't get forced (though of course the underlying list does, if it is lazy).
* Fix exception in @(freeform) over interactive input.Kaz Kylheku2015-12-271-1/+6
| | | | | | | | | | | This is caused by the ("str0" "str1" .. "strn" nil) representation put out by the interactive style lazy list. The lazy string force function doesn't like the nil. Quick and dirty fix applied here. * lib.c (lazy_str_force, lazy_str_force_upto): If a nil comes out of lstr->ls.list, break out of the loop as if the list ended.
* Adding with-slots macro.Kaz Kylheku2015-12-273-0/+98
| | | | | | | | | * lisplib.c (place_set_entries): Add with-slots to autoload name list. * share/txr/stdlib/struct.tl (with-slots): New macro. * txr.1: Documented.
* Use subtype check for eval error.Kaz Kylheku2015-12-271-1/+1
| | | | | * eval.c (error_trace): Don't check exsym for exact equality to eval-error, but whether it is a subtype.
* Shocking four-year-old bug in collect/coll.Kaz Kylheku2015-12-271-2/+7
| | | | | | | | | | | | | | | | | This originates to a commit on 2011-10-21. In that commit, I attempted to make until/last clauses have visibility to the bindings in the collect body (even though those are discarded). The problem is that the until/last clause is tried whether or not the body succeeds. When the body fails, no bindings emanate from it. In that case, the until/last clause is wrongly evaluated in an environment with no bindings whatsoever, meaning that even bindings that existed before the collect are not available to it. * match.c (h_coll, v_collect): Evaluate the last/until clause using the collect body bindings only if those bindings are not nil, otherwise use the original bindings from before entry into the collect.
* Allow @(repeat) and @(rep) to see Lisp globals.Kaz Kylheku2015-12-261-0/+11
| | | | | | | * match.c (extract_bindings): Process the final list of vars. For any variable not already on the list of output bindings, check if it has a Lisp binding, and if so, add *that* binding to the output bindings.
* TXR quasiliterals and output vars treated as Lisp.Kaz Kylheku2015-12-266-174/+209
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (format_field): Function moved here from match.c, along with the introduction of a new behavior: if a meta-expr occurs among the modifiers, its constituent expression is evaluated in its place. This allows for @{a @[expr]} which was previously not allowed in Lisp quasiliterals, but worked in TXR quasiliterals due to the treatment of @ by txeval. (subst_vars): Static function turns external, so code in match.c can call it instead of the subst_vars in that module. For that purpose, it needs to take a filter argument and process filters, like the match.c subst_vars. (op_quasi_lit): Pass nil as filter argument to subst_vars. * eval.h (format_field, subst_vars): Declared. * match.c (format_field): Function removed, moved to eval.c and slightly changed. (subst_vars): Renamed to tx_subst_vars. By default, now just a wrapper for subst_vars. In compatibility mode, invokes the old logic. (do_txeval, do_output_line): Call tx_subst_vars rather than subst_vars. * match.h (format_field): Declaration removed. * parser.y (expr): Grammar production removed: no longer referenced. (o_var): Braced variable case now parsed as n_expr, and expanded as expr by default, since this is Lisp now. In compatibility mode, expanded using expand_meta. Also SYMTOK case must be subject to expansion; an output var can now be a symbol macro. (expand_meta): Expand a quasi-literal as Lisp, except in compatibility mode. * txr.1: Bit of a documentation update. Existing doc isn't totally clear.
* chr-isdigit and chr-isxdigit return value.Kaz Kylheku2015-12-232-15/+35
| | | | | | | | * lib.c (chr_isdigit, chr_isxdigit): Return the integer value rather than the symbol t, which can be exploited to write more compact scanning code. * txr.1: Documented.
* Base value in :counterKaz Kylheku2015-12-232-6/+33
| | | | | | | * match.c (do_output_line, do_output): Decode (var expr) syntax as argument of :counter and implement displacement. * txr.1: Documented.
* Section reference correction.Kaz Kylheku2015-12-231-1/+3
| | | | * txr.1: There is no Collect Keywords section.
* New directives @(data) and @(name)Kaz Kylheku2015-12-222-1/+154
| | | | | | | | | | | * match.c (data_s, name_s): New symbol variables. (v_data, v_name): New static functions. (syms_init): Initialize data_s and name_s. (dir_tables_init): Register v_data and v_name as vertical directives, and enable them in horozintal context too using hv_trampoline. * txr.1: Documented.
* Allow @(line) in horizontal context.Kaz Kylheku2015-12-221-0/+1
| | | | | * match.c (dir_tables_init): Register hv_trampoline handler for line_s.
* Don't use ~d in several match debug diagnostics.Kaz Kylheku2015-12-221-2/+2
| | | | | * match.c (h_chr, v_line): Don't try to print clashing binding or object using ~d, because it might not be an integer.
* Syntax highlighting regression and omission.Kaz Kylheku2015-12-221-13/+14
| | | | | | | * genvim.txr: Use new mboundp to check for macros, and special-operator-p to detect operators. fboundp doesn't report them any more. Also, :postinit must be included among lispwords.
* Version 128.txr-128Kaz Kylheku2015-12-196-507/+488
| | | | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. Bumped copyright year in configure. (Could be last chance this year). * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Print some instances of qref as dot notation.Kaz Kylheku2015-12-181-0/+24
| | | | | | | | | We must preserve ambiguity-free read-print consistency. * lib.c (simple_qref_args_p): New static function. (obj_print_impl): Check for qref and print as dot notation if its argument list satisfies simple_qref_args_p.
* Keep summary of place forms up-to-date.Kaz Kylheku2015-12-181-3/+15
| | | | | * txr.1: Add the cadr functions, rest, first through tenth, nthcdr and symbol-value.
* New condlet macro; small change to iflet/whenlet.Kaz Kylheku2015-12-184-18/+137
| | | | | | | | | | | | | | | | | | | | | | | * eval.c (me_iflet_whenlet): Allow the test form to be an atomic expression instead of bindings. This allows iflet to be used as the sole target construct of condlet, while allowing condlet to have a fallback clause with t. It also means that an empty list of bindings is allowed (since it is the atom nil). * lisplib.c (ifa_set_entries): Add "condlet" to the autoload names for the ifa module. That's where we are adding condlet. * share/txr/stdlib/ifa.tl (sys:if-to-cond): New macro expander helper function, generalizing the writing cond-like macros based on if-like operators. (conda): Rewritten using sys:if-to-cond. (condlet): New macro. * txr.1: Documented change in iflet/whenlet. Documented condlet.
* Revise Conventions slightly.Kaz Kylheku2015-12-181-5/+7
| | | | | * txr.1: Redundant item removed from Conventions. Indicate that braces may be removed where it is clear.
* debugger: stopped at line nil of nil.Kaz Kylheku2015-12-181-4/+5
| | | | | | | | | | | | | Address some situations in which the debug_check call is given a piece of spec with no source loc information attached. * (h_var): Use rlcp when constructing new piece of spec representing a substituted variable, or a spec confined to just search for a piece of text with no trailing match. (do_match_line): Pass the whole specline to debug_check, rather than just the elem, which might just be a string with no location info attached. (match_files): Likewise.
* New --debug-expansion option.Kaz Kylheku2015-12-184-1/+29
| | | | | | | | | | | | | * txr.c (opt_dbg_expansion): New global variable. (help): Print summary for --debug-expansion. (txr_main): Recognize new option and set flag. * parser.y (parse_once): Suppress debug stepping around parser if opt_dbg_expansion is false. * txr.1 (opt_dbg_expansion): Declared. * txr.1: Documented new option.
* Fix useless use of if3.Kaz Kylheku2015-12-181-2/+2
| | | | * lisplib.c (lisplib_try_load): if3(a, b, nil) -> if2(a, b).
* Ensure debugger options are declared in txr.h.Kaz Kylheku2015-12-182-1/+2
| | | | | | * lisplib.h (opt_dbg_autoload): Declaration removed. * txr.1 (opt_debugger, opt_dbg_autoload): Declared.
* Comments clean up near top of configure script.Kaz Kylheku2015-12-171-3/+10
| | | | | | * configure: comment about saving command line needs to be below the re-execution trick. Comment added for re-execution trick.
* Set macro ancestry info in place expansions.Kaz Kylheku2015-12-172-4/+21
| | | | | | | | | | | | | | | * eval.c (set_origin): New static function. (eval_init): Register set_origin as sys:set-macro-ancestor. * share/txr/stdlib/place.tl (sys:pl-expand): Set macro ancestry when expanding a place macro. (sys:cp-origin): New function. (call-update-expander, call-clobber-expander, call-delete-expander): Use sys:cp-origin to walk through expanded code and attach the place form as the macro ancestor of all the getter, setter or deleter calls, effectively to say that those calls are expansions of the place, which is approximately the case.
* Bugfix: dot syntax doesn't record source loc info.Kaz Kylheku2015-12-171-2/+4
| | | | | * parser.y (n_expr): Fall back on getting line number info from parser->lineno, if it didn't come from the operands.