| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler compile): Open up the
main caseq statement for handling symbols other than just
special operators. Now we handle the compiler-only special
operator sys:ift here, as well as the special casing for call
and apply. Function calls are handled as the fallback case
here now.
(compiler call-fun-form): Remove the checking for ift, and for
call, apply and usr:apply. Only regular case function calls
are handled here now.
(compiler comp-apply-call): New method dedicated for compiling
calls to the call, apply or usr:apply functions, dispatched
directly out of compiler compile.
|
|
|
|
|
|
|
|
| |
The compile function doesn't need to expand because the input
is a function that has already been expanded.
* share/txr/stdlib/compiler.tl (compile): Pass the second
argument to compile-toplevel to suppress expansion.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is what the recent load-time changes were grooming the
compiler toward. When we compile a lambda, we can look at the
function and variable refernces it is making. If the lambda
makes no lexical function or variable references, we can lift
that lambda into load time, so that it's instantiated once and
then re-used out of a D register. Effectively, it becomes a
top-level function.
* share/txr/stdlib/compiler.tl (compiler comp-lambda-impl):
New method, formed by renaming comp-lambda.
(compiler comp-lambda): Turned not wrapper for comp-lambda
impl which compiles the lambda, and checks for the conditions
for hoisting it into load time, which is currently done by
generating the sys:load-time-lit form around it and re-compiling.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler comp-for): If a for
loop occurs in the top level, or inside a load-time, then we
don't want to suppress the semantics of load-time for any
parts of the loop that are repeatedly evaluated. The
programmer may be doing that specifically to hoist those
calculations out of the loop. We thus bind *load-time* to nil
after compiling the initializing and test expressions.
* txr.1: New paragraph in Notes for load-time, mentioning
compiler treatment of loops and lambda. The language is
deliberately general rather than being specifically about the
for loop, because several loop constructs compile to the for
loop, and that is also subject to future changes.
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compile-toplevel): Bind
*load-time* to t, because of course initially we are in the
top level, where load-time can be eliminated.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler comp-load-time-lit):
Don't hoist constant expressions into load-time, since they
already get hoisted into a D register. Otherwise we just end
up generating load-time code that moves from one D register to
another.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
load-time forms nested in load-time forms have no special
semantics; it's wasteful to separately hoist them into load
time and store their value in their own D register.
We must be careful: this is not true if a nested form occurs
in a lambda.
* share/txr/stdlib/compiler.tl (*load-time*): New special
variable.
(compiler comp-lambda): Bind *load-time* to nil around
the compilation of the lambda, so load-time forms in the
lambda are hoisted to load time, even if the lambda itself
is wrapped in a load-time form.
(compiler comp-load-time-lit): Bind *load-time* true around
the compilation of the form. If *load-time* is already true,
then skip the special load-time logic and just compile the
enclosed form; the surrounding load-time compilation is taking
care of the load-time hoisting.
* txr.1: Document that load-time forms nested in load-time
forms don't do anything, except in the lambda case.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler comp-load-time-lit):
When compiling the load-time argument expression, indicate the
allocated D register as the destination, rather than using a
freshly allocated T register. Now we need an instruction to
move into the D reg only if the fragment chose a different
register.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/socket.tl (sys:in6addr-condensed-text):
Rewrite with regex based implementation that formats
the number without condensing. This one has better
semantics in that it finds the longest run of 0.0..0
to replace, rather than the leftmost. Ignoring this
semantic difference, it also has better average performance on
pseudo-random addresses, with similar performance on
addresses with long condensable 0's. The original algorithm
has a significantly poorer average case on random addresses,
but better best case on condensable zeros like 1::1.
The new algorithm could improve further with future work to
make regexes faster.
|
|
|
|
|
|
|
|
| |
The str-in6addr and str-in6addr-net functions mishandle
the zero address, rendering it as ":" instead of "::".
* share/txr/stdlib/socket.tl (sys:in6addr-condensed-text):
Test for the degenerate case and map it to "::" output.
|
|
|
|
|
|
|
|
|
|
| |
* 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 (%bin-op%): Specify default
value argument to relate so that arguments not found in
%nary-ops% will match to nil. Otherwise the code in
comp-fun-form rewrites all two-argument function calls through
this relation, resulting in a bit of wasted consing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler comp-if): The two and
three argument cases assume that if the test is a constant
expression, the consequent "then" should be unconditionally
taken. The correct behavior is to evaluate the constant,
which could yield nil. I checked which library code changes
after this fix, and found that a number of (defset ...)
forms are generating different, shorter code.
This is due to (if ',restpar (if (consp ,restpar) ...))
in defset-expander. The intent there was to eliminate the
inner if code entirely if respar is nil (there is no rest
parameter); due to this bug, the code elimination didn't
happen. The behavior is nevertheless correct because the
code does nothing if restpar is nil.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/path-test.tl (do-path-test): Pass all
argument types to statfun, except if they are of type stat.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (copy_file_set_entries): Register autoload for
touch.
* share/txr/stdlib/copy-file.tl (touch): New function.
* txr.1: Documented.
|
|
|
|
|
|
| |
* share/txr/stdlib/except.tl (ignwarn): Warnings have more
than one argument; the handling lambda must take variable
args.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/path-test.tl (do-path-test): Check also
for the argument being a stream, and pass to statfun.
* txr.1: Documentation updated and improved.
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (dump-compiled-objects):
Fixed incorrect value of self variable.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (propagate-perms): New
function.
(compile-file-conditionally): If the source file is a hash
bang script, then call propagate-perms just before closing
the streams.
* txr.1: Documented the permission propagation.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An option declared as (cumul <type>) indicates that it is of
type <type>, and that multiple occurrences of the option
produce values that are accumulated into a list.
The accumulation is in reverse order: the rightmost
occurrence ends up the first in the list.
* lisplib.c (getopts_set_entries): Add cumul to list of
interned symbols, so that the getopts.tl code isn't mistakenly
working with sys:cumul.
* share/txr/stdlib/getopts.tl (opt-parsed): New slot, cumul.
(opt-desc basic-type p, opt-desc list-type-p, opt-desc
cumul-type-p): New methods.
(opt-desc check): Rework type validity check using the new
methods.
(opt-parsed convert-type): Support 'cumul type by
instantiating an opt-parsed object for the wrapped type,
and stealing its converted argument into the current object,
and setting the cumul flag.
(opts add-opt, option-base add-opt): Support options that have
the cumul flag set by accumulating list values. The code is
different due to different amounts of encapsulation. The opts
structure stores the raw opt-parsed objects, whereas
option-base just takes the decoded values.
(opthelp): Parse through the (cumul ...) type syntax, so
cumulative options are printed in the help text the same way
as if they were non-cumulative.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/getopts.tl
(sys:opt-processor parse-shorts): There is a scoping mixup
here with the opts argument shadowed by a same-named
lexical variable, causing a referential mixup.
Also fixed bad indentation.
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler compile): If the form
isn't an atom, then consp is implied.
|
|
|
|
|
|
| |
* share/txr/stdlib/copy-file.tl: Remove execute permissions
that had been accidentally applied before this file was placed
under version control.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/getput.tl (file-place-buf): Instead of "r+"
mode, use the new "mb" mode which will create the file without
truncating it, and open for write mode. Also, bugfix: the
"b" option was missing.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Like file-put-buf but doesn't overwrite the file.
* lisplib.c (getput_set_entries): New autoload for
file-place-buf.
* share/txr/stdlib/getput.tl (file-put-buf): New
argument for seeking into the file.
(file-place-buf): New function.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/getput.tl (sys:get-buf-common): Take two
more arguments for maximum bytes to read and offset.
Read loop simplified with fill-buf-adjust.
(file-get-buf, command-get-buf): Take two new arguments,
pass though to sys:get-buf-common.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (copy_file_set_entries): Add chown-rec and
chmod-rec to list of symbols that trigger auto-load of
copy-file.tl.
* share/txr/stdlib/copy-file.tl (chmod-rec, chown-rec): Neew
functions.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/copy-file.tl (copy-file): Detect that
from-path is a directory before attempting to open it. The
issue is that the open will succeed for a directory, and only
the subsequent read will fail. By that time we have opened
created the target file.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (copy_file_instantiate, copy_file_set_entries):
New static functions.
(lisplib_init): Register auto-load of copy-file.tl via
new functions.
* share/txr/stdlib/copy-file.tl: New file.
* txr.1: New section Unix Filesystem Complex Operations.
Here copy-file, copy-files, copy-path-rec and remove-path-rec
are documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler comp-catch): Compile
the try expression and the description in the newly extended
environment rather than the original environment. This is
necessary because the compiled code for both of these is
is placed into the frame level corresponding to the new
environment. Other than the level, the only difference between
the two environment is that nenv has a couple of gensyms.
Thus it is hygienic w.r.t. the try and desc code; the extended
environment can safely be used.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/with-resources.tl (with-resources):
Rearrange tree-case cases to recognize a sequence of cleanup
forms and insert into the output accordingly.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, alloca.h, args.c,
args.h, arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h,
chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c,
ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c,
glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c,
lib.h, linenoise/linenoise.c, linenoise/linenoise.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c,
regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/debugger.tl, share/txr/stdlib/defset.tl,
share/txr/stdlib/doloop.tl, share/txr/stdlib/error.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/param.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/pmac.tl, share/txr/stdlib/save-exe.tl,
share/txr/stdlib/socket.tl, share/txr/stdlib/stream-wrap.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl,
share/txr/stdlib/termios.tl, share/txr/stdlib/trace.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/vm-param.tl,
share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, tree.c, tree.h,
txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c,
vm.h, vmop.h, win/cleansvg.txr: Extended copyright notices
to 2020.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new function only compiles a file if the output file doesn't exist
or is out of date.
In addition, both compile-file now deletes the output file if
compilation fails, and has a documented return value.
* lisplib.c (compiler_set_entries): Add autoload entry fro
compile-update-file.
(open-compile-streams): Accepts a third argument: a function to test the
input stream against the output path. The output file is opened, and the
streams are returned, only if that test function returns true.
Also, a third element is returned: the output path. This lets the
caller to know what to delete, if the output file must be deleted.
(compile-file-conditionally): New internal function, formed from
compile-file. Takes an extra argument, the test function to pass to
open-compile-streams. Compilation is skipped if open-compile-streams
returns nil. Internals reshuffled a bit. If compilation doesn't set the
success flag, then the with-resources logic now removes the output file
in addition to closing the output stream. Prior to setting the success
flag, we flush the output stream.
* txr.1: Documented new function, all return values, and deletion of
output file on unsuccessful compilation.
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/getopts.tl (sys:option-base): New struct
type, holding the boiler-plate methods and slots that were
generated into the user-defined struct by
define-option-struct.
(define-option-struct): Inject the required properties by
inheritance from sys:option-base, greatly reducing code bloat
in the macro. The slot hash and opt-desc-list static slots
have to be redefined in the derived structure so that type has
its own instance of them.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Multiple inheritance is too useful to ignore any longer.
* lib.c (subtypep): Perform subtypep calculation between two
struct types via the new struct_subtype_p function.
It's too complicated now to do with ad hoc code outside of
struct.c.
* share/txr/stdlib/struct.tl (defstruct): This macro now needs
to deal with the super argument being possibly a list of base
types instead of a single one.
* strut.c (struct struct_type): Member super and super_handle
are removed. New member nsupers, supers, and sus.
(struct_init): The super function re-registered; it has an
optional argument.
(call_stinitfun_chain): The compat code here must now access
the supertype differently. We don't bother dealing with
multiple inheritance in the compat case; programs requesting
compatibility with TXR 151 shoudn't be trying to use multiple
inheritance.
(get_struct_handles, count_super_stslots, get_super_slots,
find_super_for_slot): New static functions, to off-load some
new complexity from make_struct_type.
(make_struct_type): Handle the increased complexity due to
multiple inheritance.
(super): Takes an additional argument now, to request which
supertype to retrieve. Defaults to zero: the first one.
(struct_type_destroy): Free the sus array.
(struct_type_mark): Mark the supers slot.
(call_initfun_chain): Call init functions of all bases, in
right-to-left order.
(call_postinitfun_chain): Likewise for postinit functions.
(call_super_method, call_super_fun, super_method): Use the
first base as the supertype. This requirement feels bad; it
needs to be revisited.
(do_struct_subtype_p): New static function.
(struct_subtype_p): New function.
(ancestor_with_static_slot): New static function.
(method_name): Revised for multiple inheritance; now relies on
ancestor_with_static_slot to find the original ancestor that
has brought in a method, so we can use that type in the
method name.
* struct.h (super): Declaration updated.
(struct_subtype_p): Declared.
* tests/012/oop-mi.expected: New file.
* tests/012/oop-mi.tl: New test cases.
* txr.1: Revised in order to document multiple inheritance.
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (path_test_set_entries): Autoload entry for
path-dir-empty.
* share/txr/stdlib/path-test.tl (path-dir-empty): New
function.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (operand-to-sym): Use decimal
with no leading zeros for t and d registers. Only the v
registers use hex, because that helps unravel their level
structure. The data table is dumped with decimal numbering, so
the d registers being decimal makes it easier to cross-ref.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/getopts.tl (opthelp): Use a different line
breaking approach for literals: the escaped space is now at
the end of the previous line, rather than at the start of the
next line, which looks nicer. We don't do this for the option
type legend, because that has some instances of leading space
alignment, which requires a leading backslash.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This provides more streamlined option processing.
* lisplib.c (getopts_set_entries): Add auto-load entry for
define-option-struct.
* share/txr/stdlib/getopts.tl (define-option-struct): New
macro.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The reason for this rename is that add is a public symbol in
the usr package, thanks to the build macro. This will
interfere with an upcoming feature under which options appear
directly as struct slots, defined by symbols. If a user
defines an --add option using the symbol add, it will clash
with the add method. But add-opt will be sys:add-opt.
* share/txr/stdlib/getopts.tl (opts add): Rename to add-opt.
(sys:opt-processor parse-long, sys:opt-processor
parse-shorts): Follow rename.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The methods of sys:opt-processor pass down an argument called
out which is an opts instance that is created in parse-opts.
In this patch, we move that argument into a new slot of the
sys:opt-processor object, named opts. We instantiate the opts
structure in the getopts function instead. The motivation here
is that (meth sys:opt-processor parse-opts) doesn't know which
type of opts object it is working with; its user is now
responsible for instantiating the object and installing it as
the opts slot.
* share/txr/stdlib/getopts.tl (sys:opt-processor): New
slot, opts.
(sys:opt-processor (parse-long, parse-shorts): Drop out
argument; refer to me.opts instead of it.
(sys:opt-processor parse-opts): Don't instantiate opts object
here, and don't pass it to parse-long and parse-shorts which
no longer take that argument. Rather, rely on it already being
installed into the opts slot.
(getopts): Instantiate opts here, and specify it as the opts
slot of the sys:opt-processor object also being instantiated
here.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/getopts.tl (opts): opt-processor slot
removed.
(sys:opt-processor parse-opts): When instantiating opts, do
not initialize the opt-processor slot with a backpointer to
self object. It is not referenced anywhere.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/getopts.tl (opthelp): Use symbol-name to
get the string representation of type keywords instead of
tostringp, so there is no leading colon. In the type legend,
we don't have any colon. For instance --gravity=FLOAT rather
than --gravity=:FLOAT.
|