| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (enum tree_iter_state): New iterator state
tr_find_low_prepared dedicated to the tree-begin-at traversal.
This state indicates that tree-next should visit the starting
node that it is given, and then after that, treat anything to
the left of it as having been visited. In the other states,
tree-next does not visit the node it is given but uses it as
the starting point to find the next node.
(tn_find_next): Bugfix here: when navigating the right link,
the function neglected to add the node to the path. But the
logic for backtracking up the path expects this: it checks
whether the node from the path is the parent of a right child.
Somehow this didn't cause a problem for full traversals with
tree-begin; at least the existing test cases don't expose an
issue. It caused a problem for tree-begin-at, though.
(tn_find_low): New static function. This finds the low-key
node in the tree, priming the iterator object with the correct
state and path content to continue the traversal from that
node on . We need the tr_find_low_prepared state in the
iterator in order to visit the low node itself that was found.
(tree_begin_at): New function.
(tree_init): Register tree-begin-at intrinsic.
* tree.h (tree_begin_at): Declared.
* tests/010/tree.tl: New test cases for tree-begin-at.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
| |
* tests/010/tree.tl: New tests, broadening coverage.
* share/txr/stdlib/doc-syms.tl: Regenerated.
|
|
|
|
| |
* txr.1: Fix tree-insert being under tree-insert-node heading.
|
|
|
|
|
|
|
| |
* tree.c (tn_lookup): The right case is incorrectly
chasing the left pointer.
* tests/010/tree.tl: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The tree module doesn't observe generational GC correctness;
it assigns objects into other objects using ordinary
assignment.
* tests/010/tree.tl (tree_iter): New member, tree.
This is initialized to null for iterators on the stack.
dynamic iterator, we need this to be a back-pointer to the
dynamic iterator.
(tree_iter_init): Add parameter to initializer to set up the
back-pointer.
(set_left, set_right, set_key): Use set macro instead of
ordinary assignment.
(tn_find_next): Use set macro to add node to path.
(tn_flatten, tn_build_tree): Use set macro.
(tr_rebuild, tr_rebuild_scapegoat, tr_insert, tr_do_delete),
tr_delete): Use set macro. Take a tree argument so we can use
set macro on tr->root.
(tree_insert): Use set macro. Pass 0 to tree_iter_init
initializer macro.
(tree_delete_node): Pass tree to tr_delete.
(tree_equal_op, tree_print_op, tree_hash_op): Pass 0 to
tree_iter_init initializer macro.
(tree-begin): Rearrange construction for GC correctness: avoid
storing pointers into not-yet-reachable structure.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The lexical-var-p function wrongly reports true for locally
rebound special variables, which are not lexical.
* eval.c (special_var_p): Static function moved to avoid
forward declaration.
(lexical_var_p): Bail if sym satisfies special_var_p.
(old_lexical_var_p): New function, copy of old lexical_var_p
before this bugfix.
(eval_init): Conditionally register lexical-var-p as either
lexical_var_p or old_lexical_var_p depending on the compat
value.
* txr.1: Update documentation for lexical-var-p to clarify
that it doesn't report true for specials. Also make note that
it doesn't report true for global lexicals, and likewise that
lexical-fun-p doesn't report global functions.
Added compat note.
|
|
|
|
|
|
| |
* txr.1: mention seq-iter in the type hierarchy diagram.
The documentation for iter-begin is revised, and now mentions
that the returned value is of this type in some cases.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If seq-begin is used on an object that supports the iter-begin
method, there is a gc problem. This does not seem worth
fixing for the following reasons.
1. The seq-begin function is marked obsolescent. I removed
its one and only internal use in the previous commit, so
it won't be called unless application code uses it.
2. Objects supporting the iter-begin function are clearly
developed as part of the new iteration protocol. It makes
no sense to be newly developing such an object, along with
new code which applies seq-begin to it. There is likely
zero code in the wild which uses either of these
mechanisms.
* lib.c (seq_iter_get_oop, seq_iter_peek_oop,
seq_iter_get_fast_oop, seq_iter_peek_fast_oop): Add comments
documenting the issue.
|
|
|
|
|
|
|
|
|
|
| |
The where function is the only place where seq-begin is used
internally. The seq-begin mechanism is marked obsolescent in
the documentation; let's not use it internally.
* lib.c (lazy_where_func, where): Convert to iter_begin.
Also, use us_lcons_fun and us_func_set_env. This seems to be
the only place where lcons_fun and func_set_env are used.
|
|
|
|
|
|
|
|
| |
* lib.c (seq_iter_mark): The default case checks the type of
the wrong object. The seq_iter object is necessarily a cobjp,
and necessarily not a obj_struct_p so the test is always
false, and we do not call gc_mark(si->ui.iter). The check must
be applied to the object being iterated.
|
|
|
|
| |
* tests/015/match-str.tl: Tests added.
|
|
|
|
|
|
| |
* lib.c (do_match_str): Fix wrong return value calculation
in LSTR-LSTR case.
* tests/015/match-str.tl: New file.
|
|
|
|
|
| |
* tests/011/patmatch.tl: Use mtest throughout to condense the
syntax.
|
|
|
|
|
|
|
|
|
|
| |
Rewriting the match-str function to check some cases more
cleverly and use wmemcmp at the core.
* lib.c (do_match_str, do_rmatch_str): New static functions.
(match_str): Replaced: just dispatches one
of the static helpers based on whether the pos value is
negative.
|
|
|
|
|
|
|
|
|
| |
* arith.c (invalid_ops, invalid_op): Static functions removed.
* unwind.c (invalid_oips, invalid_op): Functions added here,
as external functions.
* unwind.h (invalid_oips, invalid_op): Declared.
|
|
|
|
|
|
|
|
|
|
| |
The TAG_PAIR macro is going to be useful outside of the
math module.
* arith.c (TAG_PAIR): Macro removed.
* lib.h (TAG_PAIR): Added here--oh look!--next to the very
similar and related TYPE_PAIR.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (NOOP): Unused macro removed. This is a leftover
from a code generation system that only existed over the
weekend of December 10-11, 2011. A file called arith.txr was
used to generate arith.c. One case in the minus function
required negating the result due to the reversed operands. The
code was generated by a template common with plus, but plus
didn't need the negation, due to being commutative, so the
code generated for plus called the NOOP macro in the same
place where minus called mp_neg. Just a few hours after
removing arith.txr, I changed the plus code by hand such that
the NOOP macro was not called, without removing the macro.
Good grief.
|
|
|
|
|
| |
* txr.1: the --free-all command line option appeared in TXR
144 in 2016, but was never documented.
|
|
|
|
|
|
|
| |
* tests/011/patmatch.tl: Add variants based on existing tests
which insert an extra character at the left that is matched by
a bound variable. This tests that the remainder of the pattern
is following the offset numeric position within the string.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (expand-quasi-match): bound-p
local function must return nil if the symbol is nil.
* share/txr/stdlib/match.tl: New test cases testing that @nil
is treated as an unbound variable in the
non-consecutive-variables test. Also, making duplicates of
certain tests that start with a text match and sticking @nil
as the first element into them, so that the text match is
forced to be the second item.
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (expand-quasi-match): Don't
extract substrings with sub-str; use match-str to match
in-place.
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (expand-quasi-match): Calculate
npos correctly relative to current pos. Use match-str rather
than starts-with.
|
|
|
|
|
|
|
| |
* lib.c (match_str): The match_str function is hereby altered
to return an integer instead of the symbol t in the matching case.
* txr.1: Updated.
|
|
|
|
|
|
| |
* txr.1: New operator <2> for meta-syntax, used when two
italicized terms are sandwiched in three non-italicized terms.
Documented quasiliteral matching.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (expand-quasi-match): Close the
gap in the expander by diagnosing all unhandled syntax.
There is now enough useful functionality and stability to
start documenting the feature.
|
|
|
|
|
|
| |
* tests/011/patmatch.tl: More tests. All explicitly coded
cases covered, except the fall-through situations we are
not yet catching in expand-quasi-match.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (expand-quasi-match): Add case fo
r unbound var followed by var, followed by nothing.
* tests/011/patmatch.tl: New tests.
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (expand-quasi-match): Instead of
accessing args with car and cadr, capture that part in the
match using @(as) and refer to the variable.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (expan-quasi-match): Use rest
variable consistently instead of (cdr args). Two instances of
(cdr rest) should just be rest. New case added for variable
with no modifiers followed by text being the last item.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (expand-quasi-match): The return
value of search-str isn't a length but an absolute position.
We not only fix a bug, but lose a useless calculation.
* tests/011/patmatch.tl: New test cases for quasiliteral
patterns, starting with the most rudimentary.
Last one broke, due to the above issue.
|
|
|
|
|
|
|
|
|
|
|
| |
* match.tl (compile-cons-structure): Recognize quasi in the
middle of cons structure and compile appropriately.
(parse-lambda-match-clause): Recognize quasi in dot
position properly.
(check, check-end): Treat quasi as atom pattern.
(pat-len): Recognize quasi in dotted position.
(non-triv-pat-p): Handle quasi case. Any quasi containing
elements that are lists is nontrivial.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This not only gets rid of the @ from @`...`, but allows the ``
empty pattern `` to work. A bug is also fixed.
* share/txr/stdlib/match.tl (compile-match): Recognize
list headed by sys:quasi and feed to expand-quasi-match.
(sys:quasi): defmatch removed.
(expand-quasi-match): Function formed from sys:quasi defmatch.
Instead of :form argument, we access *match-form*, like all
the other internal functions. Instead of the :env parameter,
we use the vars-list object. Using that object's exists method
fixed a bug: failing to check for existing variables using
boundp.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (sys:quasi): New defmatch.
This is a macro for now, which makes it require the @ prefix:
e.g. @`@a-@b-@c`. The plain is to integrate this into the
matcher to eliminate that @ prefix. The first priority
are test cases and documentation.
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (expand-quasi): Do not emit
sys:fmt-join call unconditionally. If expand-quasi yields
a list of one expression, we can just yield that expression.
If the list is empty, we can yield a mutable empty string.
(That case will not arise via `` because that converts to ""
at read time, but code that generates quasiliteral syntax
might have an empty case, and expect a mutable string in
all cases).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Log message correction superseding original commit
65213f5f7f6a204886a02c32f259ae2617d1dfb6.
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Bumped.
* txr.vim, tl.vim: Regenerated.
* protsymc.: Likewise
* share/txr/stdlib/doc-syms.tl: Likewise.
|
|
|
|
|
|
| |
* configure: nopie test must check for "clang" in two places
in the version banner. Some vendors stick their name in
front of "clang".
|
|
|
|
|
|
|
|
|
|
| |
* txr.1: After some some discussions with Paul A. Patience,
I've decided to fix the instances where an identifier in
italics or typewriter font is pluralized with -s to just use s.
Some 140 instances are fixed.
* checkman.txr: Allow exception for "s" in the rule that
punctuation must follow codn/metn.
|
|
|
|
|
|
|
|
| |
* tests/011/patmatch.tl: Wrap one test with compile-only and
eval-only so that the compiler ignores it. Add a form
at the end of the file, similarly ignored by the compiler
to compile the file. This compiles and executes all the test
cases.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In eliminate-frame, our stategy of replacing vregs with tregs
assumes that the newly minted tregs are initialized to nil.
This is true if the block is executed only once, but not true
if it's in the middle of a loop, where the previous
iteration's treg values can be present. This results in
miscompilation of code like
(when-match (@x @(all @x)) '(1 (1 2)) x)
which wrongly returns 1 instead of nil starting at
optimization level 2.
* share/txr/stdlib/compiler.tl (struct compiler): New slot,
loop-nest, indicating the loop nesting level.
(compiler eliminate-frame): add instructions to the start of
the block of code to null out all the tregs that we allocated
for replacing vregs. We do this only when compiling the
repeated parts of a loop, as indicated by a positive value
of loop-nest.
(comp-for): Increment loop-nest before compiling the repeated
parts of the loop; decrement it afterward.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/optimize.tl (basic-blocks join-block): When
we merge a block N with its physical predecessor P, we must
iterate over the jump targets of N, and update their reverse
list to point to P instead of N. A full call to link-graph
would fix it also, but we don't call link-graph anywhere in
the optimization pipeline after this point. The reverse
links are relied on to be correct elsewhere, such
merge-jump-tunks, which needs to walk the blocks which jump
to a removed duplicate block, to retarget them to go to
another copy of that block.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (comp-apply-call): When a call
expression is evaluated at compile time, we must quote the
result, because it could be a non-self-evaluating symbol,
or list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (compile-match): Pattern macro
expanders now have an environment parameter. We turn the list
of variables that have been bound so far into a fake
macro-time lexical environment, the parent of which is the
surrounding environment. The pattern macro can query this
using the lexical-var-p function to determine whether a given
variable already has a binding, either in the pattern, or
in the surrounding lexical environment.
(defmatch): Generate a two-argument lambda, and use the new
mac-env-param-bind to make the environment object available
to the user-defined expansion.
* tests/011/patmatch.tl: New test cases for this environment
mechanism, and also for defmatch itself.
* txr.1: Document role of :env under defmatch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
mac-env-param-bind is like mac-param-bind but also allows
the value for the :env parameter to be specified.
* eval.c (op_mac_env_param_bind_s): New sy mbol variable.
(op_mac_env_param_bind): New static function.
(do_expand): Handle mac_env_param_bind_s.
(eval_init): Initialize symbol variable and register macro.
* share/txr/stdlib/compiler.tl (compiler compile): Add case
for mac-env-param-bind.
(compiler comp-mac-env-param-bind): New method.
* share/txr/stdlib/doc-syms.tl: Updated with new hashes for
tree-bind and mac-param-bind, and inclusion of
mac-env-param-bind.
* tests/012/binding.tl: New file.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* unwind.h (UW_FRAME_ALIGN): Define on __amd64__, if compiled
by __clang__. This is because MMX instructions are used for
manipulating the stack which require 16 byte alignment.
This was discovered as a bus error crash on OpenBSD in the
tests/012/cont.tl test case, acessing otherwise perfectly
valid memory. The faulting address was only 8 byte aligned,
not 16.
|
|
|
|
|
| |
* share/txr/stdlib/quips.tl (%quips%): Song lyric parody
of あなたに夢中 by キャンディーズ.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/doc-syms.tl: New entry for end.
* share/txr/stdlib/match.tl (check, check-end, check-sym,
loosen, pat-len): New functions, taken from original local
functions of sme macro.
(sme): Refactored by hoisting local functions out. Some
local variable renaming.
(end): New pattern macro.
* tests/011/patmatch.tl: New test for end.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* utf8.c (utf8_from_buf, utf8_deocde): On 16 bit wchar_t, we
dont' have to throw on every value in the range 0xF0-0xFF.
Only the values 0xF0 through 0xF4 are potential UTF-8 bytes;
so we only need to error out on those. 0xF5 through 0xFF
are invalid bytes, which we can map into the 0xDCNN range.
|
|
|
|
|
| |
* tests/012/parse.tl: All the tests in this file blow up on
systems that don't have a full-blown character type.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (open-compile-streams): When
the output file cannot be opened, the diagnostic message
wrongly refers to the input stream object rather than the
output file path.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
LIT_ALIGN was introduced before there was SIZEOF_WCHAR_T.
The latter was introduced on suspicion that they might not
be the same. Since LIT_ALIGN is tied to SIZEOF_WCHAR_T
again there is no need for it to exist.
* configure (lit_align): Variable removed. Documentation
of lit-align argument removed. Alignment of wide literals test
removed. Not generating LIT_ALIGN in config.h any more.
* lib.h (LIT_ALIGN): Occurrences replaced with SIZEOF_WCHAR_T.
|