summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* bugfix: spurious nils in pad function's output.Kaz Kylheku2017-08-021-5/+6
| | | | | | * eval.c (pad): Incoming sequence must be nullified, otherwise empty vectors and strings produce a spurious nil. This affects the weave function, which uses pad.
* genvim: ^ is constituent of identifiers.Kaz Kylheku2017-08-011-1/+1
| | | | | * genvim.txr (iskeyword): add ^ character. Now r^ and others are colorized properly.
* Evaluate doloop forms in an implicit tagbody.Kaz Kylheku2017-07-312-12/+22
| | | | | | | | | | This eliminates one incompatibility between doloop and ANSI CL do. * share/txr/stdlib/doloop.tl (sys:expand-doloop): Wrap body in tagbody form. * txr.1: Documentation updated.
* doc: note about label symbols in tagbody.Kaz Kylheku2017-07-311-0/+11
| | | | | * txr.1: Note added that a tagbody label may be any symbol whatsoever.
* Small code cleanup in tagbody.Kaz Kylheku2017-07-311-4/+3
| | | | | | | * share/txr/stdlib/tagbody.tl (tagbody): Reduce unnecessary use of DWIM brackets to parentheses in calculation of bblocks. Remove entry-lbl local variable, propagating its initform to its one and only use site.
* bugfix: tagbody mustn't expose anonymous block.Kaz Kylheku2017-07-301-8/+9
| | | | | | | | * share/txr/stdlib/tagbody.tl (tagbody): Use progn for the trivial case, and in the ordinary case, the sys:for-op special form directly rather than the for loop maro. sys:for-op doesn't introduce a block; the for macro is doing that.
* Optimize trivial tagbody.Kaz Kylheku2017-07-301-35/+37
| | | | | | | | | * share/txr/stdlib/tagbody.tl (tagbody): If the body contains no labels, then emit a simple block. Note that we should just be emitting a progn here; however, there is a bug in tagbody in that there is an anonymous block. This is not documented, and a consequence of the looping construct used. So for now we preserve that behavior in the reduced case.
* listener: handle incomplete buf literals.Kaz Kylheku2017-07-301-1/+23
| | | | | * parser.c (is_balanced_line): Handle #b'...' syntax with some new states and transitions.
* New macros doloop and doloop*.Kaz Kylheku2017-07-303-0/+236
| | | | | | | | | | * lisplib.c (doloop_set_entries, doloop_instantiate): New functions. (lisplib_init): Register autoload for doloop macros. * share/txr/stdlib/doloop.tl: New file. * txr.1: Documented.
* doc: grammar under Ranges.Kaz Kylheku2017-07-291-1/+1
| | | | * txr.1: Superfluous article a deleted, and sentence reworded.
* genvim: flag trailing junk in #x #o #b literals.Kaz Kylheku2017-07-291-9/+14
| | | | | | | | | | | * genvim.txr (txr_pnum): New match; matches a superset of the #x, #o and #b literals with the inclusion of trailing alphanumeric junk. Highlighted as Error. (txr_xnum, txr_onum, txr_bnum): New match categories, formed by renaming the previous #x, #o and #b matches. These are contained in txr_pnum, highlighted as Number. (txr_bracevar, txr_directive, txr_list, txr_bracket, txr_mlist, txr_mbracket): Include txr_pnum.
* doc: struct literals: bad syntax synopsis.Kaz Kylheku2017-07-291-1/+1
| | | | * txr.1: Fix incorrect #H prefix which should of course be #S.
* doc: grammar in setuid section.Kaz Kylheku2017-07-291-1/+1
| | | | * txr.1: anything code -> any code.
* genvim: flag invalid # syntax.Kaz Kylheku2017-07-281-0/+2
| | | | | | | * genvim.txr (txr_error): New match in this category for # followed by something other than H, S or R. Some characters other than these are valid after #, but are covered by explicit matches that occur later.
* genvim: fix buggy tl_ident containing #.Kaz Kylheku2017-07-281-1/+1
| | | | | | | * genvim.txr (tl_ident): Fix the incorrect match which allows things beginning with # to be categorized as identifier tokens. The new match reflects the true original intent: the match must not begin with #, but may contain #.
* genvim: highlight buffer literals.Kaz Kylheku2017-07-281-4/+11
| | | | | | | * genvim.txr (txr_buf_error, txr_buf_interior): New matches. (txr_list, txr_bracket, txr_mlist, txr_mbracket): Now also contain txr_buf. (txr_buf): New region, in the new txr_string matchgroup.
* genvim: bugfix for #x, #o and #b integer tokensKaz Kylheku2017-07-271-3/+3
| | | | | | | * genvim.txr (txr_num): Move the syn match definitions for hex, octal and binary integer tokens after tl_ident, which is a more general match that matches them also, and causes them to be colorized as symbols rather than numbers.
* lib: deprecate set-diff; extend set operations.Kaz Kylheku2017-07-264-20/+164
| | | | | | | | | | | | | | * eval.c (eval_init): Register set-diff under two names: set-diff and diff. Register new isec and uni intrinsics. * lib.c (isec, uni): New functions. * lib.h (isec, uni): Declared. * txr.1: Documented new uni and isec functions, new diff function name, and the deprecation of set-diff and its order guarantee w.r.t the left sequence.
* Version 183.txr-183Kaz Kylheku2017-07-197-928/+984
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim, protsym.c: Regenerated.
* doc: fix bad *args-full* heading.Kaz Kylheku2017-07-191-1/+1
| | | | | | | * txr.1: We are missing an "and" in the heading for the section about the *args-full* and related variables. This was caught due to the fix in checkman.txr to handle Special variables sections.
* checkman: verify Special variables sections.Kaz Kylheku2017-07-191-4/+4
| | | | | | * checkman.txr (check-var): This pattern function must handle "Special variable{s,}" sections not only "Variable{s,}".
* doc: log-emerg et al are not special variables.Kaz Kylheku2017-07-191-2/+2
| | | | | * txr.1: the syslog-related constants are global lexical variables and so must not be documented as special variables.
* Named filters now stored in new *filters* hash.Kaz Kylheku2017-07-193-21/+64
| | | | | | | | | | | | | | | | * filter.c (filters): Global variable removed. (filter_s): New symbol variable. (filter_init): Remove gc-protection from removed variable. Intern the *filters* symbol. Use local variable for filters hash, create the *filters* special variable and store the hash into that. * filter.h (filters): Variable declaraton removed. (filters): New macro: expands to an expression designating the current value of *filters* in the dynamic environment. * txr.1: Documented *filters*, adding a forward reference to it from the description of filtering.
* gc: remove assertion from make_obj.Kaz Kylheku2017-07-191-1/+0
| | | | | | | * gc.c (make_obj): remove assertion that the object pulled from the free list is marked FREE. This hasn't proved to be valuable and adds a nonzero cost to a frequently executed path.
* doc: listener: parenthesis matching jumps forward also.Kaz Kylheku2017-07-181-1/+1
| | | | | | * txr.1: Under "Parentheses Matching" correct the introductory sentence which misleadingly claims that parenthesis matching jumps only backwards.
* doc: listener: remove bogus sentence.Kaz Kylheku2017-07-181-2/+1
| | | | | * txr.1: Under "Making a Selection", remove an unclear sentence which contributes nothing.
* doc: ffi out semantics wrongly refers to in semantics.Kaz Kylheku2017-07-181-1/+1
| | | | | | * txr.1: of course, the out operation of a type recursively invokes the out operation on embedded pointers, not the in operation.
* doc: *trace-output* font.Kaz Kylheku2017-07-181-1/+1
| | | | | * txr.1: Special varaible *trace-output* not typeset in typewriter font in heading.
* doc: no such method as lambda-ref.Kaz Kylheku2017-07-181-1/+1
| | | | | * txr.1: Under description of length function, reference to nonexistent lambda-ref should be lambda-set.
* doc: no such function as make-bufferKaz Kylheku2017-07-181-1/+1
| | | | | * txr.1: In description of buffer literal syntax, reference to make-buffer should be make-buf.
* doc: no ffi type operator "bits".Kaz Kylheku2017-07-181-2/+2
| | | | | * txr.1: Under description of bool, fix references to nonexistent (bits n type).
* find, pos: optimize and support objects properly.Kaz Kylheku2017-07-181-21/+114
| | | | | | | | | | | * lib.c (find, pos): Provide specialized behavior based on type and test and key functions. Lists and list-like objects are treated by marching down with cdr. Vectors are traversed with numeric index, as are vector-like objects which exhibit a length function. A special optimization is put in for non-lazy strings which use identity as their key function, and one of the built-in equality operators for the test function: wcschr is used on the underlying C string.
* new function: nthKaz Kylheku2017-07-185-0/+44
| | | | | | | | | | | | | | | | Just the ANSI CL nth for lists. * eval.c (eval_init): Register nth intrinsic. * lib.c (nth): New function. * lib.h (nth): Declared. * share/txr/stdlib/place.tl (nth): New place macro, trivially takes care of making nth an accessor. Place macros are terrific! * txr.1: Documented.
* new function: path-catKaz Kylheku2017-07-183-0/+125
| | | | | | | | | * stream.c (path_cat): New function. (stream_init): Registered path_cat. * stream.h (path_cat): Declared. * txr.1: Documented.
* remove-path: exception semantics adjusted.Kaz Kylheku2017-07-172-8/+14
| | | | | | | | | | | | * stream.c (remove_path): The second argument now defaults to false rather than true, and controls only whether an exception is thrown in the non-existence case. Thus, the function throws errors by default, as before, but doesn't throw by default if the failure reason is that the path doesn't exist. Previously it threw by default in all situations, and the flag turned all errors into a nil return. * txr.1: Documented.
* lib: new function, relate.Kaz Kylheku2017-07-174-0/+85
| | | | | | | | | | | * eval.c (eval_init): Register new intrinsic relate. * lib.c (do_relate, do_relate_dfl): New static functions. (relate): New function. * lib.h (relate): Declared. * txr.1: Documented.
* getopts: New argument type :text.Kaz Kylheku2017-07-162-2/+8
| | | | | | | | | | * share/txr/stdlib/getopts.tl (opt-desc): New entry in valid-types, :text symbol. (sys:opt-parsed convert-type): Handle :text case. This is a no-op since :text applied no treatment. (opthelp): Provide help text for :text type. * txr.1: Documented :text getopts option type.
* getopts: Fix broken custom function option type.Kaz Kylheku2017-07-161-2/+2
| | | | | | This was broken on 2016-11-03 by the commit "Support simple list arguments in getopts." The sys:opt-parsed type has no type slot.
* ffi: add offset argument to ffi buffer functions.Kaz Kylheku2017-07-163-34/+72
| | | | | | | | | | | | | * ffi.c (ffi_put_into, ffi_in, ffi_get, ffi_out): New offset parameter. (ffi_init): Re-register ffi-put-into, ffi-in, ffi-get and ffi-out with new optional parameter. * ffi.c (ffi_put_into, ffi_in, ffi_get, ffi_out): Declarations updated. * txr.1: Documented new argument on ffi-put-into, ffi-in and ffi-get. The documentation for ffi-out doesn't exist!
* regex: don't print superfluous parens around classes.Kaz Kylheku2017-07-161-2/+2
| | | | | | | | * regex.c (print_rec): Switching from negative tests to positive: print parens around elements of a compound which have a lower precedence. The previously incorrectly omitted set and cset remain unmentioned, so under this inversion of logic, they print without parentheses.
* format: support leading zero printing for floats.Kaz Kylheku2017-07-162-3/+16
| | | | | | | | | | | | | | | For a floating-point argument, the following behavior is supported by the ~a, ~s and ~f format directives: if the precision has a leading zero, then leading zeros are added, up to one less than the field width. * stream.c (formatv): Set the precision to one less than the field width when rendering floats, rather than to zero. The output_num code takes the precision as the cue for padding zeros. * txr.1: Updated format documentation, and clarified a few things also.
* global environment accessors can now create bindings.Kaz Kylheku2017-07-162-22/+18
| | | | | | | | | | | | | | The accessors symbol-value, symbol-function and symbol-macro can now be used to store a value to nonexistent bindings, which brings those bindings into existence. * share/txr/stdlib/place.tl (sys:ge-fun-getter-setter, sys:get-vb): Don't throw exceptions for nonexistent binding lookups: create and return the bindings instead. For methods, use static-slot-ensure rather than static-slot-set. Thus new methods can be defined by setting to a (meth ...) place. * txr.1: Doc updated.
* bugfix: pattern language undefined warning system.Kaz Kylheku2017-07-161-2/+3
| | | | | | | | * match.c (match_reg_var): The uw_tentative_def_exists check is being made against a symbol rather than the tag. This check will always fail. There is no ill consequence. Just that uw_register_tentative_def will be called redundantly when it doesn't have to be.
* trace: allow format and * functions to be traced.Kaz Kylheku2017-07-161-2/+5
| | | | | | | | * share/txr/stdlib/trace.tl (sys:tr*, sys:trfm): New variables, holding the * and format functions. (sys:trace-enter, sys:trace-leave): Use format and * through the aliases, so we don't trigger infinite recursion if these are traced.
* carray: add offset to carray-buf.Kaz Kylheku2017-07-153-21/+61
| | | | | | | | | | | | | | * ffi.c (struct carray): New member, offs. (make_carray): Initiialize offs member from new argument. (copy_carray, carray_blank, carry_ptr, carray_sub, carray_pun, carray_unum, carray_num): Pass zero offset to (carray_buf): New optional parameter off_in. (carray_buf_sync): Handle offset. (ffi_init): Update registration of carray-buf. * ffi.h (make_carray, carray_buf): Declaration updated. * txr.1: Documented.
* Fix use of raw null constant in carray implementation.Kaz Kylheku2017-07-151-1/+1
| | | | | | * ffi.c (carray_cptr): Ref argument in make_carray call should be specified as nil not 0. The meaning is the same, but it's wrong style for TXR internals.
* Remove unused variable in placelet implementation.Kaz Kylheku2017-07-151-1/+1
| | | | | * share/txr/stdlib/place.tl (sys:placelet-1): Remove the genyms called steal-getter which is not referenced.
* bugfix: spurious warnings issued against lisp1 eval.Kaz Kylheku2017-07-141-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Repro test cases for this: A: (progn (defun f ()) [f]). This emits a warning against the [f] usage, even though there is a tentative definition of f as a function. B: (progn (defun g () [f]) (defun f ())). Emits a warning against [f] usage which is not purged by the evaluation of the later definition. Both problems are related to the separation of deferred warnings into the tag namespaces: symbols and functions. When [f] is being expanded, the deferred warning is put into the variable namespace. So it doesn't match a tentative def in the function namespace which would otherwise suppress it. A subsequent function definition only purges the warning for the function space. We introduce a third space, the "symbol space". Lisp-1 deferred warnings are introduced against this namespace and both variable and function definitions purge deferred warnings from that namespace also, in addition to their respective proper namespace. This solves problem B. Problem A is solved by checking, when [f] is expanded, for tentative definitions of f in both the variable and function tag space. Note that test case B still warns when entered into the listener, because the listener dumps deferred warnings prior to evaluation, thus prior to evaluating (defun f ()). * eval.c (op_defvarl, op_defun): Purge deferred warnings from the sym tag namespace also. (expand_lisp1): Do not emit the deferred warning for a nonexistent name if it has a tentative definition either as a function or variable. When emitting the deferred warning, use the sym namespace.
* New :lists feature in @(collect)/@(coll).Kaz Kylheku2017-07-113-6/+47
| | | | | | | | | | | | | | | | | | | This is for those situations when multiple lists are being collected, and must all be bound even if empty. Yet, the lists are independent rather than parallel, so the discipline of :vars is too rigid. * match.c (lists_k): New keyword symbol variable. (h_coll, v_collect): Extract :lists argument as local variable lists, validate that :lists is not used on @(repeat)/@(rep) and implement logic. (match_expand_keyword_args): Treat expansion of :lists the same way as :vars. (syms_init): Initialize lists_k. * match.c (lists_k): Declared. * txr.1: Documented.
* doc: :vars not vars.Kaz Kylheku2017-07-111-3/+6
| | | | | * txr.1: Fix text under gather and collect directive wrongly referring to :vars keyword as just vars in the plain font.