summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* Useful feature: object post-initialization.Kaz Kylheku2015-12-168-18/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Structs can now have code which executes after an object is initialized, which is useful for doing work like registering objects in global lists and whatever, when those actions need access to the initialized slots of the object. * share/txr/stdlib/struct.tl (defstruct): Handle :posinit syntax, by generating lambda as eighth argument of sys:make-struct call. * struct.c (struct struct_type): New member, postinitfun. (struct_init): Adjust registrations of make_struct_type to account for new parameter. The user visible make-struct-type is registered as having one optional argument, for backward compat. (make_struct_type): New argument, postinitfun. Store this in the structure. For backward compatibility, the argument is defaulted. (struct_type_mark): Mark the new postinitfun member. (call_postinitfun_chain): New static function. (make_struct, lazy_struct_init): Call call_postinitfun_chain after slots are initialized, and after the boa function is called. * struct.h (make_struct_type): Declaration updated. * lib.c (time_init): Pass eighth argument to make_struct type. * sysif.c (sysif_init): Likewise. * unwind.c (uw_late_init): Likewise. * tests/012/struct.tl: Update defstruct expansion test case. * txr.1: Document new argument of make-struct-type, and clarify ordering of initfun with regard to other actions. Likewise, document :postinit, and clarify ordering of :init actions with regard to other actions.
* Support eight-argument intrinsic functions.Kaz Kylheku2015-12-162-1/+53
| | | | | | | | | | * lib.h (enum functype): New member, N8. (struct func): New members n8 and n8v in embedded f struct. (func_n8, func_n8v, func_n70, func_n8o): Declared. * lib.c (equal): Handle N8 in switch. (func_n8, func_n8v, func_n70, func_n8o): New functions. (generic_funcall): Handle N8 in two switches.
* bugfix: dwim_set not handling hash correctly.Kaz Kylheku2015-12-161-0/+4
| | | | | | | | * lib.c (dwim_set): When the range argument is a vector or list, it is wrongly hangled through replace, even if seq is a hash. replace throws since it doesn't handle hashes. We must treat the vector or list as a hash key and handle through sethash.
* bugfix: nil from in replace wrongly treated as 0.Kaz Kylheku2015-12-161-6/+6
| | | | | | | * lib.c (replace_list, replace_str, replace_vec): The from argument must be checked to be a list using listp not consp. The legacy convention that nil is treated as missing does not work in this function as it does in sub.
* HTML doc: markup in lower case.Kaz Kylheku2015-12-152-46/+46
| | | | | | | | Requires updated man2html which puts out lower case. * genman.txr: All matched and generated HTML is lower case. * txr.1 (NP*): Use lower case h4 tag in M2SS macro.
* HTML doc: fix back jumping flaw.Kaz Kylheku2015-12-141-5/+13
| | | | | | | | | | | | | Issue: wrong [+] changes to [-], leading to inconsistent state. * genman.txr: In TOC extraction and transformation, we fix the stupid broken <DT>....<DD> that man2html puts out and turn it into <DT>...</DT>. This way a DL now has a DT element as its previous sibling. (tocjump): When we see a DL now, we get the correct element which has the expand/collapse: the previous sibling which is a DT containing the anchor.
* Improved documentation of macro parameter lists.Kaz Kylheku2015-12-141-18/+64
| | | | | | * txr.1: Improved wording, better explanation, explanation that nested macro lists support all features, and specified meaning of :whole inside nested lists.
* Allow :whole and :form to do destructuring.Kaz Kylheku2015-12-141-7/+15
| | | | | | | | | * eval.c (bind_macro_params): Remove the restriction that the :whole and :form do not allow a destructuring pattern, requring strictly a symbol. Common Lisp's &whole also does destructuring. As a side effect of this change, the :env parameter also supports destructuring, thought this isn't going to be meaningful since macro environments aren't lists.
* Pluralization under Equality Substitution.Kaz Kylheku2015-12-131-1/+1
| | | | * txr.1: "unless they are the same object."
* Clean up formatting in conventions section.Kaz Kylheku2015-12-131-26/+5
| | | | | | | | txr.1: Lose the useless use of conditional evaluation. Everything is doable with the meIP macro. Only one piece of conditional evaluation is needed for different wording: textual man page says "angle brackets" whereas formatted page refers to italic font.
* Handle browsers with JS disabled.Kaz Kylheku2015-12-131-0/+3
| | | | | * genvim.txr: Below Contents, place a note for users who have disabled Javascript.
* Remove redundant title tag.Kaz Kylheku2015-12-131-1/+1
| | | | | * genvim.txr: For some reason, we were generating a second <title> tag, with different contents.
* HTML doc: expand TOC section on jumpback.Kaz Kylheku2015-12-121-2/+21
| | | | | | | | | | | | When a section number is clicked, if the table of contents section which contains it is collapsed, open it, and its parents. * genman.txr: (tocjump): New JS function. add onclick action to jump-back links, which calls tocjump JS function which does the expansion. The name anchor entries in the TOC are tagged with a "tocanchor: class so they can be more specifically selected by the tocjump function.
* HTML doc: jump back to TOC feature.Kaz Kylheku2015-12-121-2/+5
| | | | | | | | | Section numbers are now hyperlinks which jump back to their respective table of contents entry. * genman.txr (toc-tag): New function. Generate link anchors into section titles. Generate name anchors in TOC.
* Fix example under conda.Kaz Kylheku2015-12-121-1/+1
| | | | * txr.1: Remove spurious z in example.
* Improvement in type tree diagram.Kaz Kylheku2015-12-121-4/+8
| | | | | * txr.1: Structures move under cobj types, which are indicated with angle brackets to show they are not programmer-visible.
* Update typeof documentationKaz Kylheku2015-12-121-3/+19
| | | | * txr.1: more types are listed under typeof.
* Formatting under func-get-name.Kaz Kylheku2015-12-111-1/+1
| | | | * txr.1: Misuse of << in syntax block.
* symbol-function semantics change; new symbol-macro.Kaz Kylheku2015-12-103-45/+180
| | | | | | | | | | | | | | | | | | | | | | | * eval.c (symbol_function): Only retrieve function binding, and not macro or operator bindings, unless compatibility <= 127 is in effect. (symbol_macro): New function. (fboundp): Only test for existence of function, not macro or operator, unless <= 127 compatibility is in effect. (fmakunbound): Do not remove macro binding, unless compatibility <= 127 is in effect. (eval_init): Register sys:top-mb variable for use in place.tl library module. Register symbol-macro intrinsic function. * share/txr/stdlib/place.tl (sys:get-mb): New function (symbol-macro): New syntactic place. * txr.1: Updated incorrect documentation about environments from the perspective that macros and functions coexist. Documented symbol-macro. Updated symbol-function, fboundp and fmakunbound documentation. Added missing documentation for mmakunbound. Reference to fboundp under define-place-macro revised to mboundp. Added compatibility notes.
* Change representation of top-level macro bindings.Kaz Kylheku2015-12-101-6/+8
| | | | | | | | | | * eval.c (expand_macro): The expander argument is now a macro binding, which is a cons cell for built-in macros written in C also, not only for Lisp-defined macros. (symbol_function): Dereference macro binding. (reg_mac): Construct cons cell binding for built-in macro instead of sticking it into the table directly.
* Version 127.txr-127Kaz Kylheku2015-12-096-284/+330
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Solaris issue detecting ftello/fseeko.Kaz Kylheku2015-12-091-0/+4
| | | | | * configure: re-test for ftello with _LARGEFILE_SOURCE and add to lang_flags if that works.
* Solaris issue: ftruncate not detected.Kaz Kylheku2015-12-091-1/+1
| | | | * configure (lang_flags): Add POSIX_C_SOURCE set to 200112.
* Bugfix: crash in get_line.Kaz Kylheku2015-12-091-8/+6
| | | | | | | | | | | Incorrect, irrelevant handle test inside stdio_get_line virtual function fails to detect closed stream, leading to a null pointer passed to the stdio library. * stream.c (snarf_line): Rewrite according to pattern followed by the other functions. We must test h->f for null, not stream->co.handle, which never goes null until the object is being reclaimed by gc.