| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bugfix: the newly introduced @.expr fails in the
dotted position because ^(a . @,expr) turns
into (list 'a 'let ...).
* eval.c (is_meta_unquote): New static function.
(expand_qquote_rec): Replace existing shape test with
is_meta_unquote. We must also use this test in one more place:
whenever the cdr of a list has the meta unquote shape,
we must treat the result similarly to a dotted atom, by
converting to append format.
* tests/010/qquote.tl: Test cases to cover this.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For better or worse, TXR Lisp has a dichotomy of
representation that @<atom> produces sys:var syntax, whereas
@<compound> produces sys:expr. This can cause an issue in
backquoting. Suppose you want to use backquote to generate
sytax like (a @b) where the b comes from a variable.
The problem is that (let ((x 'b)) ^(a @,x)) doesn't do
what you might expect: it produces (sys:expr b) rather
than (sys:var b).
This patch adds a hack into the quasiquote expander which
causes it to generate code to do what you expect.
Old behavior:
1> (expand '^(a @,x))
(list 'a (list 'sys:expr x))
New behavior:
1> (expand '^(a @,x))
(list 'a (let ((#:g0012 x))
(if (atom #:g0012)
(list 'sys:var #:g0012)
(list 'sys:expr #:g0012))))
In other words, x will be evaluted, and the based on the
type of the object which emerges, either sys:var or
sys:expr syntax is generated.
* eval.c (expand_qquote_rec): Implement the above hack.
We are careful to only do this when this exact shape occurs
in the syntax: (sys:expr (sys:unquote item)).
* tests/010/qquote.tl: New file.
* txr.1: Documented.
|
|
|
|
|
|
| |
* tests/010/json.tl: New tests. These work. Odd; I'm seeing
an issue whereby typing multi-line #J expressions into the
listener does not work.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When duplicate keys are inserted in the default way with
replacement, the tree size must not be incremented.
* tree.c (tr_insert): Increment the tr->size and maintain
tr->max_size here. In the case of replacing an existing node,
do not touch the count.
* tests/010/tree.tl: Add test cases covering duplicate
insertion and tree-count.
(tree_insert_node): Remove unconditional size increment.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register delcons intrinsic.
* lib.[ch] (delcons): New function.
* tests/010/cons.tl: New file.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We extend the matching context structures to keep track of the
underlying stream from which lines are being taken via the lazy list.
Then the implementation of the @(eof) directive, when it hits the eof
condition, can use this stream to gain access to the termination status.
* match.c (match_line_ctx, match_files_ctx): New member, stream.
(ml_all): Take stream argument and initialize new member.
(h_call, do_match_line): Pass stream argument to h_call.
(mf_all, mf_file_data): Take stream argument and initialize new member.
(mf_from_ml): Propagate stream from line context to file context.
(freeform_prepare, v_next_impl, match_filter, match_fun, extract): Pass
stream argument where now needed.
(v_eof): Implement termination status binding via the stream stored
in the context.
(open_data_source): Store stream in match files context.
* tests/010/eof-status.txr: New file.
* tests/010/eof-status.expected: New file.
* Makefile (tst/tests/010/eof-status.ok): -B option for new test.
* txr.1: Documented eof directive, argument and all.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (read_bad_json_s): New symbol variable.
(parser_common_init): Propagate value of *read-bad-json* into
read_bad_json flag in parser structure.
(parser_init): Initialize read_bad_json_s and register the
*read-bad-json* dynamic variable.
* parser.h (struct parser): New member, read_bad_json.
(read_bad_json_s): Declared.
* parser.y (json_val): Support an opt_comma symbol just before
the closing bracket or brace.
(opt_comma): New nonterminal symbol. Recognizes ',' or nothing.
Error is flagged if ',' is recognized, and *read-bad-json*
is nil.
* y.tab.c.shipped: Updated.
* tests/010/json.tl: New tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/002/query-1.txr: Skip test if an executable
/bin/sh doesn't exist, rather than the bogus reasons.
* tests/010/json.tl: Change the condition for the
command-put-json tests: not whether cat is found
in the search path but whether /bin/sh exists and is executable.
* tests/017/realpath.tl: Also quit if /usr/bin doesn't exist.
* tests/018/path-test.tl: Exit succesfully if /bin/sh
does not exist. Revert the earlier change.
* tests/018/process.tl: Quit if no executable /bin/sh exists.
|
|
|
|
|
|
|
| |
* tests/010/json.tl: skip several test cases which rely on the
cat utility for testing command-put-json, if the cat utility
is not found in the search path. Reported and investigated by
Paul A. Patience.
|
|
|
|
|
|
| |
* tests/010/json.tl: Fix several tests being excluded from
the (mtest ...) form to which they are expected to belong,
one of them having an extra quote in the expected value, too.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (lisp_parse_impl): If parsing from string, check
for trailing junk and diagnose. JSON parsing doesn't use
lookahead because it doesn't have a.b syntax, so the
recent_tok gives the last token that actually went into the
syntax, and not a lookahead token. So in the case of JSON,
we call yylex to see if there is any trailing token.
* tests/010/json.tl: Extend get-json tests to more kinds of
objects, and then replicate with trailing whitespace and
trailing junk to provide coverage for these cases.
* tests/012/parse.t: Slew of new read tests and iread also.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register fill-vec intrinsic.
* lib.c (fill_vec): New function.
* lib.h (fill_vec): Declared.
* tests/010/vec.tl: New file.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (out_json_str): Strengthen the test for escaping the
forward slash. It has to occur in the sequence </script
rather than just </. Recognize <!-- and --> in the string,
and encode them.
* tests/010/json.tl: Cover this area with some tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/010/json.tl: on Windows characters are limited to the
BMP range 0 to #\xFFFF. The character escape \x10437 is out
of range, and so throws an error, simply from that syntax
being read. The two test cases which use this character are
clumped into their own test form, which is executed
conditionally on wide characters being more than two bytes.
Because the expression is still parsed on Windows, we read the
troublesome character from a string at run-time, and
interpolate it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* /share/txr/stdlib/getput.tl (get-jsons): If the s parameter
is a string, convert it to a byte input stream so that.
(put-jsons): Add missing t return value.
(file-put-json, file-append-json, file-put-jsons,
file-append-jsons, command-put-jsons, command-put-jsons): Add
missing object argument to all these functions, and a missing
"w" open-file mode to several of them.
* stream.c (mkstemp_wrap): Calculate length of suff the
defaulted argument, not the raw suffix argument.
* test/010/json.tl: New file, providing tests that touch every
area of the new JSON functionality.
* tests/common.tl (mstest, with-temp-file): New macros.
* txr.1: Document that get-jsons takes a source which could be
a string.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (seq_iter_init_with_info): Recognize tree_iter object,
and treat using tree iterator function.
* tests/010/tree.tl: test case for tree subrange iteration
with collect-each.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Getting rid of tree-begin-at and tree-reset-at. Now tree-begin
takes two optional parameters, for specifying high and low
range.
* tree.c (struct tree_diter): New members, tree and highkey.
We need tree due to requiring access to the less function.
If the iterator has no highkey, the iterator itself is stored
in that member to indicate this.
(tree_iter_mark): Mark the tree and highkey.
(tree_begin): Take optional lowkey and highkey arguments,
initializing iterator acordingly.
(tree_begin_at): Function removed.
(copy_tree_iter, replace_tree_iter): Copy tree and highkey
members. The latter require special handling due to the funny
convention for indicating highkey absence.
(tree_reset): Take optional lowkey and highkey arguments,
configuring these in the iterator being reset.
(tree_reset_at): Function removed.
(tree_next, tree_peek): Implement highkey semantics.
(sub_tree): Simplified: from and to
arguments are just passed through to tree_begin, and there is
no need for a separate loop which enforces the upper limit,
that now being handled by the iterator itself.
(tree_begin): Update registrations of tree-begin and
tree-reset; remove tree-begin-at and tree-reset-at intrinsics.
* tree.h (tree_begin_at, tree_reset_at): Declarations removed.
(tree_begin, tree_reset): Declarations updated.
* lib.c (seq_iter_rewind, seq_iter_init_with_info, where,
populate_obj_hash): Default new optional arguments in
tree_begin and tree_reset calls.
* parser.c (circ_backpatch): Likewise.
* tests/010/tree.tl: Affected cases updated.
* txr.1: Documentation updated.
* share/txr/stdlib/doc-syms.tl: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (do_generic_funcall): Support tree object invocation
with one or two arguments via sub and ref.
(sub): Implement for trees via sub_tree.
(ref): Implement for trees via tree_lookup.
* tree.c (sub_tree): New function.
(tree_init): Register sub-tree intrinsic.
* tree.h (sub_tree): Declared.
* tests/010/tree.tl: New tests.
* txr.1: Documented: DWIM bracket syntax on trees, sub and ref
support for trees, sub-tree function,
* share/txr/stdlib/doc-syms.tl: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (replace_tree_iter): New function.
(tree_init): Register replace-tree-iter intrinsic.
* tree.h (tree_init): Declared.
* share/txr/stdlib/doc-syms.tl: Updated.
* txr.1: Documented.
* tests/010/tree.tl: New test case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (copy): Handle tree_iter_s via copy_tree_iter.
* tree.c (copy_tree_iter): New function.
(tree_init): copy-tree-iter intrinsic registered.
* tree.h (copy_tree_iter): Declared.
* tests/010/tree.tl: New test case.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (seq_iter_rewind): Use hash_reset and tree_reset
to rewind the existing iterator rather than allocating a new
one.
* tests/010/hash.tl: New file, covering uni, diff and isec for
hash tables.
* tests/010/tree.tl: New tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (tn_peek_next): New static function.
(tree_peek): New function.
(tree_init): Register tree-peek intrinsic.
* tree.h (tree_peek): Declared.
* txr.1: Documented.
* tests/010/tree.c: Work tree-peek into existing test case.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (make_similar_tree): New function.
(tree_init): Register make-similar-tree intrinsic
* tree.h (make_similar_tree): Declared.
* tests/010/tree.tl: New tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (tree_reset, tree_reset_at): New functions.
(tree_init): tree-reset and tree-reset-at intrinsics
registered.
* tree.h (tree_reset, tree_reset_at): Declared.
* tests/010/tree.tl: New tests.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
| |
* tests/010/tree.tl: Use rlist to express discontinuous range
instead of appending ranges.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I'm fixing a historic mistake copied from ANSI Lisp,
which trips up language newcomers and sometimes even
experienced users.
The function innocently named sort will now return newly
allocated structure. The function previously called sort will
be available as nsort (non-consing/allocating sort).
The shuffle function also becomes pure, and is accompanied by
nshuffle.
* eval (me_op): Continue to use destructive sort in this
legacy code that is only triggered in very old compat mode.
(eval_init): Registered nsort and nshuffle.
* lib.c (nsort, nshuffle): New functions introduced, closely
based on sort and shuffle.
(sort, shuffle): Rewritten to avoid destructive behavior: work
by copying the input and calling destructive counterparts.
(sort_group): Continue to use destructive sort, which is safe;
the structure is locally allocated. The sort_group function
has pure semantics.
(grade): Likewise.
* lib.h (nsort, nshuffle): Declared.
* share/txr/stdlib/getopts.tl (opthelp): Replace an instance
of the (sort (copy-list ...)) pattern with just (sort ...).
* tags.tl (toplevel): Continue to use destructive sort to sort
tags before writing the tag file; the lifetime of the tags
list ends when the file is written.
* tests/010/seq.txr: Switch some sort calls to nsort to keep
test case working.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (tlist_k): New keyword symbol variable.
(tleval_144): New static function.
(h_skip): evaluate min and max arguments as Lisp.
(h_coll): Evaluate all numeric keyword arguments as
Lisp: :min, :max, :gap, :times, :maxtimes, :mintimes,
:chars.
(h_call): Evaluate function expression as Lisp.
(do_output_line, do_output): Evaluate n and m parameters
in @(modlast) and @(mod) as Lisp.
(v_skip): Evaluate min and max as Lisp.
(v_fuzz): Evaluate m and n as Lisp.
(v_freeform): Evaluate arguments as Lisp.
(v_next): Support new argument, :tlist, which is like
:list, but with TXR style evaluation. From now on :list
uses Lisp evaluation, unless compatibility is set to 143
or lower. Also, evaluate the :string argument as Lisp.
(v_collect): Evaluate all numeric keyword arguments as
Lisp: :min, :max, :gap, :times, :maxtimes, :mintimes,
:lines.
(v_output): Evaluate stream in :continue or :finish
expression as Lisp.
(v_load): Evaluate load target as Lisp.
(v_close): Evaluate stream argument as Lisp.
(v_call): Evaluate function expression as Lisp.
(syms_init): Initialize tlist_k variable.
* tests/007/except-1.txr: Use :tlist instead of :list,
since argument is a TXR list expression.
* tests/010/block.txr: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (op_error): New static function.
(macro_form_p, fboundp): Static to external.
(special_operator_p): New function.
(eval_init): Register macrolet and symacrolet to op_error.
These are recognized and processed by expand, but we want
them in the op table so they are reported by special_operator_p.
* eval.h (fboundp, macro_form_p, special_operator_p): Declared.
* hash.c (print_key_val): Break long lines on spaces
between pairs with stream_width_check.
(hash_print_op): Implement split and indented printing.
* lib.c (obj_print_impl): New static function, resulting
from a merge of obj_print and obj_pprint. Fixes some
wrong-way recursion bugs: obj_pprint recursed into obj_print
in some places. Adds support for multi-line printing of
vectors and lists, with indentation using the new
interfaces in streams.
* stream.c (strm_base_init): Update initializer.
(put_indent, indent_mode_put_string): New static functions.
(put_string): Use indent_mode_put_string in either of the
two indent modes.
(put_char): Implement indent mode.
(get_indent_mode, test_set_indent_mode,
set_indent_mode, get_indent, set_indent,
inc_indent, width_check): New functions.
* stream.h (enum indent_mode): New.
(struct strm_base): indent_on member becomes indent_mode.
New members data_width and code_width.
(get_indent_mode, test_set_indent_mode,
set_indent_mode, get_indent, set_indent,
inc_indent, width_check): Declared.
* tests/009/json.expected: Updated.
* tests/010/seq.expected: Likewise.
* tests/011/macros-2.expected: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The operators set, inc, dec, pop and others are now macros
which generate code, rather than built-in special forms
that use "C magic". Moreover, new such macros are easy to write, and
several new ones are already available. Moreover, new kinds of
assignable places are easy to create.
* place.tl: New file.
* lisplib.c, lisplib.h: New files.
* Makefile (OBJS): New target, lisplib.o.
(GEN_HDRS): New variable.
(LISP_TO_C_STRING): New recipe macro, with rule.
(clean): Remove generated headers named in $(GEN_HDRS).
* eval.c (dec_s, push_s, pop_s, flip_s, del_s): Variables removed.
(setq_s): New variable.
(lookup_var, lokup_sym_lisp_1, lookup_var_l, lookup_fun, lookup_mac,
lookup_symac, lookup_symac_lisp1): Trigger the delayed loading of
libraries for undefined global symbols, and re-try the lookup.
(op_modplace, dwim_loc, force_l): Static functions removed.
(op_setq): New static function.
(eval_init): Initialize setq_s; remove initializations of
removed variables; remove registrations for op_modplace;
add registration for sys:setq, sys:rplaca, sys:rplacd,
sys:dwim-set and sys:dwim-del intrinsics.
Call lisplib_init to initialize the dynamic library loading module.
* lib.c (sys_rplaca, sys_rplacd): New functions, differing
in return value from rplaca and rplacd.
(ref, refset): Handle hash table.
(dwim_set, dwim_del): New functions.
* lib.h (sys_rplaca, sys_rplacd, dwim_set, dwim_del): Declared.
* genvim.txr: Include place.tl in scan.
* tests/010/seq.txr: The del operator test
case no longer throws at run-time but at macro-expansion time, so the
test case is simply removed.
* tests/010/seq.expected: Updated output.
* tests/011/macros-2.txr: Reset *gensym-counter* to zero, because
the textual output of the test case includes gensyms, whose numberings
fluctuate with the content of the new Lisp library material.
* tests/011/macros-2.expected: Updated output.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
of identifiers to rule this out from being the first character of a
symbol which has no prefix. Recognize the ^ character as a token in the
NESTED state.
* lib.c (obj_print, obj_pprint): Render sys:qquote as ^.
* parser.y (choose_quote): Function removed.
(n_expr): Recognize '^' as quasiquote. Removed all the "smart quote"
hacks that try to make quote behave as quote or quasiquote, or try to
cancel out unquotes and quotes.
* tests/009/json.txr: Fixed to ^ quasiquote.
* tests/010/reghash.txr: Likewise.
* tests/011/macros-2.txr: Likewise.
* tests/011/mandel.txr: Likewise.
* tests/011/special-1.txr: Likewise.
* txr.1: Updated docs.
* genvim.txr: Revamped definitions for txr_ident and txl_ident so that
unqualified identifiers cannot start with # or ^, but ones with @ or :
in front can start with these characters.
* txr.vim: Regenerated.
|
|
|
|
| |
* tests/010/output-clauses.txr: New file.
|
|
|
|
|
|
|
|
| |
* tests/010/block.txr: New file.
* tests/010/reghash.expected: New file.
* tests/010/reghash.txr: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
function. This must not flush out more than one character out of this
small buffer, except when we are flushing out the last data.
The correct operation is predicated on the assumption that
a complete character can be pulled out. That's why we move the
buffer to the front after consuming it, and do not automatically
flush until there are four bytes.
(string_out_put_string): We loop the call to string_out_byte_flush
here because when a request comes in to write a Unicode character,
we flush all the bytes, even if the tail of those bytes forms
an incomplete sequence that turns into U+DCxx codes.
(get_string_from_stream): Use the same loop termination test
as in string_out_put_string, for consistency. In that function
it is needed to prevent infinite looping in the case when
the string_out_put_string is being called from string_out_byte_flush
and is thus re-entering it.
* tests/010/strstream.expected: New file.
* tests/010/strstream.txr: New file.
|
|
|
|
| |
* tests/010/seq.expected: New file.
|
|
* Makefile (TXR_ARGS): Defined for new test case.
* tests/010/align-columns.dat: New file.
* tests/010/align-columns.expected: New file.
* tests/010/align-columns.txr: New file.
|