| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (lookup_fun): Check for a lambda expression and
return a faked binding containing the interpreted function.
(do_eval, op_fun): Remove checks for lambda that are now
being done in lookup_fun. In many other places where
lookup_fun is used, we still need lambda checks, like
in the expander.
* share/txr/stdlib/place.tl (sys:get-fun-getter-setter): Take
form argument. Diagnose assignments to lambda, and to unknown
function place syntax.
(defplace symbol-function): Pass sys:*pl-form* to
sys:get-fun-getter-setter as form argument.
* txr.1: fboundp and symbol-function doc updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Oops! We have many instances of compile-error being called
in the old way with a format string as its first agument,
instead of a context argument.
* share/txr/stdlib/ifa.tl (ifa): Take :form argument, pass to
compile-error. Let's call this "fix M".
(sys:if-to-cond): Add form parameter, pass to compile-error.
Let's call this let's call this "fix F".
(conda, condlet): Fix M.
* share/txr/stdlib/place.tl (sys:*pl-form*): New special
variable. We need this in order to communicate the real place
form to the place expander, similarly to how we communicate
the original environment using sys:*pl-env*.
(call-update-expander, call-clobber-expander,
call-delete-expander): Bind sys:*pl-form* to the unexpanded
place.
(shift, lset): Fix M.
(defplace fun): Arrange for value of sys:*pl-form* to be
passed to compile-error. Let's call this "Fix P".
(sys:get-mb): Fix F.
(defplace symbol-macro): Fix P.
(placelet*, placelet): Fix M.
* share/txr/stdlib/txr-case.tl (txr-case-impl): Fix M.
* share/txr/stdlib/with-resources.tl (with-resources): Fix M.
|
|
|
|
|
| |
* share/txr/stdlib/op.tl (sys:op-expand): Replace ^(,*args)
with just args.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/build.tl (list-builder add,
list-builder pend, list-builder pend): Refer to previously
cached variable holding self.head or self.tail, instead of
re-accessing the slot.
|
|
|
|
|
| |
* share/txr/stdlib/build.tl (list-builder pend): Use tailp
instead of last and eq.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/build.tl (list-buider pend*): Fix typo:
apply should be append. Funny, this didn't propagate to ncon*.
* tests/012/seq.tl: Some list-builder tests via build macro.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rewriting be addition, pending and nconcing methods of
list-builder to avoid loops and rely on lower list processing
functions. This cleans up the semantics and error messages.
Some examples of behavioral changes:
(build (pend "abc") (add #\d)) now returns "abcd",
consistent with (append "abc" '(#\d)).
Previously it returned '(#\d).
(build (add 1) (pend 2) (pend 3)) now produces a "cannot
append to 2" error.
Previously it produced "copy: cannot copy object of type fixnum".
* share/txr/stdlib/build.tl (list-builder add): Don't use
copy-list; rather the idiom for copying a sequence in
preparation for appending to it is (append x nil). This will
blow up nicely if x is an atom other than nil. We use
this trick twice.
(list-builder add*): Simplify with append.
(pend, pend*, ncon): Rewrite.
(ncon*): Use nconc once on a combined argument list: this is
borrowed from the rewritten pend*.
* txr.1: Documentation updated with clarifications,
particularly in the area of the requirements regarding
destructive manipulation and substructure sharing.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/build.tl (list-buider add,
list-builder add*, list-builder pend, list-builder pend*):
Use copy-list rather than copy. This copies terminating
atoms without complaining.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The list builder is failing on the documented example
(build
(add 1 2)
(pend (get))
(pend (get)))
-> (1 2 1 2 1 2 1 2)
wrongly constructing an infinite list.
* share/txr/stdlib/build.tl (list-builder pend): When
destructively appending the next argument, check whether
the current tail is a tail of that object. If so, copy
the object to prevent a cycle from forming.
(list-builder pend*): When appending the old head to the
catenated list, do the tail check and copy the object if
necessary to prevent the creation of a cycle.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (expand-bind-mac-params):
Remove the plen gensym. We don't need to store the form length
in a variable, because the generated length check code
references the value exactly once. Let's just propagate that
the length calculating expression into that code.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Virtual machine local variables registers don't require
nil initialization. In cases when a complex variable
initializer is known to return nil, we can elide the move
instrution which moves that nil into the register.
* share/txr/stdlib/compiler.tl (null-reg): New function.
(compiler comp-let): Don't move the value of the output
register of the init fragment into the variable, if that
register is the null register t0.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (expand-bind-mac-params):
Generate better Lisp code when presence indicating variables
on optional parameters are not used. It's possible to bind the
variable directly, instead of binding to nil and assigning it.
The cases are split accordingly.
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (expand-bind-mac-params):
Allocate the curs gensym only when about to recurse over a
nested parameter list, rather than unconditionally. Otherwise,
we always end up allocating one more gensym than we actually
use, for a lower nesting level that might not be there.
Don't use unwind-protect for returning the cursor variable to
the free-list; it makes no sense to be recovering that since
any exception will be abandoning this function entirely.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/trace.tl (sys:trace-redefine-check): Move
the sys:untrace call before the warning throw. That throw
doesn't return; it ends up transferring control to the
continue catch, and so the untrace is skipped.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The destructuring binder binds all of the variables in the
template to nil values and then assigns to them as it walks
the object that is being destructured. Unfortunately, this
results in incorrect treatment of init-forms, which are
evaluated in the wrong scope. They are actually evaluated in
completely the wrong scope due to the use of up:env, but the
problem can't be fixed by removing up:env.
The approach here is to generate a big let* construct that
binds the variables in sequence, rather than assigning to
them.
* share/txr/stdlib/compiler.tl (expand-bind-mac-params):
The basic structure of the code remains the same, but the
details are rewritten. Instead of emitting a body of forms, we
emit let* bindings. Because some of the logic requires
imperative statements, like stepping pointers through the
destructured object, these are mixed into the variable
initializations via progn. The local functions emit-stmt and
emit-var provide the interface for doing this. There is a bit
of trickery in the situation that an optional parameter also
has the presence-indicator variable. We must bind the
parameter in an environment in which that presence-indicator
variable is not yet visible. This is achieved by binding the
variable to a nil value, and then binding the presence
indicator to an expression which sets the variable's value as
a side effect, and yields a Boolean value that initializes the
indicator.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the (set arg :) form is processed by a compiled version
of the set operator, it blows up with "set: arguments must be
pairs". This is because the compiled destructuring code is
wrongly trying to apply special treatment to a colon symbol
argument to an optional parameter. It is documented that such
such treatment only happens in function calls, and not in the
binding of macro parameter lists. Interpreted macro param
binding gets it right.
* share/txr/stdlib/compiler.tl (expand-bind-mac-params): Do
not treat a : element in the structure as a missing optional
argument, but as an ordinary value.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (expand-bind-mac-params):
A nested destructuring error must be reported against the
local parameter list, not the top-level one. The
bind-mac-check call muts use the local par-syntax, not
the original top-level params.
|
|
|
|
|
|
|
|
|
|
|
| |
An infinite for loop in which the test is explicitly given as nil
rather than omitted fails to compile. A minimal repro test
case for this is (compile-toplevel '(for () (nil) ()))).
Spotted this while reading the compiler code.
* share/txr/stdlib/compiler.tl (compiler comp-for): Test the
test-p variable, not test, to determine whether or not to
generate the loop skip label.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/build.tl (list-builder): Methods add, add*,
pend, pend*, ncon and ncon* return nil.
* txr.1: Updated documentation to state that these methods
return nil, rather than an unspecified return value.
Improvements in build macro documentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (build_set_entries): Add buildn for autload, and
intern del and del* symbols.
* share/txr/stdlib/build.tl (list-builder): New methods del
and del*.
(sys:list-builder-flets): Generate flet for del*.
(sys:build-expander): New function, consisting of expansion
logic previously in build function. Macrolet added for del.
(build): Call sys:build-expander.
(buildn): New macro.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (usr:compile-file): recognize
sys:load-time-lit as a top-level form and recurse through to
compiling its constituent form. We check the flag whether the
syntax had already been processed by the evaluator, though
that currently cannot possibly happen for a form that has just
been parsed from a file by compile-file itself.
* txr.1: Defintion of top-level form (from compile-file POV)
updated. Documentation of load-time updated.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (comp-inline-lambda): Pass nil
to new argument of lambda-apply-transform, indicating
top-level call.
(lambda-apply-transform): Takes new argument indicating
whether it's a recursive call. If the apply list expression is
constant, then it is evaluated and treated as a list of
arguments which are then turned into quoted constants
individually and passed as fixed args in a recursive call.
This eliminates the generation of code dealing with run-time
evaluation and destructuring of the apply arguments.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (lambda-apply-transform): We
conditionally generate the outer let as an alet, if there are
no shadowing issues. The shadowing test is very conservative:
the intersection between the argument expressions and the
lambda symbols must be empty. Also, we move the gensym for
the apply list expression into the let*, because we need a
real storage location that we can pop.
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (pop): Use alet for binding the
temporary rather than let, so that if (,getter) expands to a
symbol, it will disappear.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (lambda-apply-transform): The
expander fails to observe left-to-right evaluation because if
the trailing argument form is present, it is evaluated first,
even though it is the last argument. Also, the argument
evaluations are wrongly interleaved among the default
expressions for optional arguments; they must be evaluated
firt. We fix all this by allocating gensyms for all of the
fixed argument forms, and binding these via an extra let
wrapped around the output let* form. When generating the let*
we refer to the gensyms instead of the original fixed
arguments. This extra let needs optimizing, but it can't just
be converted to an alet because of scoping issues.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (lambda-apply-transform): The
gensym for binding the trailing argument expression must be
bound before any of the parameters, otherwise the expression
is exposed to the scope of the parameters that have been
emitted so far. We use add* to put it at the front.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The compilation of lambdas that are immediately called or
applied is missing the support for the Boolean parameters
that indicate whether optional arguments are present.
* share/txr/stdlib/compiler.tl (lambda-apply-transform):
Check whether the opt parameter items from the
fun-param-parser object have a third element, the indicator
variable, and emit the binding for it. This has to be done in
all three cases: optional parameter statically present,
statically missing, and dynamically determined from run-time
apply list of unknown length.
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (usr:compile-file): Remove
useless one-argument use of or operator.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If sizeof is given an extra argument (an expression which
evaluates to an object), it can calculate the dynamic size of
the FFI type in relation to representing that object.
* ffi.c (dyn_size): New static function.
(ffi_init): Register sys:dyn-size intrinsic.
* share/txr/stdlib/ffi.tl (sizeof): Support additional
argument, avoiding run-time compilation of the type expression
with the help of load-time.
* txr.1: Update documentation for sizeof macro.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (usr:compile-file): If a
top-level form is compiled that is an atom, don't emit the
translation, since it has no effect (beyond interning the
symbol).
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (usr:compile-file): do not
silently ignore forms that (after macroexpansion) are atoms;
treat them like any other forms. This is mostly useless, but
if unbound variables are used as top-level forms, it is
diagnosed, and keeps the file compilation behavior closer to
interpreted semantics.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/except.tl (catch**): Obtain macro
environment and pass to constantp.
* share/txr/stdlib/place.tl (last, butlast): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the keyword parameter list contains a mixture of constant
and non-constant default value expressions, the order of the
extracted keys is scrambled, so values go to the wrong
variables.
* share/txr/stdlib/keyparams.tl (sys:build-key-list): Renamed
to build-key-list-expr and rewritten to preserve the key
order.
(:key): Follow rename of build-key-list.
|
|
|
|
|
|
| |
* share/txr/stdlib/keyparams.tl (sys:build-key-list): Take
macro environment parameter, and pass to constantp.
(:key): Pass macro environment to sys:build-key-list.
|
|
|
|
|
|
| |
* share/txr/stdlib/defset.tl (defset-expander): Move
with-gensyms to outermost scope so we can include nvsym in it,
avoiding the explicit (nvnsm (gensym)) binding.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Users of defset no longer have to ensure that in the store
form, the symbol which gives the new value to be stored is
inserted only once.
* share/txr/stdlib/defset.tl (defset-expander): Transform the
store form by inserting a temporary variable using alet.
(sub-list, sub-vec, sub-str): These place forms no longer
require a local gensym.
* txr.1: Updated doc.
* tests/012/defset.tl: The expected output for the inc case
now incorporates a gensym that comes from the compiled
defset macro. Since we can't control that by means of the
gensym counter, we resort to extracting it from the expansion
itself, then check the test case against a template which
incorporates that gensym. We check that the extracted item
really is a gensym: it's a symbol with no home package whose
name starts with "g".
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (sys:new-expander): The
syntax (lnew (type boa args ...)) is not being handled
at all due a typo in the case. Moreover, the
syntax (lnew type slot0 val0 slot1 val1 ...) is broken
due to a missing unquote on the type gensym in the
output template.
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (usr:dump-to-tlo): This
function has no reason to be named by a usr package symbol.
Renaming to sys:dump-to-tlo.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (defset_instantiate): Add sub-list, sub-vec and
sub-str symbols as autoload triggers for defset.tl.
* share/txr/stdlib/defset.tl (sub-list, sub-vec, sub-str): New
syntactic places defined with defset.
* txr.1: sub-list, sub-vec and sub-str documented as
accessors.
|
|
|
|
|
|
| |
* share/txr/stdlib/ffi.tl (carray-sub, sub-buf):
Unfortunately, defset doesn't arrange for the new value to
be evaluated once; we must do it.
|
|
|
|
|
|
| |
* share/txr/stdlib/defset.tl (defset-expander):
Reduce (,*params) to ,params, which is parallel with the ,args
that it matches.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/defset.tl (defset-expander): In code that
binds user-supplied variables and contains a user-supplied
form that refers to those variables, we can't use code like
(op list (gensym)) or [mapcar car ...]. These are susceptible
to capture of the symbols list and car.
|