| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
* share/txr/stdlib/op.tl (sys:op-expand): Comment added.
We cannot use cadr because that triggers autoload of
cadr.tl, which uses defplace, which requires place.tl, which
requires op, which is what we are in the middle of defining.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/op.tl (op-expand): For the sake of special
processing applied to support the lop operator, the code
assumes that the expanded syntax-2 is a list with at least two
elements, such that we can do (cddr syntax-2). This is not
true for instance in (op progn).
* tests/012/op.tl: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There has been interest in the community in a threading macro;
a triviality which which applies the opip syntax to a value.
Eschewing unusual glyph combinations like ->> and whatnot,
I've chosen the English word flow for this.
* share/txr/stdlib/op.tl (flow): New macro.
* lisplib.c (op_set_entries): Set up autoload for flow.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/txr-case.tl (txr-case-impl): If the input
is a stream, then convert it to a lazy list of lines, so that
running multiple functions against it produces sane,
backtracking behavior, like a @(cases) construct.
* tests/011/txr-case.expected: Updated.
* tests/011/txr-case.txr: Now actually contains a test case
for txr-case.
* txr.1: Address an issue reported by Paul A. Patience: the
input to match-fun, txr-if and txr-when may be a stream. That
has always been the case in the implementation. Also document
that when the input is a single string, it is treated as a
list. Document the new requirement in txr-case that a stream
is converted into lazy list of lines.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/pic.tl (expand-pic-num): format can now do
everything internally that is required of a 0####.## type
pattern; we don't have to generate the if logic with the
gensym.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/pic.tl (expand-pic-num): The ##...## string
that indicates an overflowing field can be created by the
macro and inserted into the code as a literal object, rather
than inserted as a mkstring call which calculates it run time
each time the code is executed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Bumped.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
* y.tab.c.shipped: Regenerated. Good catch! forgot to do this
for most recent change to parser.y.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/pic.tl (pic): Refactor string compilation
code into local function which has access to the overall
argument list. Recognize the quasiliteral case and translate
by compiling all the string parts, then forming a recombined
quasiliteral where the compiled parts are substituted.
* tests/018/format.tl: test case for this.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/pic.tl (expand-pic-num, expand-pic, pic):
Allow ### to be followed by a single !. This is not counted
toward the field width.
* tests/018/format.tl: Cover with some tests.
* txr.1: Doc updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/pic.tl (expand-pic-num): Bug: when a field
overflows, the (rest ...) call truncates the leftmost digit.
A failing test case is (pic "#.#" 12) which produces "2.0"
instead of "12.0". Firstly, we only need that logic at all in
the zero padding case. When the number is positive, we stick
in the + request, so we are sure to get a + character. The
rest call then predictably chops off the + rather than a
digit.
(pic-join-opt): Fix two bugs here in the string-string combine
case: using s2 instead of s1, and not splicing in rest.
(expand-pic, pic): Implement tightening for escape sequences.
If ~ is not followed by anything, or not followed by the
documented characters for escaping, it is erroneous.
* format.tl: Battery of new tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We don't want to be unconditionally releasing deferred
warnings when error exceptions occur in evaluation or
compilation. The reason is that the error might be handled,
for instance by a speculative expansion. Then unwanted noise
occurs, because deferred warnings have been released
prematurely.
* eval.c (eval_exception): Do not call
uw_release_deferred_warnings here.
(error_trace): But do call uw_release_deferred_warnings here,
before printing anything else. We want to preserve the
behavior that when error information is actually being
printed to a stream, any deferred warnings are dumped first
because they might pertain to the error. (I may revisit
this requirement; perhaps deferred warnings rarely, if ever,
pertain to an error).
* share/txr/stdlib/error.tl (compile-error): Do not dump
deferred warnings unconditionally. Only dump them if we
are also printing the error message to stderr. Secondly, do
not output the error message at all, unless there is no
handler for the error.
|
|
|
|
|
|
| |
* txr.1: pic macro documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (pic_instantiate, pic_set_entries): New static
functions.
(lisplib_init): Register autoloading of pic.tl module via new
functions.
* share/txr/stdlib/pic.tl: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/ffi.c (deffi): Fix misnamed variable.
The second value coming from sys:analyze-argtypes is the number of fixed
arguments, not the number of variadic arguments. Furthermore, if this
number is equal to nargs, we were supposed to have been passing nil
instead to ffi-make-call-desc, which indicates the ordinary non-variadic
function. We were always always passing a non-nil value, so always requesting
variadic. That is fixed now thanks to the change to ffi_make_call_desc.
* ffi.c (ffi_make_call_desc): Register the function as variadic if
either nfixed is specified as nil, or if it is equal to ntotal.
* txr.1: Document the convention change for ffi-make-call-desc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (read_unknown_structs_s): New symbol variable.
(parser_common_init): Initialize read_unknown_structs flag
member of the parser structure from the new special variable.
(parse_init): Initialize read_unknown_struct_s variable.
Register the *read-unknown-structs* dynamic variable.
* parser.h (struct parser): New member, read_unknown_structs.
(read_unknown_structs_s): Declared.
* parser.y (struct): Generate the struct literal syntax not
only for quasiquoted structures, but for structures with an
unknown type name, if the read_unkonwn_structs flag is set.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Regenerated.
* y.tab.c.shipped: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (ffi_set_entries): Autoload for deffi-struct and
deffi-union symbols.
* share/txr/stdlib/ffi.tl (deffi-struct, deffi-union): New
macros.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
FFI has the problem that when things go wrong in calls, or in
specifications of functions, the diagnostics refer to an
internal function like ffi-call or ffi-make-call-desc, which
is not helpful in identifying the error. We want the
diagnostics to refer to the foreign function, or foreignb
callback wrapper, to which the problem pertains.
The approach taken is to stick the name symbol into the
ffi-call-desc object. Functions which work with a
ffi-call-desc can pull out the name and use it for reporting.
* ffi.c (struct txr_ffi_call_desc): Add name member.
(ffi_call_desc_print_op): Include name in printed
representation.
(ffi_desc_mark_op): Mark the name.
(ffi_make_call_desc): Take new argument to specify the name,
storing it into the structure. If it is specified,then use
that name for reporting errors, otherwise stick with
ffi-make-call-desc.
(ffi_call_wrap, ffi_closure_dispatch,
ffi_closure_dispatch_safe, ffi_make_closure): Use the name
from the call descriptor, or else the function's own name if
that is nil.
(ffi_init): Update registration of ffi-make-call-desc
intrinsic to five arguments with four required.
* ffi.h (ffi_make_call_desc): Declaration updated.
* share/txr/stdlib/ffi.tl (deffi, deffi-cb-expander): Pass the
name symbol down to ffi-make-call-desc.
* txr.1: Documented.
|
|
|
|
| |
* share/txr/stdlib/quips.tl (sys:%quips%): New entry.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (transform-qquote): Handle hash
error case with separate pattern. Use compile-error and *match
form instead of error. Diagnose splicing unquote and nested
quasiquote.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows
(when-match ^(,a ,b) '(1 2) (list a b)) -> (1 2)
which is a nice alternative that is supported by some
Lisp pattern matchers. We don't need it since we have (@a @b).
The motivation is JSON matching.
(when-match ^#J{"foo" : {"x" : ~val}}
#J{"foo" : {"x" : "y"}} val)
-> "y"
* share/txr/stdlib/match.tl (compile-match): Recognize qquote
case and handle via transform-qquote function.
(non-triv-pat-p): Let's declare quasiquotes to be nontrivial.
(transform-qquote): New function: transform quasi-quoted
syntax into regular pattern matching syntax.
* txr.1: Documented.
|
|
|
|
|
| |
* share/txr/stdlib/doc-lookup.tl (open-url): Handle :cygnal
together with :cygwin.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Bumped.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* /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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: check for mkstemp and mkdtemp.
* stream.c (stdio_set_prop): Implement setting the :name
property. We need this in mkstemp_wrap in order to punch in
the temporary name, so that the application can retrieve it.
(mkdtemp_wrap, mkstemp_wrap): New functions.
(stream_init): Register mkdtemp and mkstemp intrinsics.
* stream.h (mkdtemp_wrap, mkstemp_wrap): Declared.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (tmpfile_wrap): New static function.
(stream_init): Register tmpfile intrinsic.
* stream.h (tmpfile_wrap): Declared.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
| |
* txr.1: Documented file-get-json, file-put-json,
file-append-json, file-get-jsons, file-put-jsons,
file-append-jsons, command-get-json, command-put-json,
command-get-jsons, command-put-jsons.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (getput_set_entries): Register autoload for
get-jsons, put-jsons, file-get-json, file-put-json,
file-append-json, file-get-jsons, file-put-jsons,
file-append-jsons, command-get-json, command-put-json,
command-get-jsons and command-put-jsons.
* share/txr/stdlib/getput.tl (get-jsons, put-jsons,
file-get-json, file-put-json, file-append-json,
file-get-jsons, file-put-jsons, file-append-jsons,
command-get-json, command-put-json, command-get-jsons and
command-put-jsons): New functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register put-json and put-jsonl
intrinsics.
* lib.c (out_json_str): Do not output the U+DC01 to U+DCFF
code points by masking them and using put_byte. This is
unnecessary; if we just send them as-is to the text stream,
the UTF-8 encoder does that for us.
(put_json, put_jsonl): New functions.
* lib.h (put_json, put_jsonl): Declared.
* txr.1: Documented. The bulk of tojson is moved under the
descriptions of these new functions, and elsewhere where the
document pointed to tojson for more information, it now points
to put-json. More detailed description of character treatment
is given.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler comp-catch): The
tfrag's output register may be (t 0) in which case the
maybe-mov in the cfrag code generates a mov into (t 0) which
is not allowed. Instead of tfrag.oreg we create an abstrction
coreg which could be either toreg or oreg and consistently use
it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (lisp_parse_impl): Access pi->eof directly instead
of going through parser_eof. We are using pi->errors in the
same expression! This is the only place pi->eof is needed.
(read_file_common): Don't call parser_eof. Assume that if
error_val emerges, and errors is zero, it must be eof.
(read_eval_ret_last): Simplify: the code actually does nothing
specia for eof versus errors, so we just bail if error_var
emerges.
(get_parser): Function removed.
(parse_errors): This is the only caller of get_parser, which
now just calls gethash to fetch the parser.
(parser_eof): Function removed.
(parse_init): sys:get-parser, sys:parser-errors and
sys:parser-eof intrinsics removed. The C function
parser_errors still exists; it is used in a few places.
* parser.h (get_parser, parser_eof): Declarations removed.
* share/txr/stdlib/compiler.tl (compile-file-conditionally):
Use the new parse-errors function instead of the removed
sys:parser-errors. Since that works on the stream, we don't
have to call sys:get-parser. Because it returns nil if there
are no errors, we drop the > test.
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (parse_errors): New function.
* parser.h (parse_errors): Declared.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): get-json intrinsic registered.
* parser.c (prime_parser): Handle prime_json.
(lisp_parse_impl): Take enum prime_parser argument
directly instead of the interactive flag.
(lisp_parse, nread, iread): Pass appropriate prime_parser
value instead of the original flag.
(get_json): New function. Like nread, but passes prime_json.
* parser.h (enum prime_parser): New constant, prime_json.
(get_json): Declared.
* parser.l (prime_scanner): Handle prime_json.
* parser.y (SECRET_ESCAPE_J): New terminal symbol.
(spec): New productions around SECRET_ESCAPE_J for parsing
JSON.
* lex.yy.c.shipped, y.tab.c.shipped, y.tab.h.shipped: Updated.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): tojson intrinsic registered.
* lib.c (tojson): New function.
* lib.h (tojson): Declared.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
| |
* txr.1: Documented #J, #J^ and json macro.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Bumped.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
| |
* txr.1: Fix heading repeating identity instead of listing
idenitty and identity*.
* share/txr/stdlib/doc-syms.tl: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The @(hash ...) operator now allows key-only patterns
like (42) or (@x), where x could be bound or unbound.
This has separate semantics from when a value is present.
* share/txr/stdlib/match.tl (compile-hash-match): Implement.
* tests/011/patmatch.tl: Test.
* txr.1: Document.
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (compile-hash-match): Fix
unquoting comma that had been strangely moved to the previous
line.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Because with-compilation-unit is keyed of *load-recursive*,
when compilation is happening in the context of a load (a
top-level form in a loaded file calls compile-file or
compile-update file) warnings are deferred until the end of
the load. That might never occur if the load doesn't complete,
because, say, the image quits for some reason.
If the following is the content of a file which is loaded:
(compile-file "foo")
(exit 0)
then warnings during the compilation are not issued when
compile-file terminates, and will never be issued because of
the termination due to the exit call.
* share/txr/stdlib/compiler.tl (*in-compilation-unit*): New
special variable.
(with-compilation-unit): Use *in-compilation-unit* to
determinw when a compilation unit has ended, and dump all the
deferred warnings then. We will bind *load-recursive* because
that is required for deferring warnings.
|
|
|
|
| |
* share/txr/stdlib/quips.tl (%quips%): Entries added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (rt_defvarl): More accurate self string.
(rt_defv): New static function: like rt_defvarl but ensures
that the new variable has a binding cell, and returns that
cell instead of the hash cell.
(op_defvarl): Take advantage of rt_defv to not have to cons up
the binding cell.
(eval_init): Register sys:rt-defv intrinsic.
* parser.c (read_file_common): Compiled files are now version
7, so we must recognize them. We still load version 6 files
because rt:defvarl still exists for them.
* share/txr/stdlib/compiler.tl (expand-defvarl): Improve the
generated code in two ways. Firstly, use the new sys:rt-defv,
which returns the binding cell, so that the value can be
stored into it with rplacd without having to cons up anything.
Secondly, if there is no value expression, don't emit the
code to do the assignment.
(%tlo-ver%): Bump compiled file version to (7 0).
* txr.1: Add note about TXR 260 loading version 7 and 6.
|
|
|
|
|
|
|
|
|
|
|
| |
* genman.txr: generate doc-syms as a sorted list fed to
hash-from-pairs. Now the symbols won't jump around so much
whenever we update it. Also, the names must be HTML-decoded.
For instance "str<" was being stored as "str<" causing
(doc 'str<) to fail. We use TXR @(output) to adjust the
formatting as if it were maintained by hand.
* share/txr/stdlib/doc-syms.tl: Regenerated.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Bumped.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
| |
* txr.1: Fix typos: tree-value-at should be trie-value-at.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|