summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Version 132.txr-132Kaz Kylheku2016-01-156-549/+573
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Retroactively fix recent inconsistent formatting.Kaz Kylheku2016-01-151-10/+10
|
* New :mandatory keyword in until/last clauses.Kaz Kylheku2016-01-154-24/+132
| | | | | | | | | | | | | | | | | | | * match.c (mandatory_k): New keyword variable. (h_coll, v_gather, v_collect): Implement :mandatory logic. (syms_init): Initialize mandatory_k. * parser.l (grammar): The UNTIL and LAST tokens must be matched similarly to collect, without consuming the closing parenthesis, allowing a list of items to be parsed between the symbol and the closure, in the NESTED state. * parser.y (gather_clause, collect_clause, elem, repeat_parts_opt, rep_parts_opt): Adjust to new until/last syntax. In the matching productions, the abstract syntax changes to incorporate the options. In the output productions, we throw an error if options are present. * txr.1: Documented :mandatory for collect, coll and gather.
* Gather bugfix: support empty :vars.Kaz Kylheku2016-01-151-2/+5
| | | | | | | | * match.c (v_gather): Use getplist_f to distinguish the :vars nil case just like v_collect does. A :vars nil gather could be useful; it says none of the variables are strictly required. In any case, it is not correct to treat :vars nil as if :vars weren't there.
* Bugfix: *print-flo-format* used for integer output.Kaz Kylheku2016-01-141-0/+2
| | | | | * lib.c (obj_print_impl): Handle NUM and BGNUM separately from FLNUM, thorugh a hard-coded "~s" format.
* Improve n-ary minus like newly added division.Kaz Kylheku2016-01-141-3/+13
| | | | | | * lib.c (minusv): Avoid reduce_left overhead in common two-argument case, and just call binary minus function directly.
* Optimization in n-ary numeric functions.Kaz Kylheku2016-01-141-5/+12
| | | | | * lib.c (nary_op): Avoid the overhead of reduce_left in the two-argument case and just call the binary function.
* Fix omission: the / function becomes n-ary.Kaz Kylheku2016-01-134-3/+25
| | | | | | | | | | * eval.c (eval_init): Register / function to divv instead of divi. * lib.c (divv): New function. * lib.h (divv): Declared. * txr.1: Documented.
* bugfix: no location info for unbound var in dohash.Kaz Kylheku2016-01-131-5/+5
| | | | | | | * eval.c (do_expand): Add missing rlcp in the construction of the return value of the clause which expands a dohash. Let's make it a rlcp_tree. Test case: (dohash (a b c) d e) with c unbound.
* The identity function gets an alias: use.Kaz Kylheku2016-01-132-1/+23
| | | | | | * eval.c (eval_init): Register "use" as alias for identity. * txr.1: Documented use function.
* Pastes produced using :read are now numbered.Kaz Kylheku2016-01-131-4/+6
| | | | | | | | * parser.c (read_eval_read_last): New argument: counter. Incorporate counter into name of stream. (repl): Pass prev_counter into read_eval_read_last so the paste inherits the line number of the :read command.
* Support crypt function.Kaz Kylheku2016-01-133-0/+73
| | | | | | | | | | * configure: Check for availability of crypt, and what library must be used. * sysif.c (crypt_wrap): New static function. (sysif_init): Register crypt intrinsic. * txr.1: Documented crypt.
* Don't clobber conf_ldflags.Kaz Kylheku2016-01-131-1/+1
| | | | | * configure: the do-we-need-to-set-stack-size test shouldn't overwrite conf_ldflags, but add to it.
* Support extra linker flags.Kaz Kylheku2016-01-131-1/+1
| | | | | * Makefile (EXTRA_LDFLAGS): New variable, interpolated into LDFLAGS.
* Version 131.txr-131Kaz Kylheku2016-01-124-4/+32
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* Fix broken print of semicolon after ctrl char.Kaz Kylheku2016-01-121-1/+1
| | | | | | | | * lib.c (out_str_char): If semi-flag is true, we must issue a semicolon not only when the next character is a hex digit, but also when it is a semicolon, so that "\x1F;;" isn't rendered as "\x1F;" where the semicolon character has disappeared.
* Regex printing not escaping [ and ].Kaz Kylheku2016-01-121-1/+2
| | | | | * regex.c (print_rec): Handle '[' and ']' in backslash-adding switch.
* Print control chars in regexes using \x.Kaz Kylheku2016-01-123-54/+72
| | | | | | | | | | | | | | | | | | | | * lib.c (out_str_char): Static function becomes extern. * lib.h (out_str_char): Declared. * regex.c (puts_clear_flag, putc_clear_flag): New static functions. (print_class_char): Take semicolon flag argument. Use out_str_char to render characters not escaped locally. Clear the semicolon flag. (paren_print_rec): Take semicolon flag argument, and pass it down. Clear it when printing parentheses. (print_rec): Take semicolon flag argument, and pass down to lower level functions. Use putc_clear_flag and puts_clear_flag instead of put_string and put_char. Use out_str_char for char object not esaped locally. (regex_print): define semi_flag and pass it down to print_rec.
* Pretty-print DEL and U+DCxx str char using \xHEX.Kaz Kylheku2016-01-121-1/+1
| | | | | | * lib.c (out_str_char): Don't print all characters above space as themselves. Treat 7F and U+DCxx as control chars to be printed using hex escape.
* regex_print: [ and ] in char class must be escaped.Kaz Kylheku2016-01-121-1/+1
| | | | * regex.c (print_class_char): Add missing character cases.
* Remove redundant assert in mem allocation functions.Kaz Kylheku2016-01-101-3/+0
| | | | | | * lib.c (chk_strdup, chk_strdup_utf8, chk_copy_obj): No need to assert !async_sig_enabled since the lower level chk_malloc or chk_malloc does it.
* Reduce scope of variable in cat_str.Kaz Kylheku2016-01-101-2/+2
| | | | | * lib.c (cat_str): Unnecessarily scoped len variable moves to inner scope.
* New internal function scat: variable arg cat_str.Kaz Kylheku2016-01-104-7/+88
| | | | | | | | | | | | | | Avoids consing up list of strings. * lib.c (vscat): New static function. (scat): New function. (lazy_str): Use scat instead of cat_str. * lib.h (scat): Declared. * eval.c (format_field): Use scat instead of cat_str. * parser.c (open_txr_file, read_eval_stream): Likewise.
* GC-correct order in copy_lazy_str.Kaz Kylheku2016-01-101-2/+2
| | | | | | * lib.c (copy_lazy_str): Eliminate pointless initialization of ls.list and to nil. Make ls.prefix initialization the last step since it's the only operation which conses.
* Don't record form as its own macro origin.Kaz Kylheku2016-01-091-2/+2
| | | | | | | * eval.c (set_origin): Add form != origin to the condition for recording the ancestry. (expand_macro): Use set_origin function instead of direct call to sethash.
* Rework lazy string optimization done in TXR 118.Kaz Kylheku2016-01-091-26/+10
| | | | | | | | | | | | | This is also a bugfix. Padding up the index to be at least 1024 characters longer than the existing prefix was dumb and wrong; it changes the semantics of code which restores the list from the lazy string, like the @(freeform) directive. How much of the string is forced is visible to the caller! * lib.c (lazy_str_force, lazy_str_force_upto): Don't collect pieces from the lazy list and then catenate them in one pass. Instead, use the existing function string_extend, which grows the string exponentially.
* Use struct instead of cons for lazy string fields.Kaz Kylheku2016-01-093-20/+37
| | | | | | | | | | | | | | | | * gc.c (finalize): Must free the dynamic structure attached to the LSTR type now. (mark_obj): Must mark interior of LSTR type's props structure. * lib.c (lazy_sub_str, copy_lazy_str): Copy props structure. (lazy_str): Allocate and initialize props structure. (lazy_str_force, lazy_str_put, lazy_str_force_upto, lazy_str_get_trailing_list, out_lazy_str): Follow representation change. * lib.h (struct lazy_string_props): New struct type. (strut lazy_string): Member opts replaced with props pointer to struct lazy_string_props.
* New internal function for copying malloced object.Kaz Kylheku2016-01-092-0/+9
| | | | | | * lib.c (chk_copy_obj): New function. * lib.h (chk_copy_obj): Declared.
* Squash compiler complaint about _BSD_SOURCE.Kaz Kylheku2016-01-081-1/+1
| | | | | | | | | | | | Some glibc nincompoops have suddenly decided, in their infinite wisdom, that a wise move is to deprecate the _BSD_SOURCE feature selection macro with annoying preprocessor warnings insisting that _DEFAULT_SOURCE be used instead, even though the functions convered by _BSD_SOURCE still exist. * configure: Let's test for _DEFAULT_SOURCE ahead of _BSD_SOURCE.
* Fix Valgrind integration breakage.Kaz Kylheku2016-01-071-1/+1
| | | | | | * signal.c (sig_mask): Pass address of real_oldset to VALGRIND_MAKE_MEM_DEFINED, rather than a copy of the object itself.
* Version 130.txr-130Kaz Kylheku2016-01-056-324/+372
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Bad formatting under data directive.Kaz Kylheku2016-01-051-1/+1
| | | | txr.1: Improperly closed .cblk around example.
* Clarify same-sequence semantics of swap, rotate, shift.Kaz Kylheku2016-01-041-0/+42
| | | | | | * txr.1: Document what happens, or else what isn't specified, if swap, rotate or shift are used on ranges of the same sequence.
* Static slots mustn't trigger instantiation.Kaz Kylheku2016-01-041-2/+3
| | | | | | | | | It is already documented that accessing the instance slots (not static slots) of a lazy struct forces it to instantiate, thus this is a doc conformance bug. * struct.c (lookup_slot): Only call check_init_lazy_structs in the code paths where we calculate the location of an instance slot.
* Revert chr-isdigit/isxdigit, provide new functions.Kaz Kylheku2016-01-044-8/+32
| | | | | | | | | | | | | | | | | | | It was a mistake to change the semantics of the return value of chr-isdigit and chr-isdigit. It breaks code like [partition-by chr-isdigit ...]. The behavior of chr-isdigit and chr-isxdigit is restored to returning t and nil. New chr-digit and chr-xdigit functions are introduced for returning the digit value or nil. * eval.c (eval_init): Register chr-digit and chr-xdigit intrinsics. * lib.c (chr_isdigit, chr_isxdigit): Restore old behavior. (chr_digit, chr_xdigit): New functions. * lib.h (chr_digit, chr_xdigit): Declared. * txr.1: Everything documented.
* 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.