| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
| |
This is a left-argument-inserting syntactic sugar for do.
* lisplib.c (op_set_entries): Add auto-load entry for ldo.
* share/txr/stdlib/op.tl (ldo): New macro.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It was reported by astute user vapnik spaknik that the
documentation says thing about the do operator which are
not actually true in the implementation. I've decided that
one of them should be true, and so both implementation
and documentation are changing.
The documentation claims that (do set x) will produce
a function that can be called with one argument; that
argument will be assigned to x. That doesn't work, but this
commit will make it work.
The documentation has this example transformation:
(do + foo) -> (lambda rest (+ foo . rest))
that cannot be made to work because do works with macros
and special operators to which arguments can't be dynamically
applied. This patch will not make the above work; instead
the example is corrected.
How do is going to work inow is that (do sym ...) syntax in
which no implicit variables appear will be equialent
to (do sym ... @1). The generated variadic function has one
required argument which is implicitly added to the syntax.
Obviously, that only works if that positon of the syntax
is an evaluated form or place.
Values of the -C option equal to 225 or less will restore
the old do behavior.
* share/txr/stdlib/op.tl (sys:op-expand): Support the new
style of do, subject to backward compatibility. A hack is
required here. We cannot discover the @1, @2 .. variables
in the syntax until we fully expand it. But that code walk
requires the syntax to be valid. For instance if (do set x) is
specified, with the expectation that it is equivalent to
(do set x @1), we cannot process that by code walking (set x).
(set x) is invalid syntax. What we do is to *try* expanding
it as (set x). If that doesn't work, we add a dummy gensym
to the form to produce (set x #:gNNNN) and try expanding that.
In that case, rather than adding @1 to the form, we replace
the dummy gensym with @1. The algorithm is careful not to
accidentally conceal real syntax errors in the form.
If the form without the dummy gensym fails to expand, and
the one with the dummy gensym expands fine but contains
references to implicit parameters (@1, @2, ... @rest),
we expand it again without the gensym and allow the error
to propagate. Other aspects of this change are fairly trivial.
Because the do logic possibly introduces a @1 that doesn't
exist, near the end of this function we have to bind another
metas variable which has an up-to-date copy of the gens slot.
(op-ignerr): New macro; we can't use ignerr because that
will create a bootstrapping cycle; ignerr expands to catch,
and the catch macro uses do. Wrapping this in eval-only,
since we don't need an op-ignerr macro in the compiled image.
* txr.1: Documentation revised and updated. Differences
between do and op put clarified and put into point form.
Bad do examples corrected. Syntax of do now shown as having
a required parameter that is an operator. Compat notes added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register intrinsic functions
fun-fixparam-count, fun-optparam-count, fun-variadic.
* lib.c (get_param_counts): New static function.
(fun_fixparam_count, fun_optparam_count, fun_variadic): New
functions.
* lib.h (fun_fixparam_count, fun_optparam_count,
fun_variadic): Declared.
* txr.1: Documented.
|
|
|
|
|
| |
* txr.1: Add discussion about endinanness to Bitfield
Allocation Rules for completeness.
|
|
|
|
|
| |
* txr.1: Subject-verb number agreement; also removing
superfluous adverb.
|
|
|
|
|
|
|
| |
* buf.c (make_owned_buf, buf_str, str_buf): New functions.
(buf_init): buf-str and str-buf intrinsics registered.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* txr.1: Document athat the read-until-match, scan-until-match
and count-until-match functions leave the stream position in
an unspecified state, since the position returned by
seek-stream doesn't take into account push-back characters.
|
|
|
|
|
|
| |
* txr.1: The descriptions of file-get-buff, command-get-buf,
file-put-buf, file-append-buf and command-put-buf are
relocated from FFI area to Buffers where they belong.
|
|
|
|
| |
* txr.1: Fix two instances of bungled method name meta-syntax.
|
|
|
|
| |
* txr.1: Document that #H() requires the parentheses.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register copy-tree intrinsic.
* lib.c (copy_tree): New function.
* lib.h (copy_tree): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* lib.c (copy_cons): Rewrite to copy the object in a more
low-level way, rather than going through the accessors
and constructors. Now copies LCONS as LCONS, including its
update function.
* txr.1: copy-cons re-documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (copy): Handle tree objects via copy_search_tree.
* tree.c (deep_copy_tnode): New static function.
(copy_search_tree): New function.
(tree_init): copy-search-tree intrinsic registered.
* tree.h (copy_search_tree): Declared.
* txr.1: Documented copy-search-tree, and copy function's use
thereof.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (defset_set_entries): Autoload entries for left,
right and key.
* share/txr/stdlib/defset.tl (left, right, key): New
simple-form defsets.
* tree.c (set_left, set_right, set_key): New functions.
(tree_init): Register intrinsics set-left, set-right and
set-key.
* tree.h (set_left, set_right, set_key): Declared.
* txr.1: key, left and right classified as accessors.
Documented set-key, set-left and set-right.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (copy): Handle TNOD casee via copy_tnode.
* tree.c (copy_tnode): New function.
(tree_init): copy-tnode intrinsic registered.
* tree.h (copy_tnode): Declared.
* txr.1: copy function documented as handling tnode type via
copy-tnode. That function is documented.
|
|
|
|
|
|
|
|
|
| |
* tree.c (tree_delete): Renamed to tree_delete_node.
(tree_delete): New function which returns element
rather than node.
(tree_root): Registered tree-delete-node intrinsic.
* txr.1: Documented.
|
|
|
|
|
|
| |
* txr.1: Documenting #T and #N literals, and the associated
functions and special variable. The yype hierarchy graph is
updated with the new types.
|
|
|
|
|
| |
* txr.1: Add hash-iter into type hierarchy diagram
under [cobj types].
|
|
|
|
|
|
| |
* txr.1: the :eq-based keyword and its semantics is
documented, along with its mutual exclusion against the other
two.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Within the op syntax, the new implicit variable @rec
now refers to the function itself. There is also @(rec ...)
for calling the function through a function binding.
For instance, here is Fibonacci:
(do if (> @1 1) (+ @(rec (pred @1)) @(rec (ppred @1))) 1)
* share/txr/stdlib/op.tl (sys:op-ctx): New slots rec and
recvar.
(sys:op-rec-p, sys:op-ensure-rec): New functions.
(sys:op-alpha-rename): Check for the new syntaxes and
translate to appropriate gensymed expressions, while updating
the context structure, so the expander is informed about
the @rec or @(rec ...) activity in the expression.
(sys:op-expand): Check whether @rec or @(rec ...) has
been used in the expression, and generate the necessary
variants to support it. We need to bind the lambda to a
recursive binding using the same mechanism that labels
uses, and possibly to bind the gensym underneat @rec
to the value of that function binding.
* txr.1: op documentation extended to cover the new
feature, plus some wording improvements.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (lookup_fun): Check for a lambda expression and
return a faked binding containing the interpreted function.
(do_eval, op_fun): Remove checks for lambda that are now
being done in lookup_fun. In many other places where
lookup_fun is used, we still need lambda checks, like
in the expander.
* share/txr/stdlib/place.tl (sys:get-fun-getter-setter): Take
form argument. Diagnose assignments to lambda, and to unknown
function place syntax.
(defplace symbol-function): Pass sys:*pl-form* to
sys:get-fun-getter-setter as form argument.
* txr.1: fboundp and symbol-function doc updated.
|
|
|
|
|
|
|
|
| |
* lib.c (less_tab_init): Assign category 6 to BUF type, so
buffers are sorted after other types.
(less): Add BUF case.
* txr.1: Documented.
|
|
|
|
| |
* txr.1: Fix "a eval-only" in definition of top-level form.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rewriting be addition, pending and nconcing methods of
list-builder to avoid loops and rely on lower list processing
functions. This cleans up the semantics and error messages.
Some examples of behavioral changes:
(build (pend "abc") (add #\d)) now returns "abcd",
consistent with (append "abc" '(#\d)).
Previously it returned '(#\d).
(build (add 1) (pend 2) (pend 3)) now produces a "cannot
append to 2" error.
Previously it produced "copy: cannot copy object of type fixnum".
* share/txr/stdlib/build.tl (list-builder add): Don't use
copy-list; rather the idiom for copying a sequence in
preparation for appending to it is (append x nil). This will
blow up nicely if x is an atom other than nil. We use
this trick twice.
(list-builder add*): Simplify with append.
(pend, pend*, ncon): Rewrite.
(ncon*): Use nconc once on a combined argument list: this is
borrowed from the rewritten pend*.
* txr.1: Documentation updated with clarifications,
particularly in the area of the requirements regarding
destructive manipulation and substructure sharing.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (subtypep): For the sequence supertype, check
whether the subtype is a structure that has a length or
car method, returning t if so.
* struct.c (get_special_slot_by_type): New function.
* struct.h (get_special_slot_by_type): Declared.
* txr.1: Add <structures with cars or length methods> to the
type hierarchy diagram.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_flex_struct_in): Use get_special_slot to obtain
length method.
* lib.c (nullify_s, from_list_s, lambda_set_s): Definitions
removed from here.
(seq_info, car, cdr, rplaca, rplacd, make_like, nullify,
replace_obj, length, empty, sub, ref, refset, dwim_set): Use
get_special_slot to obtain special method from object,
rather than maybe_slot.
(obj_init): Remove initializations of nullify_s, from_list_s
and lambda_set_s from here.
* struct.c (enum special_slot): Definition removed from here.
(nullify_s, from_list_s, lambda_set_s): Definitions moved here
from lib.c.
(special_sym): New static array.
(struct_init): Initializations of nullify_s, from_list_s
and lambda_set_s moved here from lib.c.
(get_special_slot): New function.
* struct.h (lambda_set_s): Declared.
(enum special_slot): Definition moved here.
(get_special_slot): Declared.
* txr.1: Added compat note, since get_special_slot behaves
like maybe_slot under 224 compatibility.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register tailp intrinsic.
* lib.c (tailp): New function.
* lib.h (tailp): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TXR user vapnik spaknik has found a swath of errors in the
documentation.
* txr.1: Fixed bugs in numerous examples, copy-and-paste
errors in syntax sections, and other typos, including *stdin*
mistyped as *std-input* in many places. A new executable code
example is provided for expand-with-free-refs to calculate the
result that was previously only verbally described. Fixed
*stdin* mistyped as *std-input* (a non-existent symbol that
imitates the internal C variable).
|
|
|
|
| |
* txr.1: Hyphenate "heap-allocated" and "stack-allocated".
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
| |
* chksum.c (sha256_utf8_byte_callback, md5_utf8_byte_callback):
New static functions.
(sha256_hash, md5_hash): Support character and integer
objects.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* chksum.c (sha256_ctx_s, md5_ctx_s): New symbol variables.
(sha256_ops, md5_ops): New static structs.
(sha256_begin, sha256_hash, sha256_end, md5_begin, md5_hash,
md5_end): New functions.
(chksum_init): New symbol variables initialized; sha256-begin,
sha256-hash, sha256-end, md5-begin, md5-hash, md5-end
intrinsics registered.
* chksum.h (sha256_begin, sha256_hash, sha256_end, md5_begin,
md5_hash, md5_end): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile (OBJS): New object file, chksums/md5.o.
* chksum.c (sha256_ensure_buf): Renamed to chksum_ensure_buf
and made generic so MD5 code can borrow it.
(sha256_stream, sha256): Call chksum_ensure_buf instead of
sha256_ensure_buf, passing in new length and hash name
parameters.
(md5_stream_impl, md5_buf, md5_str): New static functions.
(md5_stream, md5): New functions.
(chksum_init): Register md5-stream and md5 intrinsics.
* chksum.h (md5_stream, md5): Declared.
* chksums/md5.c, chksums/md5.h: New files.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register cptr-buf intrinsic.
* lib.c (cptr_buf): New function.
* lib.h (cptr_buf): Declared.
* txr.1: Documented.
|
|
|
|
|
|
| |
* txr.1: Include blurb about the independent lifetime of a
ctpr made by cptr-obj and the original object.
If the original is garbage collected, the ctpr is junk.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To accompany find-symbol-fb, there is intern-fb, which is like
intern, but searches the fallback list.
* eval.c (eval_init): Register intern-fb intrinsic.
* lib.c (intern_fallback_intrinsic): New function. Does
defaulting and error checks, then calls intern_fallback, just
like intern_intrinsic calls intern.
* lib.h (intern_fallback_intrinsic): Declared.
* txr.1: Documented.
|
|
|
|
|
| |
* txr.1: name must be a string, not a symbol. The optional
argument must be a package, if supplied.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Turns out, there is already a find_symbol in lib.c, completely
unused.
* eval.c (eval_init): Register find-symbol and find-symbol-fb
intrinsics.
* lib.c (find_symbol): Fix this hitherto unused function to do
correct defaulting of the package argument and, to accept an
additional argument specifying the not-found value.
(find_symbol_fb): New function.
* lib.c (find_symbol): Declaration updated.
(find_symbol_fb): Declared.
* txr.1: Documented.
|
|
|
|
|
| |
* txr.1: Adding breadth-first traversal example showing queue
capability of the list-builder.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/build.tl (list-builder): Methods add, add*,
pend, pend*, ncon and ncon* return nil.
* txr.1: Updated documentation to state that these methods
return nil, rather than an unspecified return value.
Improvements in build macro documentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (build_set_entries): Add buildn for autload, and
intern del and del* symbols.
* share/txr/stdlib/build.tl (list-builder): New methods del
and del*.
(sys:list-builder-flets): Generate flet for del*.
(sys:build-expander): New function, consisting of expansion
logic previously in build function. Macrolet added for del.
(build): Call sys:build-expander.
(buildn): New macro.
* txr.1: Documented.
|
|
|
|
|
|
| |
* txr.1: Add discussion highlighting use of load-time for
effect staging, rather than value. Add rationale regarding the
naming difference from ANSI CL.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (usr:compile-file): recognize
sys:load-time-lit as a top-level form and recurse through to
compiling its constituent form. We check the flag whether the
syntax had already been processed by the evaluator, though
that currently cannot possibly happen for a form that has just
been parsed from a file by compile-file itself.
* txr.1: Defintion of top-level form (from compile-file POV)
updated. Documentation of load-time updated.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The @(collect) directive disallows the situation when
there are required vars, but some are missing (not bound
by the collect body). However, the special case is allowed
when none of the required variables are bound; that
doesn't trigger the exception. There is a poor specification
in this area: the issue is that when there are optional
variables, and all variables are missing (optional and
required), the optional ones are still bound to their
default values. Thus, the situations is half-baked: some of
the :vars are bound and some are not. This violates the
all-or-nothing principle of :vars.
This patch addresses the poor specification: if all variables
are missing, then the optional variables are not bound to
their defaults.
* match.c (h_collect, h_coll): Detect the situation when at
least one variable is required, and all optional variables are
defaulted. In this case, don't propagate any bindings to the
collected lists.
* txr.1: Doc updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The base-name function now takes a second argument which is
optional, specifying a suffix to be removed. The behavior is
similar to that of the second argument of the POSIX basename
command.
* stream.c (base_name): Second argument added. If present, the
returned value is adjusted by trimming the suffix, unless that
would cause an empty string to be returned.
(stream_init): Update registration of base-name intrinsic.
* stream.h (base_name): Declaration updated.
* txr.1: New base-name parameter documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
| |
* txr.1: Document existing gensym behavior of nil struct/union tags.
Document new rules regarding structs/unions that have no
members, redefinitions of complete and incomplete types, and
semantics of self-reference.
|
|
|
|
|
|
| |
* txr.1: Use backslash escape in the save-exe example to break
up long string literal, so it won't be wrapped by man at 80
columns.
|