| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk%--rng, sys:awk%--rng-,
sys:awk%rng+, sys:awk%-rng+, sys:awk%--rng+): New functions.
(sys:awk-mac-let): Rewritten range expander. The four basic
ranges rng, rng-, -rng and -rng- are handled with in-line
expansion, because by doing that we avoid unnecessarily
evaluating the from-expression. The remaining cases expand
to function calls to the new functions, which receive the
flag vector, the index position in that vector and the values
of the from and to expressions. The behavior change is that
that the -- forms now do the right thing: they hide all
leading records that satisfy the from-expression, right to the
last record of the range if necessary.
* tests/015/awk-rng.expected: Updated.
* txr.1: Revise semantic description the -- range types, plus
minor fixes.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (getput_set_entries): New autoload entries for
file-get-buf, file-put-buf, file-append-buf, command-get-buf
and command-put-buf.
* share/txr/stdlib/getput.tl (sys:get-buf-common): New
function.
(file-get-buf, file-put-buf, file-append-buf, command-get-buf,
command-put-buf): New functions.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is that when records appear in the middle
of the range which again match from-expr, they
get suppressed.
* share/txr/stdlib/awk.tl (sys:awk-mac-let): Get rid of the
flag-mid variable. It cannot work because middle is a state
in its own right that cannot be inferred from the existing
states (nil, t, :end) and the value of from-expr. We get rid
of the flag and introduce a :mid state value.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/op.tl (sys:op-expand): Throw error if
argument list is empty. We refer to the compile-error
function by quote to avoid triggering the auto-load of
the module which defines it, due to the circular dependency
on op.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The code is using a non-hygienic variable called flag
as a placelet alias. This binding is visible to range
expressions. For instance (rng #/x/ flag) actually
references the range expression's internal flag, rather
than producing a warning about an unbound variable.
* share/txr/stdlib/awk.tl (sys:awk-mac-let): Allocate a gensym
for the flag. Then use ,flag throughout the code templates
rather than flag to insert the gensym wherever the symbol
flag previously appeared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is an improvement in the code generation related
to awk range expressions. Previously, on each iteration,
for each range expression, the awk state structure is
accessed to retrieve the flag vector, which is then kept
in a lexical variable. With this change, the retrieval
is done once for all the range expressions, which share
the same variable to access it.
* share/txr/stdlib/awk.tl (sys:awk-compile-time): New slot,
rng-vec-temp.
(sys:awk-mac-let): Alias the flag variable to a simplified
vecref expression which accesses the vector assumed to
have been retrieved and bound to the variable named by
the rng-vec-temp gensym.
(awk): Add one more variable binding into the scope of
the ranges: the binding of the variable named by the
rng-vec-temp gensym, to an expression which retrieves the
rng-vec from the Awk run-time state structure.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys;awk-mac-let): Provide the
implementation for the local macros --rng, --rng-,
rng+, -rng+ and --rng+.
* tests/015/awk-rng.tl: New file.
* tests/015/awk-rng.expected: New file.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (op_set_entries): Add lop to auto-load list.
* share/txr/stdlib/op.tl (sys:op-expand): Recognize lop
and implement its transformation.
(lop) New macro.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A test case for this very subtle bug is this:
(let ((v (list 1 2 3)))
(symacrolet ((x v))
(flet ((x () 42))
(set [x 0] 0))))
Because x is being evaluated in the DWIM brackets which
flatten the two namespaces into one, it must be treated as a
reference to the flet, and so [x 0] denotes the function call.
The assignment is erroneous.
The incorrect behavior being fixed is that the places code
macro-expands x in the Lisp-2 style under which the symacrolet
is not shadowed by the flet. The substitution of v takes
place, and the assignment assigns to [v 0].
* share/txr/stdlib/place.tl (sys:l1-setq, sys:l1-val):
Use macroexpand-lisp1 rather than macroexpand.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (sys:l1-val): Use the expanded
version of the place in the resulting form, because some
of the operators like sys:lisp1-value will not expand it.
Previously we were getting away with (sys:l1-val @1)
expanding to (sys:lisp1-value @1) because the op expander
would traverse through this blindly and replace @1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new implementation treats the @1, @2 ... @rest
op arguments as local macros, leveraging the power of the
macro expander to perform the substitution which renames these
to gensyms.
As a result, the implementation is correct.
The old implementation blindly walks the tree
structure doing the substitution, so that @1 is substituted
even though it is in a quoted literal:
[(op list '(@1)) 42] -> ((#:arg-01-0166))
under the new implementation, '(@1) is left alone:
[(op list '(@1)) 42] -> ((@1) 42)
* eval.c (expand_quasi): Because the new op macro doesn't
rudely reach into quasi forms to substitute sys:var
elements, relying on macro expansion, we must now macro-expand
sys:var elements. The sys:var macro created by op is
smart enough to skip the compound ones that have modifiers;
they are handled via the inner expansion of the symbol.
That is to say, `@@1` contains the structure
(sys:var (sys:var 1)). The sys:var macro ignores the outer
sys:var. But existing behavior in expand_quasi expands the
inner (sys:var 1), so the substitution takes place.
(eval_init): Do not register the hacky old op and do macros,
except in compatibility mode with 184 or older.
* lisplib.c (op_set_entries, op_instantiate): New functions.
(dlt_register): Register auto-loads for op and do macros via
new functions, except when in compatibility mode with 184
or older, in which case we want the old build-in hacky op
to be used.
* share/txr/stdlib/op.tl: New file.
* txr.1: Fixed or removed no-longer-true text which hints at
special hacks implemented in the op expander. Added
compatibility notes for all new compat-switched op behaviors.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* buf.c (struct buf_strm): New struct type.
(buf_strm_mark, int buf_strm_put_byte_callback,
buf_strm_put_string, buf_strm_put_char, buf_strm_put_byte,
buf_strm_get_byte_callback, buf_strm_get_char,
buf_strm_get_byte, buf_strm_unget_char, buf_strm_unget_byte,
buf_strm_seek, buf_strm_truncate, buf_strm_get_prop,
buf_strm_set_prop, buf_strm_get_error,
buf_strm_get_error_str): New static functions.
(buf_strm_ops): New static struct.
(buf_strm): New static function.
(make_buf_stream, get_buf_from_stream): New functions.
(buf_init): Register new intrinsic functiions make-buf-stream
and get-buf-from-stream.
Call fill_stream_ops on new buf_strm_ops to fill
default operations in place of function pointers
that have been left null.
* buf.h (make_buf_stream, get_buf_from_stream): Declared.
* lisplib.c (with_stream_set_entries): Add with-out-buf-stream
and with-in-buf-stream to auto-load symbols for with-stream.tl
module.
* share/txr/stdlib/with-stream.tl (with-out-buf-stream,
with-in-buf-stream): New macros.
* txr.1: New section about buffer streams.
|
|
|
|
|
|
|
|
|
|
| |
This eliminates one incompatibility between doloop
and ANSI CL do.
* share/txr/stdlib/doloop.tl (sys:expand-doloop): Wrap body in
tagbody form.
* txr.1: Documentation updated.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/tagbody.tl (tagbody): Reduce unnecessary
use of DWIM brackets to parentheses in calculation of bblocks.
Remove entry-lbl local variable, propagating its initform
to its one and only use site.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/tagbody.tl (tagbody): Use progn for the
trivial case, and in the ordinary case, the sys:for-op
special form directly rather than the for loop maro.
sys:for-op doesn't introduce a block; the for macro is
doing that.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/tagbody.tl (tagbody): If the body contains
no labels, then emit a simple block. Note that we should just
be emitting a progn here; however, there is a bug in tagbody
in that there is an anonymous block. This is not documented,
and a consequence of the looping construct used. So for now we
preserve that behavior in the reduced case.
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (doloop_set_entries, doloop_instantiate): New
functions.
(lisplib_init): Register autoload for doloop macros.
* share/txr/stdlib/doloop.tl: New file.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Just the ANSI CL nth for lists.
* eval.c (eval_init): Register nth intrinsic.
* lib.c (nth): New function.
* lib.h (nth): Declared.
* share/txr/stdlib/place.tl (nth): New place macro,
trivially takes care of making nth an accessor.
Place macros are terrific!
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/getopts.tl (opt-desc): New entry in
valid-types, :text symbol.
(sys:opt-parsed convert-type): Handle :text case.
This is a no-op since :text applied no treatment.
(opthelp): Provide help text for :text type.
* txr.1: Documented :text getopts option type.
|
|
|
|
|
|
| |
This was broken on 2016-11-03 by the commit "Support
simple list arguments in getopts." The sys:opt-parsed
type has no type slot.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The accessors symbol-value, symbol-function and symbol-macro
can now be used to store a value to nonexistent bindings,
which brings those bindings into existence.
* share/txr/stdlib/place.tl (sys:ge-fun-getter-setter,
sys:get-vb): Don't throw exceptions for nonexistent binding
lookups: create and return the bindings instead. For methods,
use static-slot-ensure rather than static-slot-set. Thus
new methods can be defined by setting to a (meth ...) place.
* txr.1: Doc updated.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/trace.tl (sys:tr*, sys:trfm): New
variables, holding the * and format functions.
(sys:trace-enter, sys:trace-leave): Use format and *
through the aliases, so we don't trigger infinite
recursion if these are traced.
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (sys:placelet-1): Remove the
genyms called steal-getter which is not referenced.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (sys:get:fun-getter-setter):
Remove superfluous @1 from op macro syntax, on the
basis that (op function @1) is equivalent to (op function).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this change, a struct type's initfun and postinitfun
become mutable. This is achieved by modeling them as
the pseudo-static-slots :initfun and :postinitfun.
Effectively these now behave as reserved names which do not
denote static slots but these special functions.
* eval.c (lookup_fun): When (meth type slot) syntax is
encountered, treat the slot names :init and :postinit
specially: retrieve these special functions instead of
accessing static slots.
* share/txr/stdlib/place.tl (sys:get-fun-getter-setter):
Similarly, when handling (meth type slot) syntax, return
the alternative getter/setter functions for the special
functions, not the static slot accessing functions.
Also, getting rid of a useless @1 here in existing code,
since (op foo @1) is equivalent to (op foo).
* share/txr/stdlib/struct.tl (sys:defmeth): Check for
the special names :init and :postinit, handling these
through the appropriate setter functions rather than
static-slot-ensure.
* struct.c (init_k, postinit_k): New keyword symbol variables.
(struct_init): Initialize init_k and postinit_k. Register
intrinsics struct-get-initfun, struct-set-initfun,
struct-get-postinitfun and struct-set-postinitfun.
* (struct_get_initfun, struct_set_initfun,
struct_get_postinitfun, struct_set_postinitfun): New
functions.
(method_name): For each struct type visited, check
whether the function is the initfun or postinitfun
and return the appropriate meth syntax if so.
* struct.h (init_k, postinit_k, struct_get_initfun,
struct_set_initfun, struct_get_postinitfun,
struct_set_postinitfun): Declared.
* txr.1: Documented. Updated description of method-name,
defmeth, and documented new functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (make_zstruct): New function.
(ffi_init): Register make-zstruct instrinsic.
* ffi.h (make_zstruct): Declared.
* lisplib.c (ffi_set_entries): Add znew to autload list.
* share/txr/stdlib/ffi.tl (znew): New macro.
* txr.1: Documented make-zstruct and znew.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
|
|
| |
* lisplib.c (ffi_set_entries): Add deffi-sym to autload list.
* share/txr/stdlib/ffi.tl (deffi-sym): New macro.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem here is that ensure-stream ignores the mode
argument and decides between "r" and "w". That is incorrect;
the mode could be "a" for append.
The second problem is that the ignored mode strings are
also wrong. For an input pipe, "w" is specified rather than
"r".
* share/txr/stdlib/awk.tl (sys:awk-state ensure-stream): Use
the mode argument. The cases consolidate, because all that
need be distinguished here is file versus pipe.
(sys:awk-mac-let): for the <! redirection (input from pipe),
the mode must be "r", not "w".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the case when the :output clause of the awk macro opens a
stream, it isn't closing it. Why don't we treat such a stream
uniformly with redirections.
* share/txr/stdlib/awk.tl (sys:awk-state :postinit):
If a file is opened for output, then don't just install
this file as self.output. Also place it into the self.streams
hash, identified by using the key (:outf <name>), just
like a (-> "name") redirection. This ensures that it will
be closed when the awk macro terminates. It's also potentially
useful in that output redirections referring to the name will
use the same stream.
* txr.1: Documented that streams opened by :output are
closed, and that they are treated uniformly with redirections.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (ffi_set_entries): Register carray-sub
for autoload.
* share/txr/stdlib/ffi.tl (carray-sub): New place
macro, aliases to sub. This is not 100% correct since
that means it will admit non-carray objects, but
the alternative is to clone the entire sub expander
with a few changes, or else factor out sub expansion
into a shared routine. Bleh ...
* txr.1: Documented. We don't cover up the ruse we
perpetrated, and reveal that it's just a place macro
targetting sub.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TXR Lisp doesn't autoload the definition of places.
For instance if a (set (foo x) y) appears out of the
blue and foo is keyed for autoload, it doesn't happen.
The right place to fix this is to do the autload check
in the place macro expander, since every place form is
tried as a macro.
We need to expose the lisplib_try_load function as a Lisp
intrinsic.
* lisplib.c (lisplib_init): Register sys:try-load
intrinsic, mapped to lisplib_try_load.
* share/txr/stdlib/place.tl (sys:get-place-macro):
New function.
(sys:pl-expand): Use sys:get-place-macro instead of
direct lookup in *place-macro* hash. The new function
tries to autoload the symbol if it finds no place
macro for it.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/conv.tl (sys:conv-let): New
local functions c and cz, using the new #\c
radix conversion.
* txr.1: Documented new extension under the fconv
awk macro. Also fixed a typo here; the b conversion
was exemplified as (c str).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug: rng fails to activate when the to and from condition
are true for the same record.
* share/txr/stdlib/awk.tl (sys:awk-mac-let): Rename the flag-new
gensym holder to flag-act, since it indicates whether the range
is active, either from before or due to being activated by
the current record. A new gensym is added to indicate whether
the range is being deactivated in this record. The inclusive
rng range refers to this variable rather than flag-old.
But a bug emulation is provided to refer to the wrong variable.
* txr.1: Added compatibility note.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_alignof, ffi_offsetof, ffi_arraysize,
ffi_elemsize, ffi_elemtype): New functions.
(ffi_init): Registered intrinsics ffi-alignof, ffi-offsetof,
ffi-arraysize, ffi-elemsize, ffi-elemtype.
* ffi.h (ffi_alignof, ffi_offsetof, ffi_arraysize,
ffi_elemsize, ffi_elemtype): Declared.
* lisplib.c (ffi_set_entries): New autoload entries alignof,
offsetof, arraysize, elemsize, elemtype.
* share/txr/stdlib/ffi.tl (alignof, offsetof, arraysize,
elemsize, elemtype): New macros.
* txr.1: Documented new functions and macros.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
|
|
| |
* lisplib.c (ffi_set_entries): Autload entry for "deffi-var".
* share/txr/stdlib/ffi.tl (deffi-var): New macro.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/ffi.tl (deffi): Since the arity of
a foreign function is fixed, generate a fixed-argument
defun. This provides a better check on the number of
arguments than letting ffi-call detect it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_call_wrap): Take struct args * parameters
rather than a list. Check that number of arguments
matches required number from call desc. No need
to build argument array any more; we just refer to
the one in args. Also, the first two parameters
are reversed for consistency with other functions.
(ffi_init): Update registration of ffi-call to
reflect type change.
* ffi.h (ffi_call_wrap): Declaration updated.
* txr.1: Documented ffi-call.
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (ffi_set_entries): Add carray-ref to list of
autoload names.
* share/txr/stdlib/ffi.tl (carray-ref, carray-refset):
Registered function pair as a simple accessor.
* txr.1: Updated carray-ref doc.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-state loop):
Wrap a loop around around the two forms that
split the record into fields and dispatch the main
rule function. The loop repeats if the named
block returns :awk-again.
(sys:awk-mac-let): New local macro (again)
which bails out of the :awk-rec block just like (next) does,
but specifies :awk-again as the return value.
* txr.1: Documented.
|