| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
| |
Omissions reported by user vapnik spaknik.
* lib.c (subtypepe): The lcons type and string type must
report as subtypes of sequence.
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register tailp intrinsic.
* lib.c (tailp): New function.
* lib.h (tailp): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a slot is not found in a cache, and in other situations
the object system conses up a key in order to search a the
global slot_hash. We should be recycling these keys
for reuse via rcyc_cons. This change makes recompilation of
TXR's library (make clean-tlo; make) about 1.6% faster.
* struct.c (lookup_slot, lookup_static_slot_desc, static_slot_p):
Recycle the hash key cons cell via rcyc_cons, so it can be
reused immediately.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TXR user vapnik spaknik has found a swath of errors in the
documentation.
* txr.1: Fixed bugs in numerous examples, copy-and-paste
errors in syntax sections, and other typos, including *stdin*
mistyped as *std-input* in many places. A new executable code
example is provided for expand-with-free-refs to calculate the
result that was previously only verbally described. Fixed
*stdin* mistyped as *std-input* (a non-existent symbol that
imitates the internal C variable).
|
|
|
|
| |
* txr.1: Hyphenate "heap-allocated" and "stack-allocated".
|
|
|
|
|
|
|
| |
* eval.c (bindings_helper): If there are no bindings or just
one binding, then go through the sequential case. Thus trivial
let is treated like let*. This avoids the continuation-related
overheads incurred in the parallel case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was discovered by user vapnik spaknik. If a let* form is
evaluated in a top-level expression such that the incoming
environment is null, and a continuation is captured in the
init-form of the first variable, when that continuation is
invoked, an exception is thrown: "copy-env: nil is not of type
env".
Short repro:
1> (block nil (let* ((x (yield 42)))))
** copy-env: nil is not of type env
In fact, the bug isn't that we're trying to copy nil.
the problem is we are trying to copy an environment we should
not be copying at all. In fact, for sequential binding,
there is no need for that logic at all; it's only parallel
binding which needs it, because all of the init-forms are
inserting bindings into the same environment.
* eval.c (bindings_helper): Don't bother with registering a
copy handler for sequential binding logic, because we
don't mutate environments. All of that code is moved into the
parallel case.
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
| |
* chksum.c (sha256_utf8_byte_callback, md5_utf8_byte_callback):
New static functions.
(sha256_hash, md5_hash): Support character and integer
objects.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a method which is traced is redefined, a warning message
is correctly issued and the trace is removed. But the removal
is done in the wrong order and ends up restoring the old
function, clobbering the new definition.
* struct.c (static_slot_ensure): Move the trace_check before
the call to static_slot_ens_rec, so installation of the new
method takes place after the trace is removed from the old
one.
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Exception info stashed into the unhandled_ex global
pseudo-frame is not protected from gc reclamation. This
allows for use-after-free errors, that can reproduce if
unwind-protect cleanup forms that go off during the processing
of an unhandled exception trigger gc. The code which deals
with unhandled exception, like error_trace, then works with
exception arguments that are now objects on the free list.
* unwind.c (uw_init): GC-protect the exception sym and
arguments stored in unhandled_ex.
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
| |
* configure: New test for crypt_r, depositing HAVE_CRYPT_R
preprocessor symbol in config.h.
* sysif.c: Conditionally include <crypt.h> header.
(crypt_wrap): Use crypt_r if HAVE_CRYPT_R is nonzero.
(sysif_init): Register crypt intrinsic if we HAVE_CRYPT or if
we HAVE_CRYPT_R.
|
|
|
|
|
|
| |
* Makefile (TXR_CFLAGS): Use := operator rather than += when
filtering out REMOVE_FLAGS, or else REMOVE_FLAGS are not
really removed, and we duplicate all the flags.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* chksum.c (sha256_szmax_upd, md5_szmax_upd): New static
functions, consisting of logic from sha256_buf and
md5_buf, respectively.
(sha256_buf, md5_buf): Use sha256_szmax_up and md5_szmax_upd,
respectively, to handle the unlikely possiblity of the ucnum
buffer length being larger than the range of size_t.
(sha256_hash, md5_hash): Also use the new static functions
instead of callig SHA256_update or MD5_update directly
to deal with the same issue.
|
|
|
|
|
|
| |
* chksum.c (sha256_str, md5_str): Don't construct a byte input
stream for hashing a string. Just convert whole thing to
temporary UTF-8, hash, and free.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* chksum.c (sha256_ctx_s, md5_ctx_s): New symbol variables.
(sha256_ops, md5_ops): New static structs.
(sha256_begin, sha256_hash, sha256_end, md5_begin, md5_hash,
md5_end): New functions.
(chksum_init): New symbol variables initialized; sha256-begin,
sha256-hash, sha256-end, md5-begin, md5-hash, md5-end
intrinsics registered.
* chksum.h (sha256_begin, sha256_hash, sha256_end, md5_begin,
md5_hash, md5_end): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* LICENSE: Mention MD5 component.
* METALICENSE: There are more libraries than linenoise; remove
focus on linenoise and make wording generic. Add description
of the RSA situation, whereby more permissive redistribution
terms were granted by the Feb 23, 2000 memo.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile (OBJS): New object file, chksums/md5.o.
* chksum.c (sha256_ensure_buf): Renamed to chksum_ensure_buf
and made generic so MD5 code can borrow it.
(sha256_stream, sha256): Call chksum_ensure_buf instead of
sha256_ensure_buf, passing in new length and hash name
parameters.
(md5_stream_impl, md5_buf, md5_str): New static functions.
(md5_stream, md5): New functions.
(chksum_init): Register md5-stream and md5 intrinsics.
* chksum.h (md5_stream, md5): Declared.
* chksums/md5.c, chksums/md5.h: New files.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register cptr-buf intrinsic.
* lib.c (cptr_buf): New function.
* lib.h (cptr_buf): Declared.
* txr.1: Documented.
|
|
|
|
|
|
| |
* txr.1: Include blurb about the independent lifetime of a
ctpr made by cptr-obj and the original object.
If the original is garbage collected, the ctpr is junk.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To accompany find-symbol-fb, there is intern-fb, which is like
intern, but searches the fallback list.
* eval.c (eval_init): Register intern-fb intrinsic.
* lib.c (intern_fallback_intrinsic): New function. Does
defaulting and error checks, then calls intern_fallback, just
like intern_intrinsic calls intern.
* lib.h (intern_fallback_intrinsic): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We get rid of some defaulting and error checks from interning.
This saves a few cycles on startup in the large number of
intern calls that are performed.
* eval.c (eval_init): Wire the intern intrinsic to the new
intern_intrinsic function rather than intern.
* lib.c (intern): Remove package lookup and error check on str
argument.
(intern_intrinsic): New function, which has the package lookup
and error check.
(intern_fallback): Remove package lookup and error check.
* lib.h (intern_intrinsic): Declared.
* txr.c (txr_main): Fix one instance of an intern call that
relies on defaulting of the second argument, by passing
cur_package.
|
|
|
|
|
|
|
| |
* parser.l (grammar): Fix incorrect format strings that are
supposed to show an invalid input character in hex.
For instance the character 1 comes out as #\x 1 rather
than #\x01.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (parser_common_init): Initialize the ignore flag,
which was until recently called circ_suppress. When the
parser is invoked via parse_once or parse_once_noerror, rather
than parse, the state of the flag is indeterminate. Thus this
only affects the TXR Pattern Language, not TXR Lisp. As a
result of this bug, which affects releases 157 through 223,
if the circle notation like #1=(foo #1#) is used in Pattern
Language syntax, it may not be handled properly. I discovered
this bug now because there are new behaviors connected to the
flag; it doesn't just affect the processing of the circle
notation, but is involved in all symbol handling in the
parser.
|
|
|
|
|
| |
* txr.1: name must be a string, not a symbol. The optional
argument must be a package, if supplied.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Turns out, there is already a find_symbol in lib.c, completely
unused.
* eval.c (eval_init): Register find-symbol and find-symbol-fb
intrinsics.
* lib.c (find_symbol): Fix this hitherto unused function to do
correct defaulting of the package argument and, to accept an
additional argument specifying the not-found value.
(find_symbol_fb): New function.
* lib.c (find_symbol): Declaration updated.
(find_symbol_fb): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
When #; is used to ignore an object, parsing that object
shouldn't cause symbols to be interned, nor errors about
unknown packages.
* parser.y (ifnign): New macro.
(i_expr, n_expr): For SYMTOK, don't call symhlpr when parsing
under ignore flag. Just yield nil as the semantic value.
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.h (struct parser): eof flag changed to unsigned char.
circ_suppress flag renamed to ignore, changed to unsigned char
and relocated next to eof to compact together.
* parser.c (parser_circ_ref): Follow rename.
* parser.y (hash_semi_or_n_expr, hash_semi_or_i_expr, n_exprs,
parse): Likewise.
|
|
|
|
|
| |
* txr.1: Adding breadth-first traversal example showing queue
capability of the list-builder.
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
| |
* txr.1: Add discussion highlighting use of load-time for
effect staging, rather than value. Add rationale regarding the
naming difference from ANSI CL.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
* lib.h (struct seq_iter): union ul with just one member
replaced by that member itself.
* lib.c (seq_iter_get_vec, seq_iter_peek_vec, seq_iter_init):
refer to it->len instead of it->ul.len.
|
|
|
|
|
|
|
|
| |
* lib.c (lazy_where_func, where): We have a regression here
due to strangely trying to smuggle the predicate function in
si->inf.obj, which cannot possibly work other than for lists
whose seq iterators ignore that field. We switch to the trick
of using the cdr field of the lazy cons to carry that forward.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
| |
* eval.c (expand): Do not create expansion debug frames
for atomic forms, only for compound forms.
|
|
|
|
|
| |
* lisplib.c (place_set_entries): Add missing entries for
test-set, test-clear, compare-swap, test-inc and test-dec.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.h (struct lino_os): New virtual
operation, puts_file_fn: like puts_fn, but not
display-oriented: doesn't check for and ignore padding
characters, and doesn't flush after each line.
(lino_os_init): Initializer macro updated.
* linenoise/linenoise.c (edit_it_editor): Use puts_file_fn to
write to temporary file.
(lino_hist_save): Likewise, when writing out history.
* parser.c (lino_puts_file): New static function.
(linenoise_txr_binding): Add lino_puts_file to initializer
to wire in the operation.
|