summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
...
* buf: new buffer stream.Kaz Kylheku2017-08-141-0/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * buf.c (struct buf_strm): New struct type. (buf_strm_mark, int buf_strm_put_byte_callback, buf_strm_put_string, buf_strm_put_char, buf_strm_put_byte, buf_strm_get_byte_callback, buf_strm_get_char, buf_strm_get_byte, buf_strm_unget_char, buf_strm_unget_byte, buf_strm_seek, buf_strm_truncate, buf_strm_get_prop, buf_strm_set_prop, buf_strm_get_error, buf_strm_get_error_str): New static functions. (buf_strm_ops): New static struct. (buf_strm): New static function. (make_buf_stream, get_buf_from_stream): New functions. (buf_init): Register new intrinsic functiions make-buf-stream and get-buf-from-stream. Call fill_stream_ops on new buf_strm_ops to fill default operations in place of function pointers that have been left null. * buf.h (make_buf_stream, get_buf_from_stream): Declared. * lisplib.c (with_stream_set_entries): Add with-out-buf-stream and with-in-buf-stream to auto-load symbols for with-stream.tl module. * share/txr/stdlib/with-stream.tl (with-out-buf-stream, with-in-buf-stream): New macros. * txr.1: New section about buffer streams.
* ffi: new buf-carray function.Kaz Kylheku2017-08-081-0/+18
| | | | | | | | | * ffi.c (buf_carray): New function. (ffi_init): Registered buf-carray intrinsic. * ffi.c (buf_carray): Declared. * txr.1: Documented.
* New divides function.Kaz Kylheku2017-08-071-0/+29
| | | | | | | | | * arith.c (divides): New function. (arith_init): Intrinsic registered. * arith.h (divides): Declared. * txr.1: Documented.
* Make len a synonym for length.Kaz Kylheku2017-08-071-1/+7
| | | | | | | * eval.c (eval_init): Register the same function under length and len. * txr.1: Documented.
* New spl and tok: variants of tok-str and split-str.Kaz Kylheku2017-08-071-0/+68
| | | | | | | | * eval.c (eval_init): Register spl and tok intrinsics. * lib.c (spl, tok): New functions. * txr.1: Documented.
* Add sum and prod convenience functions.Kaz Kylheku2017-08-051-0/+44
| | | | | | | | | | * eval.c (eval_init): prod and sum intrinsics registered. * lib.c (sum, prod): New functions. * lib.h (sum, prod): Declared. * txr.1: Documented.
* New functions digpow and digits.Kaz Kylheku2017-08-051-0/+90
| | | | | | | | | | | * arith.c (digcommon): New static function. (digpow, digits): New functions. (arith_init): New digpow and digits intrinsic functions registered. * arith.h (digpow, digits): Declared. * txr.1: New functions documented.
* Bi-directional string tree match for non-vars.Kaz Kylheku2017-08-021-0/+28
| | | | | | | | | | | | | | | | | | There is an inconsistency in @(bind) in that given @(bind x y) where x is a variable, both directions are tried for a string tree match. x could be tree of strings and y a string atom, or vice versa. But if x is just an atom, or a Lisp evaluation, then only one direction is tried. @(bind @(list "a" "b") "a") succeeds, but @(bind "a" @(list "a" "b")) fails. * match.c (dest_bind): Test both directions in the scalar and Lisp evaluated cases of the left hand side. Subject to compatibility, just in case. * txr.1: Compat note added.
* doc: aret description refers to ret.Kaz Kylheku2017-08-021-1/+1
| | | | | * txr.1: Fix description of aret, which wrongly refers to the ret macro.
* doc: explain qref and uref.Kaz Kylheku2017-08-021-6/+17
| | | | | * txr.1: Under the qref and uref operators, mention what these stand for and how the terminology is derived.
* doc: note about global symbol macros.Kaz Kylheku2017-08-021-0/+4
| | | | | * txr.1: Adding note that a symbol cannot be a global symbol macro and global variable at the same time.
* doc: missing formatting in qref equivalence.Kaz Kylheku2017-08-021-0/+2
| | | | | * txr.1: equivalence between .(qref ...) and (uref ...) now typeset properly in monospaced font.
* doc: mention listener in Lisp intro.Kaz Kylheku2017-08-021-4/+6
| | | | | | * txr.1: Remove clumsy "firstly, secondly, thirdly" because we need a "fourthly" which is too much. Intro now mentions that Lisp evaluation is also possible via the listener.
* doc: cross reference different #b.Kaz Kylheku2017-08-021-0/+13
| | | | | * txr.1: Note under #b binary number syntax that #b is also used for buffer literals, and vice versa.
* Evaluate doloop forms in an implicit tagbody.Kaz Kylheku2017-07-311-11/+21
| | | | | | | | | | 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.
* New macros doloop and doloop*.Kaz Kylheku2017-07-301-0/+164
| | | | | | | | | | * 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.
* 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.
* lib: deprecate set-diff; extend set operations.Kaz Kylheku2017-07-261-19/+98
| | | | | | | | | | | | | | * 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-191-2/+2
| | | | | | | | | | * 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.
* 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-191-0/+39
| | | | | | | | | | | | | | | | * 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.
* 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).
* new function: nthKaz Kylheku2017-07-181-0/+34
| | | | | | | | | | | | | | | | 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-181-0/+84
| | | | | | | | | * 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-171-7/+13
| | | | | | | | | | | | * 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-171-0/+58
| | | | | | | | | | | * 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-161-0/+4
| | | | | | | | | | * 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.
* ffi: add offset argument to ffi buffer functions.Kaz Kylheku2017-07-161-4/+18
| | | | | | | | | | | | | * 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!
* format: support leading zero printing for floats.Kaz Kylheku2017-07-161-1/+14
| | | | | | | | | | | | | | | 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-161-14/+12
| | | | | | | | | | | | | | 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.
* carray: add offset to carray-buf.Kaz Kylheku2017-07-151-4/+28
| | | | | | | | | | | | | | * 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.
* New :lists feature in @(collect)/@(coll).Kaz Kylheku2017-07-111-0/+18
| | | | | | | | | | | | | | | | | | | 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.
* Version 182.txr-182Kaz Kylheku2017-07-091-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim, protsym.c: Regenerated.
* doc: fix structure of section on compatibility.Kaz Kylheku2017-07-091-4/+4
| | | | | | * txr.1: the sections following the Overview were wrongly subordinated to Overview. They are now on the same level.
* ffi: new function, zero-fill.Kaz Kylheku2017-07-091-1/+33
| | | | | | | | | * ffi.c (zero_fill): New function. (ffi_init): zero-fill intrinsic registered. * ffi.h (zero_fill): Declared. * txr.1: Documented.
* structs: improve access to initfun and postinitfun.Kaz Kylheku2017-07-091-2/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In this change, a struct type's initfun and postinitfun become mutable. This is achieved by modeling them as the pseudo-static-slots :initfun and :postinitfun. Effectively these now behave as reserved names which do not denote static slots but these special functions. * eval.c (lookup_fun): When (meth type slot) syntax is encountered, treat the slot names :init and :postinit specially: retrieve these special functions instead of accessing static slots. * share/txr/stdlib/place.tl (sys:get-fun-getter-setter): Similarly, when handling (meth type slot) syntax, return the alternative getter/setter functions for the special functions, not the static slot accessing functions. Also, getting rid of a useless @1 here in existing code, since (op foo @1) is equivalent to (op foo). * share/txr/stdlib/struct.tl (sys:defmeth): Check for the special names :init and :postinit, handling these through the appropriate setter functions rather than static-slot-ensure. * struct.c (init_k, postinit_k): New keyword symbol variables. (struct_init): Initialize init_k and postinit_k. Register intrinsics struct-get-initfun, struct-set-initfun, struct-get-postinitfun and struct-set-postinitfun. * (struct_get_initfun, struct_set_initfun, struct_get_postinitfun, struct_set_postinitfun): New functions. (method_name): For each struct type visited, check whether the function is the initfun or postinitfun and return the appropriate meth syntax if so. * struct.h (init_k, postinit_k, struct_get_initfun, struct_set_initfun, struct_get_postinitfun, struct_set_postinitfun): Declared. * txr.1: Documented. Updated description of method-name, defmeth, and documented new functions.
* doc: missing word in compat note 165.Kaz Kylheku2017-07-091-1/+1
| | | | * txr.1: The word was "change" is missing in the sentence.
* doc: fix compat note 156.Kaz Kylheku2017-07-091-5/+14
| | | | | | | | | | * txr.1: Fix a flaw in the compat note 156 wording. The workaround described only applies to TXR that has not been upgraded to 157 or newer; it is not an alternative to using the compat option, but a way to fix code under old TXR. Also adding here the recommendation that applications should switch to the new evaluating case functions rather than relying on the compat switch.
* doc: make-struct-type postinitfun: outdated text.Kaz Kylheku2017-07-091-9/+11
| | | | | | | | * txr.1: Replace description of make-struct-type's postinitfun argument which was still claiming that the calls are in opposite order relative to initfun calls. That changed after TXR 148 but was documented only for defstruct. Also updating the compat note for 148.