| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The lambda.tl test, when compiled, is only testing the
compiler's implementation of the inlined lambda: code
generated from a lambda expression to which arguments are
statically applied. We augment this to also compile
real lambda functions which are called. Everything passes.
* tests/012/lambda.tl (call-lambda): New function.
(ltest): New macro, specifically geared for testing lambda
expressions. When *compile-test* is true, this generates code
which performs two tests: applying the arguments directly to
the lambda, and evaluating the lambda to a function which is
passed to call-lambda, which will then apply the arguments.
We cannot use apply, because the compiler sees through that
and will inline the lambda anyway.
(mltest): Multi-expression version of ltest. This is a drop-in
replacement for mtest in the rest of the file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This bug affects optional parameters which either
have no default expression, or one that is nil.
For instance x in (lambda (: (x nil))) or (lambda (: x)).
When such a parameter is given the : symbol as an argument, it
is not being bound, as if it weren't there.
((lambda (: x) x) :) -> ;; error: unbound variable x
This issue is not a regression; it was introduced in the
commit which introduced the colon convention to optionals, as
well as init expressions and presence-indicating variables,
commit 68c084269581f32f0a7b859446ae2efb6c6a26c0 made in
February 2014.
This might be the first instance of an interpreter bug being
found that is not present in the compiler.
* eval.c (bind_args): The idea here was that when the argument
to an optional the colon keyword symbol, and the optional's
initform is nil, we can skip the overhead of calling eval to
get that initform's value. Unfortunately, the skip was
extended over the code which binds the parameter. Only
the eval can be skipped!
* tests/012/lambda.tl: New test cases to cover this.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
* lib.c (less_tab_init): Add missing initialization for VEC,
with a priority above CONS: all vectors are greater than
conses. The BUF priority is bumped to 7.
* test/012/less.tl: New file.
|
|
|
|
|
|
|
|
|
|
|
| |
I discovered this off chance by searching for occurrences
of (let ,(zip ...) ...) or (let (,*(zip ...)) ...) in the
code base, noticing an incorrect one.
* stdlib/place.tl (sys:register-simple-accessor): Remove
spurious list around ,(zip temps args).
* tests/012/defset.tl: Test cases for define-accessor added.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (me_case): Reduce (key) to key only if key is
an atom. Otherwise we reduce ((a b c)), which
is a single list-valued key to (a b c), which looks like
three keys. This was introduced on Oct 25, 2017 in
commit b72c9309c8d8f1af320dce616a69412510531b48,
making it a regression.
* tests/012/case.tl: New file. The last test
case fails without this bugfix. The others pass either way.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
| |
* tests/012/seq.tl: Numerous test cases for tuples.
|
|
|
|
|
|
|
| |
* lib.c (tuples): Check that n argument giving tuple size is a
is a positive integer.
* tests/012/seql.tl: Test case added.
|
|
|
|
| |
* tests/012/syntax.tl: New tests, some of which fail.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
* tests/012/iter.tl: Several new cases to provide some
coverage in recently fixed areas. All of these break in 268.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this patch we allow the s in (sub s from to) and [s from..to]
to be any iterable.
* lib.c (iter_dynamic, sub_iter): New static function.
(generic_funcall): Handle all objects via the sequence case:
ref, sub and all that. Unfortunately, we lose some error
handling at the level of the sub function. But we allow any
iterable to be passed through to sub.
(sub): Handle default case through sub_iter.
* tests/012/iter.tl: New cases.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ranges like "AAA".."ZZZ" are now possible.
* lib.c (seq_iter_get_range_str, seq_iter_peek_range_str,
seq_iter_get_rev_range_str): New static functions.
(seq_iter_init_with_info): Support string ranges via above
new functions. Range direction test is now done with less
and equal rather than lt and gt.
* tests/012/iter.tl: New file.
* txr.1: Documented.
|
|
|
|
|
| |
* tests/012/cont.tl: Exit before the test case that contains characters
ouside of the BMP, if (sizeof wchar) is less than 4.
|
|
|
|
|
| |
* tests/012/oop.tl: Adjust one recently added test case to
eliminate undefined variable warning.
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/struct.tl (sys:new-expander): If the argument of
new* or lnew* is dwim, then treat that as an expression,
rather than as a boa-style construction.
* tests/012/oop.tl: Tests for new* focusing on this issue.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This issue doesn't affect the tests. This is for the benefit
of someone who happens to be copy-and-pasting the amb
implementation from here.
* tests/012/cont.tl (amb): This function has an issue in that
it calls the continuation (future calculation) and then if
that succeeds, it normally returns the value. This means that
the future is executed again. In the case of N amb
expressions, the successful future is executed 2**N times.
What amb must do is this: call the continuation and capture
the value. If the value is successful, then that is the master
return value; just return that from amb-scope, bypassing the
second re-execution of the future.
|
|
|
|
|
| |
* tests/012/cont.tl: New test case. This aborts prior to
recent gc fixes.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The subtypep function has poor requirements, handling only type
symbols. Let's extend it to handle structure type objects.
* lib.c (subtypep): In all cases when an argument is considered to be a
possible structure symbol, and thus subject to find_struct_type,
consider whether it already is a struct type, and just take it as-is.
* tests/012/type.tl: New tests.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/op.tl (sys:op-meta-p): Return an extended Boolean value: a true
result is an integer indicating the depth of the variable.
For instance @1 is depth 0, @@1 is depth 1 and so on.
(sys:find-parent): New function.
(sys:op-alpha-rename): When processing a nested meta, do not
set the nested flag in the immediate parent. Use find-parent to go up to
the correct level to which the meta belongs and set the flag there.
* tests/012/op.tl: New test cases which depend on this.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The June 30 09e70c914ca83b5c7405aa633864db49f27efa05,
subject "op: refactor do handling", introduced a regression
breaking the tags.tl program. An implicit argument
gets inserted twice:
[[(do op list @1)] 'x] -> (x x) ;; incorrect/weird
This was spotted by Paul A. Patience while working on
extending tags.tl for Emacs.
It's not exactly a regression because the original
behavior is not documented or tested, and has issues;
we simply cannot roll back the commit; a proper
fix is required.
How the above call is now supposed to work is that:
- the @1 parameter belongs to the op, not to the do.
- the do therefore has no explicitly given parameters
of its own.
- therefore the do inserts its parameter.
In other words (do op list @1) is formally equivalent
to (do op list @1 @@1).
Both levels of function indirection require an
argument:
[[(do op list @1) 'x] 'y] -> (y x)
[[(do op list @1 @@1) 'x] 'y] -> (y x)
* stdlib/op.tl (sys:op-ctx): The structure gets a new slot,
nested, which is a flag indicating whether unprocessed nested
metas occur. This is critically needed because the
sys:op-alpha-rename passes which are called with
do-nested-metas being false do not insert nested metas into
the gens list; they transform them and leave them in the
syntax. Yet we must make decisions based on their presence.
Conretely, we must be able to tell that (do op list @@1)
has a meta against the outer (do ...), while we are just
processing the do.
(sys:op-alpha-rename): When replacing a nested meta syntax
with the macro invocation, we set the nested flag of the
parent context true.
(sys:op-expand): Bring back the do-gen; we need it. We cannot
simply insert @1 into the syntax, because that is not
lexically transparent. If we add @1 to (do op ...) then that
@1 is interpreted as belonging to the op, not to the do.
We must also check the new Boolean flag nested to properly
detect whether we have metas, including unexpanded nested
metas.
* tests/012/op.tl: New test cases combining (do op ...).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/012/stack.tl: The (if stack-limited ...) test is not
correct because even if gerlimit indicates an unlimited stack,
we impose a defualt limit, and so (get-stack-limit) returns a
an integer value. The idea here was to try to skip this test
case when the stack usage is unlmited, which happens under
older versions of GNU make, before posix_spawn was introduced.
Instead, let's execute this test case only if we have
setrlimit. In the forked child, we try to impose a small stack
limit that will give use the stack overflow crash we are
testing for. The objective of the test case is to validate
that when (set-stack-limit 0) is called, the child will abort
due to a signal, rather than (recur) returning :so.
|
|
|
|
| |
* tests/012/seq.tl: New tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (class_from_sym): New static function.
(subtypep): Remove special case handling of stream versus
stdio-stream. If the two types are not both structures, then
check whether they are both cobj classes. If so, check if they
are in an inheritance relationship via the cobj_hash.
(cobj_populate_hash): Map each symbol to a fixnum integer
which gives class handle'position in the cobj_class table.
(cobj_class_exists): Style: compare to nil instead of 0.
(obj_init): Do not call cobj_populate_hash here, it is far too
early: only a couple of COBJ types exist at this point.
Moreover, hash_init has not been called so hash_cls and
hash_iter_cls still have null symbols.
(init): Call obj_populate_hash here, as the last step.
* tests/012/type.tl: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Paul A. Patience discovered the hidden "feature" of
with-resourcers, that the three-argument form of the binding
(var init cleanup) causes the with-resources form to terminate
if init returns nil. The (var init) syntax doesn't generate
this logic.
* stdlib/with-resources.tl (with-resources): Do not emit the
when form unless <= 265 compatibility is in effect.
* tests/012/oop-mac.tl: New file.
* txr.1: Compat note added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* genman.txr (dupes, tagnum): Replace defvar with defvarl.
* stdlib/doc-lookup.tl (os-symbol): Same.
* tests/011/macros-3.tl (x): Same.
* tests/011/mandel.txr (x-centre, y-centre, width, i-max, j-max, n)
(r-max, pixel-size, x-offset, y-offset): Same.
(file, colour-max): Delete (unused) variables.
* tests/012/circ.tl (x): Replace defvar with defvarl.
* tests/012/stack.tl (stack-limited): Same.
* tests/012/struct.tl (s): Same.
* tests/013/maze.tl (vi, pa, sc): Delete variables. Use
function arguments instead.
(usage): Fix typo.
* tests/014/dgram-stream.tl (family): Rename to...
(*family*): ...this.
* tests/014/socket-basic.tl (socktype): Rename to...
(*socktype*): ...this.
(%iters%): Replace defvar with defvarl.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* gc.c (gc_init): We must check rlim_cur for the RLIM_INFINITY
value indicating unlimited stack, and not misuse this value as a
limit number, otherwise hilarity ensues. This reproduced on
an older platform with make 3.81, which calls setrlimit to
bring about an unlimited stack, passed on to child processes.
Because of this txr segfaulted, as a consequence of a false
positive.
* tests/012/stack.tl (stack-limited): New variable which
indicates whether there is a stack limit. If there isn't, we
avoid running the fork-based test case. Also, we set the stack
limit to 32768 so we have a limit against which to run some of
the tests.
|
|
|
|
|
| |
* tests/012/lambda.tl: Add tests where apply list supplies :
values to optional params, which must trigger defaulting.
|
|
|
|
|
|
|
|
| |
* tests/common.tl (*compile-test*): New variable.
(vtest): Compile cases via compile-toplevel if *compile-test*
is true, catching compile-time exceptions.
* tests/012/lambda.tl: Set *compile-test* true and repeat file.
|
|
|
|
| |
* tests/012/compile.tl: Add const.tl file.
|
|
|
|
|
| |
* tests/012/compile.tl: Remove suffixes from name list, and
simplify code.
|
|
|
|
| |
* tests/012/lambda.tl: New file.
|
|
|
|
| |
* tests/012/const.tl: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the case when the do syntax has no metavariables, and it
expands as-is without the addition of symbol in the tail
position, we are doing something wrong: we are adding the
@1 into the expanded version of the form, rather than
the original. For instance:
1> (expand '(do pop a))
(lambda (#:arg-1-0017 . #:arg-rest-0016)
(prog1 (car a)
(sys:setq a (cdr a))
#:arg-1-0017))
Here, the @1 was inserted into the (prog1 ...) form
which is the expansion of pop. This is incorrect;
it must be inserted into the original (pop a)
syntax as (pop a @1).
* op.tl (op-expand): In this case when there are no
metas and no do-gen that can be replaced by @1 via
symacrolet, go back to the original args syntax,
add the arg1 meta into that syntax, and process it
from the beginning through parallel expansions
steps.
* tests/012/op.tl: Couple of tests added.
|
|
|
|
|
|
| |
* tests/012/stack2.txr: This test case can prove its point in
a much smaller stack limit than the one derived from the
system default. Let's cut it to 32 kilobytes.
|
|
|
|
|
|
|
|
|
|
|
| |
* signal.c (sig_handler): For a is_cpu_exception signal, we
temporarily disable the stack limit. It might be executing on
the sigaltstack buffer, which is almost certainly below the
stack limit.
* tests/012/stack.tl: New test case. We raise a SIGSEGV
and check that in the handler, the stack limit is disabled,
and that we can executed code.
|
|
|
|
|
|
|
|
|
| |
* txr.c (do_match_line, match_files): call gc_stack_check on
entry.
* tests/012/stack2.txr: New file.
* tests/012/stack2.expected: New file.
|
|
|
|
|
|
| |
* tests/012/stack.tl: New file.
* tets/common.tl (mvtest): New macro.
|
|
|
|
|
|
|
| |
* lib.c (rmismatch): when left is an empty string or
vector, and right is nil: we must return -1 not zero.
* tests/012/seq.tl: More rmismatch tests.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib (mismatch, rmismatch): If the arguments are strings or
literals, other than lazy strings, keyfun is identity, and
equality is by character identity, the operation can be done
with an efficient loop over the wchar_t strings.
* tests/012/seq.tl: Tests for string case of mismatch, via
starts-with function. Test mismatch via ends-with, and also
directly for vectors and strings.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (cxr, cyr): New functions.
* lib.h (cxr, cyr): Declared.
* eval.c (eval_init): Intrinsics cxr and cyr registered.
* tests/012/cadr.tl: New file.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Via macros, atoms can sneak into a quasiliteral which then
blow up because they get treated as strings without being
converted.
Example:
(defmacro two () 2)
`@(two)xyz` -> ;; error
The expansion produces the invalid form, in which the 2
is subsequently treated as a string.
(sys:quasi 2 "xyz")
On the other hand, symbol macros don't have this problem:
(defsymacro two 2)
`@{two}xyz` -> "2xyz"
The reason is that the (sys:var two) syntax will expand to
(sys:var 2), and not 2.
The straightforward, consistent fix is to ensure that the
first case will also go to (sys:var 2).
* eval.c (expand_quasi): If the expanded form is an atom which
is not a bindable symbol, wrap it in a sys:var.
* tests/012/quasi.tl: Test cases added.
Also adding a compilation test for this file, cribbed from
patmatch.tl.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The recent commit 225ff2fa2fdb9e5169db5e2c06dc3b0053b775bb
titled "errors: avoid premature release of deferred warnings."
obviates the need for dealing with noise when detecting
errors from test cases.
* patmatch.tl: Remove macro-time-let around several
test cases.
* tests/012/ifa.tl: Likewise.
* tests/common.tl (macro-time-let): Macro removed.
|