| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (lazy_str_get_trailing_list): Remove the spurious
empty string caused by splitting on the terminator.
Whenever the materialized prefix is not-empty, and there is
a non-empty terminator, the prefix necessarily ends in the
termintator. If we split on the terminator, the list of pieces
ends in in an empty string, which is undesirable.
This has to be subject to compat, unfortunately; it's a
very visible behavior that affects the continuation of
line-based matching after the @(freeform) directive.
* tests/006/freeform-5.txr: With this fix, we no longer have
to match the spurious blank line coming from @(freeform).
* tests/015/lazy-str.tl: New file.
* txr.1: Updated documentation with compat notes. There was
some outright incorrect text describing
lazy-str-get-trailing-list. Also, the lazy-str-force-upto
and lazy-str-force were under-documented. The return value of
the former was not completely described: that it returns t
in the other case when not returning nil. It wasn't mentioned
that the functions observe the limit-count. Moreover, the
exact algorithm for forcing is now documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_type_copy): Function moved earlier in file
without change.
(ffi_type_copy_new_ops): New stati function.
(make_ffi_type_enum): Do not create a new type object using
cobj; copy the existing base_type, and then tweak its
properties, just like what is done with bool. Thus if
base_type is a bitfield, the enum will be a bitfield.
Add check against doign this to anything but an FFI_KIND_NUM,
with the awareness that this does include floating-point types.
Since tft is now a copy, we no longer have to copy a number of
things from btft. We do set he kind field to FFI_KIND_ENUM.
(ffi_type_compile): In the two bitfield cases, we now
calculate the mask field for the bitfield type (leaving the
shift at zero). The struct or union type into which the
bitfield is embedded will still re-calculate this.
The reason is that when an (enumed (bit ...) ...) type is
defined, it constructs hash tables for converting between the
symbolic and numeric values. It calls the put function of the
underlying type to test whether each enumeration value can be
converted (i.e. is in range). So the bitfield type must have a
valid mask at that time, or else it will reject every nonzero
value as being out of range for the bitfield. I'm also
replacing the max_int variable with bits_int. Since bitfields
are restricted to no wider than int, why pretend?
* tests/017/ffi-misc.tl: New test cases.
* txr.1: Documented.
|
|
|
|
|
|
| |
* txr.1: Fix sme -> same. This creeps in because "sme" is
whitelisted due to the @(sme ...) pattern notation
(start/middle/end).
|
|
|
|
|
| |
* txr.1: Remove spurious car place syntax from syntax section
of key, left and right functions.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure (txr_ver): Bumped version.
* stdlib/ver.tl (lib-version): Bumped.
* txr.1: Bumped version and date.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
| |
* txr.1: New section about special variable
*struct-clause-expander*.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
| |
* txr.1: In description of *match-macro* fix stray copy-paste
referring to *place-macro*.
|
|
|
|
|
|
|
|
|
| |
* stdlib/match.tl (expand-quasi-match): Add regex cases with
bound variable.
* tests/011/patmatch.tl: Test cases for this.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* txr.1: Fix wrong word and number agreement: the sentence is
about boudn variables. Fix bungled description of bound
variable substitution; this should be a .meIP to head its own
section, not in line meta-typesetting; plus the syntax must
refer to a {P} and show the backticks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (h_var): Refactor the logic here a bit. Without
regard for whether the variable has a value, we dispatch the
regex, fixed field and function cases. These handle the
binding against the existing value. Then before all other
cases, we check for the existing value and convert that to a
literal text match. The effect of this is that now the regular
expression is processed even if the variable has a value.
* tests/010/span-var.txr: Last two test cases hardened a bit
so they cannot fall through to a successful exit, if
they invoke the wrong case. This is not related to this
change. New test cases for regex span.
* txr.1: Updated documentation and compatibility notes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (h_var_compat): New function; verbatim copy
of existing h_var prior to this commit.
(h_var): If a variable has an existing binding, but
is a function spanning match, do not substitute it with text.
Handle it with the ordinary case, in which we now use
dest_bind instead of cons.
(v_var): Similarly, here, we must also use dest_bind, rather
than always freshly binding the variable.
(match_compat_fixup): For 272 compatibility, substitute
h_var_compat for h_var in the horizontal directive table.
* tests/010/span-var.txr: New test cases.
* txr.1: Documentation updated and also improved overall.
The behavior when a variable has an existing value is
clarified for the regex and fixed field case.
Also update and condense compat notes for 272.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (v_var_compat, v_var): New static functions.
(match_files): No longer recognize v_var specially; it is now
handled via vertical table.
(dir_tables_init): Register a vertical sys:var directive also
via v_var function.
(match_compat_fixup): New function.
* txr.c (compat): Call match_compat_fixup.
* tests/010/span-var.txr: New file.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With :mass-delegate, it is possible to generate delegation
methods in bulk. All of the methods of a struct type can be
mirrored by delegates in another struct type just by writing
a single :mass-delegate clause.
* stdlib/struct.tlk (:mass-delegate): New struct clause macro.
* tests/012/oop.tl: New tests.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (struct_set_entries): Trigger autoload on new
symbols define-struct-clause and *struct-clause-expander*.
* stdlib/struct.tl (*struct-clause-expander*): New variable.
(defstruct): expand-slot local function now returns list of
expanded slots, not a single slot; every case in the tree-case
is converted to return a list. The syntax of a slot clause is
first expanded through *struct-clause-expander hash; if that
works then the resulting list is further scanned for
expansions.
(define-struct-clause): New macro.
(:delegate): New struct clause defined with
define-struct-clause. Provides single-slot delegation.
* tests/012/oop.tl: Tests for :delegate.
* txr.1: Documented define-struct-clause and :delegate.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register pairlis intrinsic.
* lib.c, lib.h (pairlis): New function.
* tests/012/seq.tl: New test cases.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register new intrinsics.
* lib.c, lib.h (subq, subql, subqual, subst): New functions.
* tests/012/seq.tl: New test cases.
* stdlib/optimize.tl (subst): Function removed. The new subst
drop-in replaces this one.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/arith-each.tl (sys:vars-check): New function, copy
and pasted from each-prod.tl.
(sys:arith-each): New macro.
(sum-each, sum-each*, mul-each, mul-each*): Reworked using
sys:arith-each macro. This macro uses logic borrowed from
a stripped-down expand-each in the compiler.
* stdlib/each-prod.tl (sys:expand-each-prod,
sys:expand-arith-each-prod*): Add the block nil around the
mapping call, taking care that the initialization forms
are evaluated outside of the block, and their values bound to
gensyms that then form the function arguments.
* txr.1: Document the missing requirements for all the
affected macros that there must be an anonymous block around
the body, which, if used, determines the return value.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (tree_min_node, tree_min, tree_del_min_node,
tree_del_min): New functions.
(tree_init): tree-min-node, tree-min, tree-del-min-node,
tree-del-min: New intrinsics registered.
* tree.h (tree_min_node, tree_min, tree_del_min_node,
tree_del_min): Declared.
* txr.1: Documented.
* tests/010/tree.tl: New tests.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (tr_insert): New argument for allowing duplicate.
If it is true, suppresses the case of replacing a node,
causing the logic to fall through to traversing right, so the
duplicate key effectively looks like it is greater than the
existing duplicates, and gets inserted as the rightmost
duplicate.
(tr_do_delete_specific, tr_delete_specific): New static functions.
(tree_insert_node): New parameter, passed to tr_insert.
(tree_insert): New parameter, passed to tree_insert_node.
(tree_delete_specific_node): New function.
(tree): New parameter to allow duplicate keys in the elements
sequence.
(tree_construct): Pass t to tree to allow duplicate elements.
(tree_init): Update registrations of tree, tree-insert and
tree-insert-node. Register tree-delete-specific-node function.
* tree.h (tree, tree_insert_node, tree_insert): Declarations
updated.
(tree_delete_specific_node): Declared.
* lib.c (seq): Pass t argument to tree_insert, allowing
duplicates.
* parser.c (circ_backpatch): Likewise.
* parser.y (tree): Pass t to new argument of tree, so
duplicates are preserved in the element list of the #T
literal.
* y.tab.c.shipped: Updated.
* tests/010/tree.tl: Test cases for duplicate keys.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (tree_count): New function.
(tree_init): tree-count intrinsic registered.
* tree.h (tree_count): Declared.
* lib.c (length): Support search tree argument via tree_count.
* tests/010/tree.tl: Test cases for tree-count, indirectly via len.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* txr.1: Adding the missing requirement that each-match
and the other macros in that family must have an implicit
anonymous block around the body forms. This is a requirements
bug, effectively: the programmer expects these operators to be
consistent with the each operator, as part of the same family.
* match.tl (each-match-expander): Implement the requirement.
Since we are using mapping functions, we must use temporary
variables: the evaluation of the expressions which produce the
sequence argument values to the mapping functions must be
outside of the anonymous block. The block must surround only
the function call.
* tests/011/patmatch.tl: Add small test case covering this.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): nrot, rot intrinsics registered.
* lib.c (nrot, rot): New functions.
* lib.h (nrot, rot): Declared.
* tests/012/seq.tl: New test cases.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/op.tl (ret, aret): Simplify implementation, without
progn or @rest, or interpolation of multiple args.
We use identity* to allow the resulting function to
allow and ignore multiple arguments.
* txr.1: Strangely, an an edit in commit 99131c676,
on Sep 26, 2014, reverted the more accurate equivalence
(ret x) <--> (op identity (progn @rest x))
back to the original documentation
(ret x) <--> (op identity x)
which matched an older implementation. Anyway, that's moot
now; the documentation is updated to give the new equivalence
via identity*.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register tuples* intrinsic.
* lib.c (tuples_star_func): New static function.
(tuples_star): New function.
* lib.h (tuples_star): Declared.
* tests/012/seq.tl: New test cases.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
| |
* stdlib/getput.tl (file-get-buf, command-get-buf): If the
number of bytes to read is specified, we use an unbuffered
stream. A buffered stream can read more bytes in order to
fill a buffer, which is undesirable when dealing with a
device or pipe.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (randbox, hash_c_str, hash_buf): Separate
implementation for 64 bit pointers, using 64 bit random
values, and producing a 64 bit hash, taking in a 64 bit seed.
(gen_hash_seed): Use time_sec_nsec to get nanoseconds.
On 64 bit, put together the seed differently to generate
a wider value.
* tests/009/json.txr: Change from hash tables to lists,
so the order of the output doesn't change between 64 and 32
bits, due to the different string hashing.
* tests/009/json.expected: Updated.
* txr.1: Documented that seeds are up to 64 bits, but
with possibly only the lower 32 bits being used.
|
|
|
|
|
| |
* txr.1: Fix bunch of instances of formatting like << foo)
which should be << foo ).
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure (txr_ver): Bumped version.
* stdlib/ver.tl (lib-version): Bumped.
* txr.1: Bumped version and date.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
| |
* txr.1: The syntax synopsis for the hash function neglects
to mention the :weak-or and :weak-and symbols.
|
|
|
|
|
|
| |
* txr.1: The hash construction keyword is :weak-vals;
the keyword :weak-values is not recognized, yet mentioned
in three places in the documentation.
|
|
|
|
|
| |
* txr.1: The gensym function's argument doesn't have to be a
string. Plus other wording fixes.
|
|
|
|
|
|
|
|
| |
* txr.1: Fix spelling errors that have crept in due to
read-once and the quasiliteral fixes to matching.
* stdlib/doc-syms.tl: Forgotten refresh, needed by the
fix to the wrong random-float-inc name.
|
|
|
|
|
|
| |
* tests/011/patmatch.tl: Add failing test cases.
* txr.1: Document desired requirements.
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/ifa.tl (ifa): When the form bound to the it
anaphoric variable is a place, such that we use placelet,
wrap the place in (read-once ...) so that multiple
evaluations of it don't cause multiple accesses of the
place.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (place_set_entries): Trigger autoload on
read-once.
* stdlib/place.t (read-once): New function and place.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This function includes the 1.0 value excluded by random-float.
* rand.c (random_float_incl): New static function.
(rand_init): Register random_float_incl intrinsic.
* txr.1: Document, and add discussion about uniformity requirements
and what they mean and do not mean.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ff_cptr_in, ffi_carray_in): New static functions.
(ffi_type_compile): Wire in new functions for dynamically
compiled cptr and carray types.
(ffi_init_types): Also, wire in ffi_cptr_in function for
the non-parametrized cptr type.
(carray_set_ptr): New function.
* ffi.h (carray_set_ptr): Declared.
* txr.1: Documented.
|
|
|
|
|
|
| |
* txr.1: Document the parenthesized pattern notation for
obtaining a negative number with parentheses. Also putting the
escape syntax first, because it's a short section.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* pic.tl (expand-pic-num): If the overflowing field specifies
a decimal point other than in the rightmost position, then
stick one into the fill pattern. The motivation for this is
that it harmonizes with the digit separators. The new digit
separator insertion logic will treat the # characters like
digits, and requires the embedded decimal in order to work
properly. Allowing digit separation to work in the fill
pattern will make for better looking output in column
displays. That's the same reason why we insert digit
separators among leading zeros.
* tests/018/format.tl: Overflow test cases updated in
light of this requirement change.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows for pic patterns like #,###,###.###
which incorporate digit separating commas into the output.
* stdlib/pic.tl (comma-positions, insert-commas,
expand-pic-num-commas): New system functions.
(expand-pic): Recogize comma as a character which can be
escaped using the tilde. Recognize a more complicated numeric
pattern with commas. If the matched token contains commas,
treat it using expand-pic-num-commas.
(pic): Propagate a copy of the new numeric pattern here, where
it is used for separation into tokens.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a basic read/print consistency problem. When a symbol
is printed that is anywhere in the fallback list of the
current package, we are dumping it unqualified, even if
it is hidden by a same-named symbol in the current package
itself or such a symbol occurring earlier in the fallback
list.
* lib.c (symbol_needs_prefix): When the to-be-printed symbol
is found in the fallback list, re-scan the current package
for a symbol having the same name, as well as the preceding
nodes in the fallback list. If such a symbol is found, then
the to-be printed symbol must be package-qualified.
* tests/012/syms.expected: New file.
* tests/012/syms.tl: Likewise.
* tests/012/compile.tl: Pull syms into compile job.
* txr.1: Clarify text about this. The existing text's
only reasonable interpretation supports the behavior which
this patch ensures (which is needed on grounds of read/print
consistency) but the text lacks precision.
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (copy_file_set_entries): Add path-equal to autoload symbols.
* stdlib/copy-file.tl (path-equal): New function.
* tests/018/path-equal.tl: New file.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure (txr_ver): Bumped version.
* stdlib/ver.tl (lib-version): Bumped.
* txr.1: Bumped version and date.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/awk.tl (sys:awk-compile-time): Slot field-names renamed to
field-name-conv.
(sys:awk-expander): Parse the new syntax which allows (sym fn)
pairs with optional fn, creating a list of normalized items
in the field-name-conv slot of the compile-time structure.
(sys:awk-symac-let): Adjust the code to the pair representation in
field-name-conv.
(sys:awk-field-name-code): New function for generating the
field conversion code.
(awk): Now that we have two optional pieces of code to wrap around
p-actions form, we factor that out of the awk-lambda, to a series
of conditional assignments. Here we handle the generation of the
field conversionns.
* conv.tl (sys:conv-expand-sym): New macro, used in
sys:awk-field-name-code and sys:conv-let.
(sys:conv-let): Simplify with sys:conv-expand-sym. Drop optional
argument from i; it connects with no documented feature, and is
not usable from fconv.
* tests/015/awk-fields.tl: New tests.
* txr.1: Updated, including cruft in fconv documentation.
Change-Id: Ie42819f58af039fdbcdb1ae365c89dc1add55c93
|
|
|
|
| |
* txr.1: Fix typos and stylistic issues.
|
|
|
|
|
|
|
| |
* txr.1: fill-array -> fill-carray, put-array -> put-carray.
Refer to fill-buf and put-buf with .code (or .codn). Use .code
when referring to a carray object rather than an argument called
carray.
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (cptr_carray): New function.
(ffi_init): Register cptr-carray intrinsic.
* ffi.h (cptr_carray): Declared.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/awk.tl (sys:awk-compile-time): New slot, field-names.
(sys:awk-expander): Validate and store field-names into compile-time
structure.
(sys:awk-symac-let): New macro.
(awk): Wrap sys:awk-symac-let around code to generate field
name macros.
* tests/015/awk-fields.tl: New file.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This specifies the environment to be used for executing
programs.
* stream.c (open_subprocess, run): Check *child-env* variable and if
other than t, then install the environment before execvp.
In the spawn-based version of run, we save and restore the
environment around the spawn call, if *child-env* is in
effect.
* sysif.c (child_env_s): New symbol variable.
(exec_wrap): If *child-env* is other than t, then save the
environment in a list, and install the specified environment
before calling execvp. If that function returns, restore the
environbment.
* sysif.h (child_env_s): Declared.
(child_env): New macro.
* tests/018/process.tl: New tests.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Using this new function together with env, it's now possible
to save the set of environment variables, clobber it to a
specified set (possibly empty) and then restore it.
Useful for improved security in running child processes.
* lib.[ch] (chk_substrdup_utf8): New function.
* sysif.c (replace_env): New function.
(sysif_init): Register replace-env intrinsic.
* sysif.h (replace_env): Declared.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|