summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* bugfix: intern public symbols in autoload files.Kaz Kylheku2018-02-071-0/+29
| | | | | | | | | | | | | | | | | | | | | | | This commit addresses a bug of the following type: (defpackage p (:fallback usr)) (in-package p) (let ((lb (new list-builder))) lb.(add 1)) ;; problem: this add is p:add the add symbol is not on the auto-load list; it occurs as a slot of the list-builder class, but is not interned when TXR starts. Thus the (:fallback usr) doesn't pick it up. Expected behavior is that add is usr:add. * lisplib.c (intern_only): New static function. (sock_set_entries, build_set_entries, getopts_set_entries, stream_wrap_set_entries): Define additional lists of supplemenary symbols which are passed to intern_only just to be interned in the usr package without autoload registratiions. These symbols are all slots documented for public use in various structures defined by the respective modules managed by these autoload functions.
* Version 189.txr-189Kaz Kylheku2018-02-067-1006/+1041
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim, protsym.c: Regenerated.
* bugfix: don't record source loc of symbols and numbers.Kaz Kylheku2018-02-051-4/+22
| | | | | | | | | | | | | | | | | | This prevents a bug which manifests itself as a totally bogus file name and line number being reported in a diagnostic. The cause is that source loc info is recorded for an interned symbol when it is first encountered in one place in the code. Then that symbol occurs again in another place (perhaps a different file) in such a way that its source loc info is inherited into a surrounding generated form which now has incorrect source loc info: the location of the first occurrence of the symbol not of this form. Then when some error is reported against the form, the bogus source loc info is shown. * parser.y (rlviable): New static function. (rlset): Only record source loc for forms which satisfy rlviable.
* doc: write Equality Substitution section.Kaz Kylheku2018-02-051-0/+63
| | | | | | * txr.1: Several places in the document refer to a section called Equality Substitution which supposedly exists under the Structures section. As of now, it actually does!
* doc: clarify text under constantpKaz Kylheku2018-02-051-3/+3
| | | | | * txr.1: Restructure long sentence for readability, fixing awkward comma in the process.
* doc: more detail in ref/refset re: structs.Kaz Kylheku2018-01-311-5/+32
| | | | | | * txr.1: Describe fallback of ref and refset onto list-like operations if lambda/lambda-set are not supported.
* doc: grammatic agreement under equal method.Kaz Kylheku2018-01-301-1/+1
| | | | * txr.1: "behavior ... becomes" second person agreement.
* doc: bad formatting of lambda-set syntaxKaz Kylheku2018-01-301-1/+1
| | | | * txr.1: Fix run-on parenthesis.
* doc: clarification in :maxgap example.Kaz Kylheku2018-01-261-1/+1
| | | | | * txr.1: a :maxgap of zero also means that the collected items must match immediately.
* doc: fix "five lines" typo in :maxgap description.Kaz Kylheku2018-01-261-1/+3
| | | | | | Reported by Martin Dvořák. * txr.1: Word "five" should be "n".
* doc: fix mistake in summary of @(repeat)Kaz Kylheku2018-01-261-2/+2
| | | | | | | Reported by Martin Dvořák. * txr.1: In pattern matching clauses, repeat and rep are shorthands for collect and coll.
* doc: formatting of in directives intro.Kaz Kylheku2018-01-261-1/+3
| | | | * txr.1: use mono font for @(output).
* doc: some clarifications about dwim brackets.Kaz Kylheku2018-01-251-6/+13
| | | | | | txr.1: The equivalences between [x i] and some functions like ref are dynamic; they depend not only on the type ofx, but also whether i is a range or integer.
* Fix broken autoload of socket functions.Kaz Kylheku2018-01-251-0/+3
| | | | | | | * lisplib.c (sock_set_entries): Add missing sock-bind, sock-connect, sock-listen, sock-accept, sock-shutdown, open-socket, open-socket-pair, sock-send-timeout and sock-recv-timeout.
* doc: update car, cdr, rplaca, rplacd.Kaz Kylheku2018-01-081-26/+114
| | | | | | | | | | | * txr.1: Update the documentation to reflect the current handling of objects, eliminating some contradictions in the process, like text which says that rplacd is erroneous on anything but conses and lazy conses, followed by text which states other kinds of objects are allowed. The semantics of car and cdr forms as places is described strictly in terms of rplaca and rplacd, so the mechanism is then described in one place.
* tail: reduce calls to cdr.Kaz Kylheku2018-01-071-2/+3
| | | | | | * lib.c (tail): Don't call cdr on the same cell twice in the loop body. tail is used in list_collect and friends, which are used all over the place.
* term: move near site of use.Kaz Kylheku2018-01-073-8/+7
| | | | | | | | | * eval.c (term): Function here from lib.c, and changed to static. It is used only by iapply. * lib.c (term): Function moved to eval.c. * lib.h (term): Declaration removed.
* listref_l: remove.Kaz Kylheku2018-01-062-18/+0
| | | | | | * lib.c (listref_l): Unused function removed. * lib.h (listref_l): Declaration removed.
* refset: implement objects that support car method.Kaz Kylheku2018-01-061-12/+46
| | | | | | | | | | | | | | refset and range assignment is implemented for objects that have no lambda-set but do have a car method. * lib.c (refset): Implementation for lists rewritten to avoid listref_l, and use nthcdr instead. For structs, if there is no lambda-set method, but a car method exists, jump to the list case: the idea is that we can cdr down and then use rplaca. (dwim_set): Error handling streamlined. In this function too, we check whether there is a car method and branch to the list case.
* nthcdr: terminate loop if end of list hit.Kaz Kylheku2018-01-051-1/+1
| | | | | * lib.c (nthcdr): Terminate loop when nil is hit rather than continuing to count down to zero.
* car, cdr: self-identify in error message.Kaz Kylheku2018-01-051-2/+2
| | | | | * lib.c (car, cdr): Type mismatch messages now identify functions.
* car, cdr: fall back on lambda method.Kaz Kylheku2018-01-031-4/+24
| | | | | | * lib.c (car, cdr): Don't fail if the struct object has no car or cdr method. Use it if it is available, otherwise try to fall back on the lambda method if that is available.
* ltail: unused function.Kaz Kylheku2018-01-022-8/+0
| | | | | | | | * lib.c (ltail): Function removed. This was introduced at the same time as lazy_appendv and used only by it. That function was rewritten a few months ago and doesn't use lail. * lib.h (ltail): Declaration removed.
* seq_info: bugfix: wrong object tested obj_struct_p.Kaz Kylheku2018-01-021-1/+1
| | | | | | * lib.c (seq_info): The obj_struct_p test must be applied to obj, not to cls, which is a symbol. Due to this bug, seq_info would always report struct-based sequences as SEQ_NOTSEQ.
* seq_info: whitespace.Kaz Kylheku2018-01-021-1/+1
| | | | | * lib.c (seq_info): Incorrect indentation of else statement fixed.
* last: rewrite using seq_info.Kaz Kylheku2018-01-021-10/+17
| | | | | * lib.c (last): Use seq_info classification rather than relying on listp.
* eliminate cdr_l use from implementation of last.Kaz Kylheku2018-01-022-12/+8
| | | | | | * lib.c (lastcons): Return value is just the last cons rather than a loc. The only caller of this function is last. (last): Adapt to the new lastcons.
* Use rplaca and rplacd instead of set over car_l/cdr_l.Kaz Kylheku2018-01-017-28/+28
| | | | | | | | | | | | | | | | | | | | | | | This reduces the proliferation of car_l and cdr_l. With this change, nreverse should work on chains of objects that implement rplacd. * combi.c (comb_gen_fun_common, rcomb_gen_fun_common): Use rplaca. * eval.c (mappendv, mapdov): Likewise * hash.c (hash_equal_op): Likewise. * lib.c (nreverse, acons_new, aconsql_new, sort_list): Use rplaca and rplacd. * match.c (dest_set, v_gather, v_collect, v_flatten, v_cat, v_output, v_filter): Likewise * parser.c (ensure_parser): Use sys_rplacd. * unwind.c (uw_register_subtype): Use rplacd.
* sub and replace redirect to structure methods.Kaz Kylheku2018-01-013-6/+121
| | | | | | | | | | | | | * lib.c (replace_obj): New static function. (sub): Handle struct case via lambda method. (replace): Handle struct case via replace_obj. * txr.1: Documented. * tests/012/aseq.tl (add): The lambda method now has to handle a range argument. One test case uses the last function, which for non-lists relies on sub, which now calls the lambda method if the object has one.
* New inlined test for struct object.Kaz Kylheku2017-12-313-19/+20
| | | | | | | | | | | * lib.c (seq_info, car, cdr, make_like, nullify, generic_funcall, copy, length, empty, ref, refset, dwim_set, dwim_del, populate_obj_hash): Use new obj_struct_p test when we know that the object is a COBJ. * struct.c (struct_inst_ops): Change from static to extern. * struct.h (ob_struct_p): New inline function.
* New methods rplaca and rplacd.Kaz Kylheku2017-12-304-2/+101
| | | | | | | | | | | | | | | * eval.c (eval_init): Register rplaca and rplacd using new rplaca_s and rplacd_s symbol variables. * lib.c (rplaca_s, rplacd_s): New symbol variables. (rplaca): Handle struct object via rplaca method, if it has one, otherwise lambda-set, if it has that, or else error out. (rplacd): Handle struct object via rplacd method. * lib.h (rplaca_s, rplacd_s): Declared. * txr.1: Documented rplaca and rplacd methods.
* refset: better diagnostics.Kaz Kylheku2017-12-291-1/+3
| | | | | | * lib.c (refset): If structure has no lambda-set method, diagnose it like that, rather than "not a sequence". Also, diagnostics should use refset:, not ref:.
* doc: invoke-catch: no such function as get-framesKaz Kylheku2017-12-291-2/+3
| | | | | * txr.1: Fix wording under invoke-catch which refers to a nonexistent function called get-frames.
* read, iread: source location recording now conditional.Kaz Kylheku2017-12-295-64/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recording of source location info incurs a time and space penalty. We don't want to impose this on programs which are just reading large amounts of Lisp data that isn't code. * eval.c (eval_init): Register lisp-parse and read functions to the newly introduced nread function rather than lisp_parse. lisp_parse continues to record source location info unconditionally. * parser.c (rec_source_loc_s): New symbol variable. (parser_common_init): Set the new member of the parser structure, rec_source_loc, according to the current value of the special var *rec-source-loc*. (lisp_parse_impl): New second argument, rlcp_p. If true, it overrides the rec_source_loc member of the parser structure to true. (lisp_parse): Pass true argument to rlcp_p parameter of lisp_parse_impl, so parsing via lisp_parse always records source loc info. (nread): New function. (iread): Pass true argument to rlcp_p parameter of lisp_parse_impl, so *rec-source-loc* controls whether source location info is recorded. (parse_init): Initilize rec_source_loc_s symbol variable, and register the *rec-source-loc* special var. * parser.h (struct parser): New member, rec_source_loc. (rec_source_loc_s, nread): Declared. * parser.y (rlcp_parser): New static function. Like rlcp but does nothing if parser->rec_source_loc is false. (rlc): New macro. (grammar): Replace rlcp uses with rlc, which expands to a call to rlcp_parser. (rlrec): Do nothing if source loc recording is not enabled in the parser. (make_expr, uref_helper): Replace rlcp with rlc. This is possible because these functions have a parser local variable that the macro expansion can refer to. (parse_once): Override rec_source_loc in the parser to 1, so that source loc info is always recorded when parsing is invoked through this function. * txr.1: Documented *rec-source-loc* and added text under read and iread.
* hash: read/print consistency regression.Kaz Kylheku2017-12-283-57/+78
| | | | | | | | | | | | | | | | | | | | | | TXR 188 makes a slight mess of the #H notation. An :eql-based hash table prints as #H(() ...), but when that notation is read, it produces an :equal-based hash table. No aspect of this situation was intended; the intent was that the notation stays the same as before, and just the hash function changes to make :equal-based the default. Let's just go with this and have #H(() ...) denote :equal-based tables. * hash.c (hash_print_op): Print an :eql-based for eql-based hash tables, and nothing for equal-based ones. In compatibility mode with 188 and older, reproduce the old behavior, rendering equal-based tables with :equal-based and the absence of a symbol for eql-based. * txr.1: Updated places that touch on :equal-based and added compatibility notes. * tests/009/json.expected: updated, since equal-based hash tables now print without :equal-based keyword.
* doc: document listener :prompt properly.Kaz Kylheku2017-12-281-1/+1
| | | | | * txr.1: There is no :print command in the listener to print the current prompt; it is actually the :prompt command.
* Version 188.txr-188Kaz Kylheku2017-12-197-762/+815
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim, protsym.c: Regenerated.
* New functions: rlist and rlist*.Kaz Kylheku2017-12-182-0/+135
| | | | | | | | | | These easily express discontinuous ranges. * eval.c (rlist_fun, rlist_star_fun, rlist, rlist_star): New static functions. (eval_init): Register rlist and rlist* intrinsics. * txr.1: Documented.
* expander: do constant folding of a..b range exprs.Kaz Kylheku2017-12-181-0/+9
| | | | | | | | | * eval.c (do_expand): In the function call case, check for the operator being the rcons function. If it is called with exactly two arguments and they are constantp in the given environment, then evaluate them and replace with a range literal object. Rationale: ranges often appear in constant form like [array 1..:] and whatnot.
* doc: listener: clarify about deletion in selection mode.Kaz Kylheku2017-12-151-3/+11
| | | | | | * txr.1: Clarify that Ctrl-D is the only deletion command which copies into the clipboard, and only in visual selection mode.
* doc: ffi: clarify in and out nuances.Kaz Kylheku2017-12-151-6/+7
| | | | | | | | | | | * txr.1: Fix wrong wording about the by-value nuance of the in operation. What is specifically doesn't do, in contrast to the by-pointer nuance, is propagate the foreign representation back to Lisp. Not Lisp to foreign, which is opposite to the in operation. Also clarifying some wording in the description of the out operation: that the by-value nuance doesn't reconstruct from the updated Lisp structure, to help the reader keep in mind the data direction.
* awk: condense implementation of range-macros.Kaz Kylheku2017-12-151-36/+13
| | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-mac-let): Move repeated boiler-plate code from the various rng macrolets into an the implementation of the sys:rng macro they rely on. That implementation is split into two macros: sys:rng is now the name of a wrapper which adds the boiler-plate, and the bulky implementation macrolet is now called sys:rng-impl.
* doc: slots, not members.Kaz Kylheku2017-12-141-9/+9
| | | | | | * txr.1: Fixed a number of places where structure slots are called members. In the context of structures, we use the word member only for C structures; Lisp structures have slots.
* doc: wrong typesetting of suspend.Kaz Kylheku2017-12-141-1/+1
| | | | | | * txr.1: Example for sys:capture-cond uses wrong style for the reference to the suspend operator suspend, causing it not to be hyper-linked to the definition in the HTML version.
* doc: swapped words in continuations description.Kaz Kylheku2017-12-141-1/+1
| | | | | | * txr.1: Paragraph about sys:cont-poison must say "continuation's evaluation frames" not "evaluation's continuation frames"
* doc: attempt to clarify continuations.Kaz Kylheku2017-12-141-18/+85
| | | | | | | * txr.1: Under sys:capture cont, try to revise some potentially confusing text. Also adding more notes, clarifying the semantics of shared lexical environments, and behavior of special variable bindings with regard to continuations.
* doc: example formatting under tuples.Kaz Kylheku2017-12-141-1/+2
| | | | | | * txr.1: Fix example code that is too wide, causing a visual problem for standard 80 column man page formatting.
* doc: severe formatting problem under int-str.Kaz Kylheku2017-12-141-2/+2
| | | | | * txr.1: Fix lack of escaping of backslash in #\c causing the c to be interpreted as a troff code.
* doc: mapcar heading problem.Kaz Kylheku2017-12-141-1/+1
| | | | * txr.1: Add missing comma in mapcar section heading.
* Structure delegate streams documented.Kaz Kylheku2017-12-141-0/+446
| | | | | | | * txr.1: New major (SS*) section User-Defined Streams. Documented make-struct-delegate-stream function, the stream-wrap class and all the stream interface object methods.