| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
What happens if a FFI closure intercepts an exception, returns
to the foreign code, but that caller does not return to Lisp
where the exception will continue? Suppose the caller invokes
another closure. In that situation, the lingering value of
the s_exit_point variable causes problems for FFI calls.
An example of this is callbacks from an event dispatching
framework such as a GUI. When these callback closures return,
control returns to the event loop, which itself doesn't
immediately return to Lisp code. Rather, it processes more
events and invokes more callbacks.
* ffi.c (ffi_closure_dispatch_safe): One thing we can do
is clear s_exit_point whenever we dispatch a closure.
|
|
|
|
|
|
|
| |
* ffi.c (ffi_closure_dispatch_safe): When initially clearing
a return value that has release semantics, use the padded
size, not the nominal size. Let's get calculate this once and
put it in a local.
|
|
|
|
| |
* ffi.c (pad_retval): If the size is zero, don't pad it.
|
|
|
|
|
|
| |
* ffi.c (ffi_make_closure): Fix wrong argument defaulting on
safe_p_in parameter, which leaves it always true, preventing
unsafely dispatched closures from being created.
|
|
|
|
| |
* txr.1: Run-on period on identifier; extra words.
|
|
|
|
|
| |
* lisplib.c (ffi_set_entries): Add missinig autoload entry for
deffi-cb-unsafe.
|
|
|
|
|
|
|
| |
* ffi.c (make_zstruct): Don't convert zeros to a Lisp type and
don't try to set the slot, if the slot name is nil. That's a
padding slot which doesn't exist in the Lisp type; the slotset
will blow up on it.
|
|
|
|
| |
* ffi.c (make_zstruct): space around assignment operator.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A null byte in regex and string literals is being processed as
a #\nul instead of correctly turning into #\pnul. Bad UTF-8 is
not being rejected.
* parser.l (REGCHAR, LITCHAR): Use utf8_from_buffer to
properly convert yytext using its true length, rather than
utf8_from which assumes a null-terminated string. Thus
null bytes (including the case of a yytext being single NUL)
are handled properly. Check that the result is exactly one
character (null-terminated buffer, two characters wide).
* utf8.c (utf8_from): Unused function removed.
* utf8.h (utf8_from): Declaration removed.
|
|
|
|
|
|
|
| |
* linenoise.c (edit_insert): In the optimized insertion case
at the end of the buffer in multi-line mode, we must render
control characters in the same manner as in the slow refresh
case: namely, with the caret notatiion: ^@, ^A, ...
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (sync_data_to_buf): The null character
appears from the stream as 0xDC00. We must test for that and
render it as ^@, counting a a width of two, rather than
sending it to the terminal, counting as width of 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following problem happens: when charaters are inserted
past the end of the line such that it wraps, hitting backspace
or any cursor movement causes a spurious scroll.
This was caused on Nov 1 2018 by bf85503b (linenoise: avoid
refresh for new text in multi-line mode).
The reason is that the maxrows variable isn't updated when
we trivially add a character without repainting.
* linenoise/linenoise.c (lino state): Document special value
for need_refresh: when it is 2, the refresh doesn't perform a
any output, but recalculates maxrows.
(refreh_multiline): If need_refresh is 2, bail after
updating maxrows.
(edit_insert): When trivially adding a character at the
end and just outputting it, if in multi-line mode, set
need_refresh to 2.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Adjust registrations of sum and prod to
be binary functions with an optional argument.
* lib.c (nary_op_keyfun, sumv, prodv): New static functions.
(sum, prod): Implement optional keyfun argument via sumv and
prodv helpers.
* lib.h (sum, prod): Declarations updated.
* txr.1: Documentation updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This addresses the following issue. Suppose the query
is something like this:
@abc
@(nonexistent)
and there is one line of data. In this case, there is no error
about a nonexistent function. The function lookup fails in
vertical mode, so horizontal mode fallback takes place. But
that just concludes that there is no data, and reports a
failed match. But the programmer might have intended to invoke
some function or directive that doesn't need to match
anything, but rather has an important effect.
In this patch we fix that. As part of the change, we disallow
functions from shadowing horizontal directives.
* match.c (match_files): Do not look up sys:var and sys:text
through the directive table, but check for these. If the
directive is not found in the vertical table, check the
horizontal table; if found there, don't try it as a function
but go to horizontal processing. Then if the function lookup
fails, we diagnose a failed lookup; don't fall through to
horizontal processing.
|
|
|
|
|
|
| |
* match.c (match_files): Change pointless two-step
initialization of a variable by assignment into straight
initialization.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (compiler_set_entries): Register
dump-compiled-objects for auto-loading.
* share/txr/stdlib/compiler.tl (usr:dmp-to-tlo): New
function.
(compile-file): Code to be shared with dump-compiled-objects
moved into dump-to-tlo function.
(usr:dump-compiled-objects): New function.
* txr.1: Documented.
|
|
|
|
| |
* txr.1: New section on Treatment of literals.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Let's squash duplicate strings and bignum integers in the
virtual machine data tables. We can safely do it for these
objects. For lists and vectors, things are tricky because
these aggregates can contain circularity; so we leave those
alone for now.
Text processing code can generate a lot of duplicate strings.
For instance `@a @b @c` generates three copies of the " " literal.
* share/txr/stdlib/compiler.tl (*dedup*): New special
variable. This is our de-dupe table, but it is globally
nil, so that we don't retain cruft between compile jobs.
(dedup): New function.
(get-dreg): Map the incoming object through dedup.
(dreg-key): New function. This converts a literal object to key for
the dreg hash. Objects that can be de-duped represent themselves.
Objects that cannot be de-duped are keyed by a gensym.
(compiler get-dreg): Use dreg-key to reduce the incoming object to a
key, and work with that, with the effect that strings, characters and
numbers in the data table get de-duped: multiple occurrences of a
character, string or number in the code get the same dreg.
(usr:compile-toplevel, usr:with-compilation-unit): Establish a
dedup hash for the dynamically enclosed compile job. If one is
already established by the surroundign dynamic environment,
then use that one, otherwise create a new hash.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (me_case): Replace a code generation pattern of the
(if (and x y) z) with the equivalent (and x y z). The
motivation behind this is that it effectively coaxes a
jump-threading optimization out of our simplistic compiler.
The failure cases out of a single *and* all jump past the
entire code block, whereas with the cascaded if + and we get
a double test of the same failed value threading through two
branches.
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We would like @(next (open-directory "nonexistent") :nothrow)
to act as a failed match, rather than for the exception to
propagate (and likely terminate TXR). The problem is that
only file sources are treated with :nothrow.
* match.c (tleval_nothrow, tleval_144_nothrow): New static
functions.
(v_next_impl): Use tleval_nothrow for all Lisp evaluation. If
nothrow is requested and Lisp evaluation returns the colon
symbol (which tleval_nothrow produces in the case of an
exception), then treat the situation as a failed match.
|
|
|
|
|
|
|
|
| |
* match.c (v_next_impl): The check against the presence of
multiple of source-specifying keyword options must also
consider the base source as part of the mutual exclusion,
so that syntax like @(next "file" :string "str") is also
ruled out.
|
|
|
|
|
|
|
|
|
|
| |
* match.c (v_next_impl): Contrary to the documentation and to
"classic" TXR behavior exhibited in compatibility mode,
when @(next "file" :nothrow) fails to open "file", it treats
the situation as a cue to read from standard input, rather
than to treat the situation as a failed match. This is because
complex_open returns nil, and when that is passed to
lazy_stream_cons, that function defaults to standard input.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* txr.c (txr_main): In processing the -f option, if there is
already an input source, but its name exactly matches the
argument of the -f option, then ignore the -f and its option
intead of terminating with a diagnostic. This allows the user
to use -f in the Null Hack to achieve the usual trick of
allowing the script to take options passed through to the
interpreter.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* txr.c (txr_main): Fix misleading message formatting here.
The spec_file string is irrelevant; we must show the
argument to -c which is in arg. The name of the input source
is spec_file_str; let's show that.
|
|
|
|
|
|
|
|
|
| |
* txr.c (txr_main): Diagnose accurately when --args
or --eargs is specified without any of the required trailing
syntax, instead of complaining about --args or --eargs being an
unknown option. Also, fix the error message about --eargs not having
an argument, such that it doesn't insinuate that there exists
an --eargs=value syntax.
|
|
|
|
|
|
| |
* hash.c (copy_hash): Fix failure to initialize seed member in
the duplicated hash structure. This regression was introduced
along with seeded hashing.
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: we can't assume that we can just edit "int" to
"uint" in forming the superulong_t type. Let's consolidate
the detection of the signed and unsigned superlong. Only
if both are available, then emit material into config.h,
along with a single constant: HAVE_SUPERLONG_T.
* mpi/mpi-types.h: Don't refer to removed HAVE_USUPERLONG_T.
Change superulong_t to usuperlong_t.
|
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (dissassemble-cdf): Print the rows
of the data table with simple numeric offsets, with no d
prefix or leading zeros.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (stdio_seek): Handle new-style Boolean return from
stdio_fseek.
* sysif.c (stdio_fseek): Return an int indication that is 1
for success, 0 for failure. There was a mistaken assumption
here that fseeko returns the file offset, and the return value
in the fseek case was mistakenly harmonized, using a wasteful
call to stdio_ftell. The only call to this function relies
only on a Boolean success/fail indication.
* sysif.h (stdio_fseek): Declaration updated.
|
|
|
|
|
|
|
|
| |
* Makefile (install): Drop the $(top_srcdir) prefix from
share/txr/stdlib materials. This fails for the .tlo files
which are only found in the build directory, not the source
directory. The .txr and .tl files are found in both, thanks
to symlinks; for those it works either way.
|
|
|
|
|
|
| |
* arith.c (mul): In code that is only compiled when
HAVE_DOUBLE_INTPTR_T is missing/zero, we need to test the
return value of MPI's mp_mul.
|
|
|
|
|
|
| |
* sysif.c (num_off_t): Remove #ifdef here and just use num_64
if off_t fits into 64 bits. Now this code compiles even if
HAVE_DOUBLE_INTPTR_T is missing.
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_be_i64_put, ffi_be_i64_get, ffi_be_u64_put,
ffi_be_u64_get, ffe_le_i64_put, ffi_le_i64_get,
ffi_le_u64_put, ffi_le_u64_get): Functions simplified by using
u64_t and i64_t types and functions from itypes.c.
Conditional compilation and range tests are no longer
required.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If double_intptr_t is at least 64 bits wide (which is always
going to be true) we can take advantage of it.
* itypes.c (c_i64, c_u64): Provide implementations that use
the new dbl_intptr_t and dbl_uintptr_t infrastructure.
The fallback implementation that uses ash and logior is
basically not used now.
(num_64, unum_64): New functions for obtaining a Lisp value
from a 64 bit number, abstracting whether this is done via the
cnum or dbl_cnum route.
* itypes.h (u64_t, i64_t): Define in terms of double_uintptr_t
and double_intptr_t, if no other 64 bit type is available.
(num_64, unum_64): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We support an unsigned version of the type, and add functions
for converting between Lisp values and both types.
* arith.c (bignum_dbl_uipt): New function, unsigned companion
to existing bignum_dbl_ipt.
(c_dbl_num, c_dbl_unum): New functions.
* arith.h (bignum_dbl_uipt, c_dbl_num, c_dbl_unum): Declared.
* configure (superulong_t, SIZEOF_DOUBLE_INTPTR,
DOUBLE_INTPTR_MAX, DOUBLE_INTPTR_MIN, DOUBLE_UINTPTR_MAX,
double_uintptr_t): New definitions going into config.h.
* lib.h (dbl_cnum, dbl_ucnum): New typedefs: double-sized
analogs of cnum and ucnum.
* mpi/mpi.c (mp_set_double_uintptr, mp_get_double_uintptr,
mp_get_double_intptr): New functions.
(s_mp_in_big_range): New static function.
(mp_in_double_intptr_range, mp_in_double_uintptr_range): New
functions.
* mpi/mpi.h (mp_set_double_uintptr,
mp_get_double_intptr, mp_get_double_uintptr,
mp_in_double_intptr_range, mp_in_double_uintptr_range):
Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* mpi/mpi.c (mp_in_range, mp_in_intptr_range,
mp_in_uintptr_range): New functions.
* mpi/mpi.h (mp_in_range, mp_in_intptr_range,
mp_in_uintptr_range): Declared.
* arith.c (NUM_MAX_MP, INT_PTR_MAX_MP, UINT_PTR_MAX_MP,
INT_PTR_MAX_SUCC_MP): Static variables removed. Note that
INT_PTR_MAX_MP was not used at all!
(normalize): Use mp_in_range instead magnitude comparison to
NUM_MAX_MP.
(in_int_ptr_range, in_uint_ptr_range): Static functions removed.
(c_unum): Use mp_in_uintptr_range instead of
in_uint_ptr_range.
(arith_init): Remove initializations of removed variables.
(arith_free_all): Remove cleanup of removed variables, leaving
function empty.
* lib.c (c_num): Use mp_in_intptr_range instead of
in_int_ptr_range.
|
|
|
|
|
|
|
|
| |
* arith.c (c_unum): Fix misleading error message, and instead
specify the range that was violated.
* lib.c (c_num): Similar change: don't refer to a 'cnum range'
which means nothing to the user.
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_be_i64_put, ffi_le_i64_put): Fix incorrect range
check, causing most negative two values to be rejected.
The aim here is to accept the #x-80..00 most negative two's
complement value. We can't express that directly using the C
expression -0x8000000000000000 because it's not a simple
constant; it's the unary minus applied an unsigned number.
|
|
|
|
|
| |
* ffi.c (ffi_le_i64_get): Fix wrong array indices, causing
lower half of 64 bit word to be taken as the upper half.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_be_i64_get, ffi_le_i64_get): The code here for 32
bit platforms is fishy: it is using the signed cnum type for
the low 32 bits, when that should be ucnum. We are actually
okay because ths code would only be executed on a platform
where cnum is 32 bits. We are saved by the fact that we are
doing left shifts (no sign extension), that shifting a 1 into
a sign bit is harmless on two's complement machines, and that
the lo32 value is ultimately passed to unum whereby it is
coerced to a ucnum argument type (which preserves the bit
representation) and prevents logior from seeing a negative
value.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (equal_hash, eql_hash, cobj_eq_hash_op,
hash_hash_op): Multiply object size by CHAR_BIT and switch on
number of bits, rather than bytes.
* sysif.c (off_t_num): Likewise.
* arith.c, ffi.c, itypes.c, rand.c: In numerous #if directive,
fix size tests from bytes to bits.
* configure: in the test that detects integer types, and in
the test for enabling large file offsets, detect one more
variable from the system: the value of CHAR_BIT. This
turns into SIZEOF_BYTE. We use that value instead of a
hard-coded 8.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (bignum_dbl_ipt): Change internal function to
external linkage.
* arith.h (bignum_dbl_ipt): Conditionally declared.
* sysif.c (num_off_t): Use bignum_dbl_ipt instead of
open-coding exactly the same thing that bignum_dbl_ipt does.
Abort is changed to same internal_error as in off_t_num.
|
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (off_t_num): Retarget to just use c_i32 or c_i64
from ctypes.c, depending on which of these types is the same
width as off_t.
(stdio_fseek): Pass identifying "self" string to off_t_num.
Don't use off_t_num for fseek's offset argument which is of
type long; for that we can use c_long from ctypes.c.
* sysif.h (off_t_num): Declaration updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* mpi/mpi.h (mp_sign, mp_isneg, mp_used, mp_alloc, mp_digits,
mp_digit): New macros, based on renaming SIGN, ISNEG, USED,
ALLOC, DIGITS and DIGIT.
(mp_set_prec): Use mp_digits instead of DIGITS.
* mpi/mpi.c (SIGN, ISNEG, USED, ALLOC, DIGITS, DIGIT): Macros
defined here now, as local aliases for their namespaced
counterparts.
* arith.c (signum, floordiv): Replace ISNEG with mp_isneg.
* rand.c (random): Replace ISNEG with mp_isneg.
* sysif.c (off_t_num): Replace USED, DIGITS and ISNEG with
mp_used, mp_digits and mp_isneg.
|
|
|
|
|
|
|
|
| |
* txr.1: eval mistakenly referred to instead of compile-file
under Compile File. Spurious pluralization of literals fixed.
New "Bound symbols in dwim" heading to separate text from
discussion of unbound symbols in dwim. Clarifying text added
about compile-toplevel's treatment of form.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
| |
* mpi/mpi.c (s_mp_2expt, mp_trunc_comp, mp_trunc, mp_bit):
Arguments that give a number of bits or bit position should be
mp_size; they are not related to digit values.
* mpi/mpi.h (mp_trunc_comp, mp_trunc, mp_bit): Declaration
updated.
|
|
|
|
| |
* Makefile (MPI_OBJ_BASE): remove mplogic.o.
|