| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure (have_sys_stat): New variable. Set to y when our
test detects <sys/stat.h>. New test added for the presence of
high resolution time stamps in struct stat. If we have these,
we #define HAVE_STAT_NSEC 1 in config.h.
* share/txr/stdlib/path-test.tl (path-newer): Compare
nanosecond parts of the modification time if the seconds are
equal, improving the resolution of the test.
* sysif.c (atime_nsec_s, mtime_nsec_s, ctime_nsec_s): New
symbol variables.
(stat_to_struct): If nanosecond resolution is available, set
the new nanosecond slots from the three tv_nsec fields in
struct stat. Otherwise, set the new slots to zero.
(sysif_init): Initialize the new symbol variables. Add the
three new slots to the stat struct.
* sysif.c (atime_nsec_s, mtime_nsec_s, ctime_nsec_s):
Declared.
* txr.1: Documented new atime-nsec, mtime-nsec and ctime-nsec
slots of stat structure. Added note to path-newer mentioning
high resolution support.
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A few macros in the library are local; they are needed only
inside functions in the same module. This means they are not
referenced by anything once those functions are compiled; we
should not be carrying the compiled versions of these macros
into the image. We wrap these macro definitions with
eval-only, telling the compiler not to emit their compiled
version into the output file.
* share/txr/stdlib/asm.tl (with-lev-idx, defopcode,
defopcode-derived): Wrap macro with eval-only.
* share/txr/stdlib/compiler.tl (compile-in-toplevel):
Likewise.
* share/txr/stdlib/path-test.tl (sys:path-test): Likewise.
|
|
|
|
|
|
|
|
|
|
| |
This is a left-argument-inserting syntactic sugar for do.
* lisplib.c (op_set_entries): Add auto-load entry for ldo.
* share/txr/stdlib/op.tl (ldo): New macro.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It was reported by astute user vapnik spaknik that the
documentation says thing about the do operator which are
not actually true in the implementation. I've decided that
one of them should be true, and so both implementation
and documentation are changing.
The documentation claims that (do set x) will produce
a function that can be called with one argument; that
argument will be assigned to x. That doesn't work, but this
commit will make it work.
The documentation has this example transformation:
(do + foo) -> (lambda rest (+ foo . rest))
that cannot be made to work because do works with macros
and special operators to which arguments can't be dynamically
applied. This patch will not make the above work; instead
the example is corrected.
How do is going to work inow is that (do sym ...) syntax in
which no implicit variables appear will be equialent
to (do sym ... @1). The generated variadic function has one
required argument which is implicitly added to the syntax.
Obviously, that only works if that positon of the syntax
is an evaluated form or place.
Values of the -C option equal to 225 or less will restore
the old do behavior.
* share/txr/stdlib/op.tl (sys:op-expand): Support the new
style of do, subject to backward compatibility. A hack is
required here. We cannot discover the @1, @2 .. variables
in the syntax until we fully expand it. But that code walk
requires the syntax to be valid. For instance if (do set x) is
specified, with the expectation that it is equivalent to
(do set x @1), we cannot process that by code walking (set x).
(set x) is invalid syntax. What we do is to *try* expanding
it as (set x). If that doesn't work, we add a dummy gensym
to the form to produce (set x #:gNNNN) and try expanding that.
In that case, rather than adding @1 to the form, we replace
the dummy gensym with @1. The algorithm is careful not to
accidentally conceal real syntax errors in the form.
If the form without the dummy gensym fails to expand, and
the one with the dummy gensym expands fine but contains
references to implicit parameters (@1, @2, ... @rest),
we expand it again without the gensym and allow the error
to propagate. Other aspects of this change are fairly trivial.
Because the do logic possibly introduces a @1 that doesn't
exist, near the end of this function we have to bind another
metas variable which has an up-to-date copy of the gens slot.
(op-ignerr): New macro; we can't use ignerr because that
will create a bootstrapping cycle; ignerr expands to catch,
and the catch macro uses do. Wrapping this in eval-only,
since we don't need an op-ignerr macro in the compiled image.
* txr.1: Documentation revised and updated. Differences
between do and op put clarified and put into point form.
Bad do examples corrected. Syntax of do now shown as having
a required parameter that is an operator. Compat notes added.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/vm-param.tl (%max-lambda-fixed-args%): New
symbol macro.
* share/txr/stdlib/compiler.tl (compiler comp-lambda): If the
nubmer of fixed parameters exceeds %max-lambda-fixed-args%,
then issue a warning.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (defset_set_entries): Autoload entries for left,
right and key.
* share/txr/stdlib/defset.tl (left, right, key): New
simple-form defsets.
* tree.c (set_left, set_right, set_key): New functions.
(tree_init): Register intrinsics set-left, set-right and
set-key.
* tree.h (set_left, set_right, set_key): Declared.
* txr.1: key, left and right classified as accessors.
Documented set-key, set-left and set-right.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Within the op syntax, the new implicit variable @rec
now refers to the function itself. There is also @(rec ...)
for calling the function through a function binding.
For instance, here is Fibonacci:
(do if (> @1 1) (+ @(rec (pred @1)) @(rec (ppred @1))) 1)
* share/txr/stdlib/op.tl (sys:op-ctx): New slots rec and
recvar.
(sys:op-rec-p, sys:op-ensure-rec): New functions.
(sys:op-alpha-rename): Check for the new syntaxes and
translate to appropriate gensymed expressions, while updating
the context structure, so the expander is informed about
the @rec or @(rec ...) activity in the expression.
(sys:op-expand): Check whether @rec or @(rec ...) has
been used in the expression, and generate the necessary
variants to support it. We need to bind the lambda to a
recursive binding using the same mechanism that labels
uses, and possibly to bind the gensym underneat @rec
to the value of that function binding.
* txr.1: op documentation extended to cover the new
feature, plus some wording improvements.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a symbol-function form is used as a syntactic place,
the generated code makes a run-time call to
sys:get-fun-getter-setter. A recent commit changed the
interface of this function, which means that such code
which has been previously comipled (or somehow retained
in macro-expanded form) will break.
* share/txr/stdlib/place.tl (sys:get-fun-setter-getter):
Change the interface so it's backward compatible with the old
one: the first argument is the symbol, like before, and
thanks to optional arguments, it can be called with just that
argument.
(defplace symbol-function): Generate code to call
sys:get-fun-setter-getter accordingly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|