| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The flaw in the rand function caused by mp_count_ones is
serious. For instance calls to (rand 3000000000) are expected
to produce evenly distributed values in the range zero
to one less than 3 billion. Due to this flaw, only values
in the range [0, 2147483648) are produced. The function is
wrongly informed that 3000000000 is a power of two, and
so it subtracts one from the number of bits needed for the
clamping bit mask, causing raw random values to be clamped
to 31 bits instead of 32.
* arith.c (logcount): Use mp_err to capture return value from
mp_count_ones, rather than mp_size. If the result is less than
zero, throw an internal error. (The only non-internal error
indication that could come from this function is a memory
allocation, and we already use chk_malloc under MPI).
* mpi/mpi.c (mp_count_ones): Switch return type to mp_err,
because this function returns error codes, which are negative.
(mp_is_pow_two): Fix broken test that is always true.
This affects our random number module; it's used in the random
function for bignum moduli.
(mp_toradix_case): Use unsigned char temporary for exchanging
two unsigned chars, rather than a char temporary.
(s_mp_div_d): Assert that the partial quotient t and
remainder w, of mp_word_type, have values that fit into the
mp_digit variables to which they are being assigned.
(s_mp_ispow2d): The result of s_highest_bit(d) is unsigned,
so if we subtract 1 from 0, we create a large value which
likely converts to -1. Let's ensure that clearly with a cast
to (int) of the return value.
* mpi/mpi.h (mp_count_ones): Declaration updated.
* mpi/mplogic.c (mpl_rsh, mpl_lsh): Fix two places where we
shift the constant 1 (of type int) left by a number of bits
that can exceed the type int. Note, that these functions are
currently not called anywhere in TXR.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* mpi/mpi.c (mp_read_radix): Take const wchar_t * string
rather than unsigned char *.
(s_mp_tovalue): Take character argument as wchar_t rather
than int.
* mpi/mpi.h (mp_read_radix): Declaration updated.
* lib.c (int_str): Avoid a malloc/free and UTF-8 conversion by
passing the original wide string to mp_read_radix.
This removes a TODO dating back to December 2011.
|
|
|
|
|
|
|
|
| |
* arith.c (int_flo): If the floating point value is in the
ucnum range, we can convert to integer by way of that type;
we gain a little bit of range. For instance on 32 bits,
floating values in the range 2147483648.0 to 4294967295.0
can be converted via the fast path.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: We remove the uintptr variable and do not
generate the HAVE_UINTPTR_T constant in config.h. This is
always 1, and not actually tested anywhere. In situations when
uintptr is not established, intptr is also not established and
the configure script fails. We simply assume that for whatever
type we detect as inptr_t, we can derive the unsigned type.
(INT_PTR_MAX): We define this a bit differently; instead of
interpolating into the expression the underlying C type, we
use the int_ptr_t typedef that the previous lines of config.h
establish.
(UINT_PTR_MAX): New constant introduced in config.h.
|
|
|
|
|
|
|
|
| |
* arith.c (int_flo): Fix reversed inequality tests which
cause the test to be always false. This always false test
prevents use of the faster code path for converting
floating-point point values that are in range of the cptr
type.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sigh; this is a continuation of the same topic that was
addressed in November 14, 2016: "Fix bug in bignum addition".
Commit SHA: c30a96120f53b960db56bc05a7ce6310bb2528f5.
Though I fixed s_mp_add, s_mp_add_d has the same problem. Two
digit-sized quantities are added together in the digit-sized
type, and so the CARRYOUT(w) from the result is always zero.
This bug causes the following consequences (using behavior
under 32 bit as an example):
1. Wrong arithmetic:
(succ (pred (expt 2 32)) -> 0
2. Wrong conversion from decimal:
4294967296 -> 0
4294967297 -> 1
4294967298 -> 2
4294967299 -> 3
As well as all values that begin with the above digit
sequences.
4. Wrong conversion from floating-point.
(toint 4294967296.0) -> 0
* mpi/mpi.c (s_mp_add_d): Add missing cast to the initial
addition that adds the incoming digit d to the least
significant limb of the bignum, so that the addition is done
in the wider mp_word type, allowing CARRYOUT(w) to calculate a
nonzero k value.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a zero-length carray is converted with vec-carray or
list-carray and the null-term-p argument is t, there is an
exception about a negative index. An empty vector or list
should be returned in this case, and the documentation says
exactly that.
Also, if a carray of unknown length is converted, there is
an exception from vec-carray, as documented, but it's
an uninformative one that is incidentally produced when -1
is passed to the vec function. The list-carray just returns
nil, contravening the documentation.
* ffi.c (vec_carray, list_carray): Fix the problems described
above.
* txr.1: Reviewing the documentation for these functions, an
improperly terminated sentence was found.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h,
arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c,
ffi.h, filter.c, filter.h, ftw.h, gc.c, gc.h, glob.c, glob.h,
hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c, lib.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/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/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/pmac.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, 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 line to 2018.
|
|
|
|
|
| |
* txr.1: with-dyn-lib relates not only to deffi but also
deffi-var and deffi-sym.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the programmer writes a deffi, deffi-sym or deffi-var that
makes simple references, and that macro is not wrapped in
with-dyn-lib, an unhelpful error message results about
sys:ffi-lib being unbound. We can detect this situation and
provide a warning.
* share/txr/stdlib/ffi.tl (sys:with-dyn-lib-check,
sys:expand-sym-ref): New functions.
(deffi, deffi-sym, deffi-var): Capture environment parameter.
Common code replaced by call to sys:expand-sym-ref, where the
missing sys:ffi-lib situation is diagnosed. This is only done
in cases when the simple reference syntax occurs.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (min): New macro.
(ffi_array_put_common): Tolerate sequences which are shorter
than the array. Use seq_info to classify the sequence and use
separate code for the vector and list case, avoiding taking
the length of the list.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_char_array_put): The char array put operation
should only null terminate when the null_term flag is set;
i.e. it's a zarray type. The bug here is that when a Lisp
string of length > N is put into an (array N char), the
C array gets null terminated, which is wrong. Only in the case
when the string is exactly of length N is there no null
termination. In all cases when the length >= N, we want
truncation without null termination.
|
|
|
|
|
|
| |
* ffi.c (make_ffi_type_array): Remove a useless loop that
was left behind when the essential part of its body was
removed.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (parse-compound-operand): The index
of a (v <lev> <index>) operand must be compard to the maximum
index constant, not to the maximum level constant.
This bug will prevent compiling frames that have more than 64
variables, which is a serious limitation from 1024.
|
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (op-frame): Check the level of the
operand against %max-v-lev%, not %max-lev-idx%, which
gives the maximum index within a level.
|
|
|
|
|
|
| |
* share/txr/stdlib/vm-param.tl (%max-lev-idx%): The maximum
index within a level is one less than the maximum level
size, not two less. Use pred rather than ppred to derive it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/vm-param.tl (%max-sm-lev-idx%): This
constant is named inconsistently relative to %max-lev-idx%.
It is providing the maximum level (encodable in a small
operand), whereas %max-lev-idx% provides the maximum index
within a level. It is hereby renamed to %max-sm-lev%.
The %max-sm-lev-idx% name is re-used to denote the quantity
which it suggests: the maximum index within a level
(encodable in a small operand), which is 63.
* share/txr/stdlib/asm.tl (small-op-p): Use the new
%max-sm-lev-idx% in place of %sm-lev-size%, getting rid of the
funny range starting with -1. Replace the original
%max-sm-lev-idx% with its new name, %max-sm-lev%.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The square function calulates (* x x) but is faster for bignum
integers by taking advantage of mp_sqr.
* arith.c (square): New function.
* eval.c (eval_init): Register square as intrinsic.
* lib.h (square): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: Instead of generating a definition of ALLOCA_H,
generate the variable HAVE_ALLOCA_<name> with a value of 1,
where <name> is one of stdlib, alloca or malloc.
* alloca.h: New header.
* args.c, eval.c, ffi.c ffi.c, ftw.c, hash.c, lib.c, match.c,
parser.c, parser.y, regex.c, socket.c, stream.c, struct.c,
sysif.c, syslog.c, termios.c, unwind.c, vm.c: Include
"alloca.h" instead of ALLOCA_H.
|
|
|
|
|
|
|
|
|
|
| |
* configure: try <stdlib.h> first for alloca. This should fix
a build issue which happens on the Musl library and perhaps
elsewhere. The problem on Musl is that #include <stdlib.h>
already includes <alloca.h>. That header contains an alloca
macro which interfers with our subsequent #include ALLOCA_H
directive: ALLOCA_H expands to <alloca.h> and the alloca token
gets further expanded.
|
|
|
|
|
| |
* configure: don't define HAVE_ALLOCA in config.h. It is not
used anywhere. Moreover, alloca isn't optional.
|
|
|
|
|
|
| |
* txr.1: Closing quote didn't come out in .codn; we must use
the \(dq code in this context. Let's make the opening quote
\(dq also for consistency.
|
|
|
|
|
| |
* txr.1: Wrong tense/person of "to expect"; spurious
occurrence of foo identifier deleted.
|
|
|
|
| |
* txr.1: .meti should be used to typeset code inline.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
| |
utf8.c (utf8_decode): The wch_min value is set incorrectly for
the four byte case due to an extra zero; it should be only
0x10000. Code points encoded to four utf8 bytes start at this value.
The consequence of this error is that utf8-encoded characters
in this range are treated as invalid bytes after being decoded
due to failing the range test.
|