| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
broken for fixnum <= 0. Bad pointer passed to MPI.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.h: Likewise.
* debug.c: Added copyright header.
* debug.h: Updated copyright year.
* eval.c: Likewise.
* eval.h: Likewise.
* filter.c: Likewise.
* filter.h: Likewise.
* gc.c: Likewise.
* gc.h: Likewise.
* hash.c: Likewise.
* hash.h: Likewise.
* lib.c: Likewise.
* lib.h: Likewise.
* match.c: Likewise.
* match.h: Likewise.
* parser.h: Likewise.
* regex.c: Likewise.
* regex.h: Likewise.
* stream.c: Likewise.
* stream.h: Likewise.
* txr.c: Likewise, and e-mail address.
* txr.h: Updated copyright year.
* unwind.c: Likewise.
* unwind.h: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (dwim_loc): Assignments to string indices and ranges
supported. New arguments for this purpose.
(op_modplace): Use new dwim_loc interface for returned value.
(op_dwim): Support assignment to string ranges.
(eval_init): replace_str registered.
* lib.c (string_extend): If the argument is a number, let it
specify the amount by which to extend the string.
(replace_str): New function.
* lib.h (replace_str): Declared.
* txr.1: Updated.
* txr.vim: Updated.
|
|
|
|
|
|
|
| |
* lib.c (sub_list, replace_list, sub_vec, replace_vec):
Allow the value t to specify one element past the end, so that t t
refers to zero-length sequence just past the end of the array or list.
Also, fixed out of bounds memmoves in replace_vec.
|
|
|
|
|
|
|
|
| |
* arith.h (highest_bit): Declared.
* rand.c (random): Rewrote using different algorithm which
ensures even distribution, and avoids doing a bignum mod
operation.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (plus, minus, mul, gt, ge, lt, le, exptmod, gcd): Remove
trailing abort; we already marked uw_throwf as noreturn. This hack
should not be needed in functions where the last statement is a throw.
(trunc, expt): Repeated error case handled in one place. Temp variable
used to avoid two calls to mp_clear. Call to abort removed.
(mod): Repeated error handed in one place. Plugged memory leak
by moving throw past mp_clear calls. Call to abort removed.
(isqrt): Repeated error case handed in one place.
|
|
|
|
|
|
|
|
| |
* arith.h (normalize): Declared.
* rand.c (random): Bugfix: normalize the bignum before returning it.
* txr.1: Doc stubs for PRNG functionality.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): New functions interned.
* lib.c (num_chr, chr_num): New functions.
* lib.h (num_chr, chr_num): Declared.
* txr.1: Documentation stubs.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): New functions registered as intrisics.
* lib.h (exptmod, gcd): Declared.
* txr.1: Documentation stubs added.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): New functions registered as intrinsics.
* lib.h (evenp, oddp): Declared.
* txr.1: Documentation stub updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(abso, isqrt): New functions.
(isqrt_fixnum): New static function.
* eval.c (eval_init): Registered abs, sqrt and numberp instrinsics.
* lib.c (numberp): New function.
* lib.h (numberp, abso, isqrt): Declared.
* mpi-patches/series: New patch added.
* mpi-patches/faster-square-root: New patch added.
* txr.1: Documentation stubs for new functions.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Registering new intrinsic functions,
reduce-left, reduce-right and expt.
* lib.c (minusv): Return one instead of num(1).
(exptv, reduce_right): New functions.
* lib.h (expt, exptv, reduce_right): Declared.
* txr.1: Blank sections for new functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
with bignum support.
* eval.c (eval_init): Added bignump and zerop as intrinsic function.
Renamed numberp to fixnump.
* lib.c (zerop, gt, lt, ge, le): Functions removed.
(numeq): Unused function removed.
* lib.h (numeq): Declaration removed.
* txr.1: Sections for zerop and bignump created. Changed reference
to numberp to fixnump.
|
|
|
|
|
| |
(trunc): Plugged memory leaks. Straightened out semantics
with negative modulus. (Residue comes out negative).
|
|
|
|
|
|
| |
(mod): New function, reimplementation of removed mod from lib.c.
* lib.c (mod): Function removed.
|
|
|
|
|
|
|
|
|
|
|
| |
code like 1 << n, where n exceeds the width of the type int.
* arith.c (trunc): New function, reimplementation of removed
trunc from lib.c.
* lib.c (trunc): Removed.
* mpi-patches/fix-bad-shifts: New file.
|
|
|
|
|
|
|
| |
(plus, minus): Bugfix: must not pass signed values to mp_add_d and
mp_sub_d functions.
(mul): Must not pass signed value to mp_mul_d. Also, fixed type check
on wrong argument in the (TAG_PTR, TAG_NUM) case.
|
| |
|
|
|
|
|
| |
* arith.txr (normalize): Bugfix: was not turning +/- NUM_MAX bignums
into fixnums.
|
|
|
|
|
| |
* arith.txr (highest_bit): Missing #else added, fixing
SIZEOF_PTR == 4 case.
|
|
|
|
|
| |
* arith.txr (highest_bit): Oops, half the logic for
the 64 bit case was missing due to to a cut and paste mistake.
|
|
|
|
|
| |
* arith.txr (highest_bit): New function.
(mul): Use highest_bit instead of shift based algorithm.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c: Regenerated.
* arith.txr (CNUM_BIT): New constant.
(bignum, bignum_dbl_ipt): New static functions.
(@{add-fname}): Use bignum function.
(mul): New functions, rewrite of mul from lib.c.
* lib.c (mul): Function removed.
* mpi-patches/add-mp-set-intptr (mp_set_intptr): Revised patch.
Local variable v should be int_ptr_t not unsigned long.
Also, the mp_set interface doesn't set the sign; it's an unsigned
interface. We must do that ourselves.
* mpi-patches/fix-mult-bug: The main multiplication function is
also broken in the same way, requiring the cast.
* mpi-patches/mpi-set-double-intptr: Fixed use of wrong type for
local variable v.
|
|
|
|
|
|
|
|
|
|
|
| |
(NOOP): New macro.
(plus): Use NOOP macro.
(minus, neg): Function moved here from lib.c and rewritten
for bignum support.
* lib.c (minus, neg): Functions removed.
* arith.txr: New file.
|
|
Bignums, based on Michael Fromberger's MPI library, are integrated
into the input syntax, stream output, equality testing, the garbage
collector, and hashing.
The plus operation handles transitions between fixnums and bignums.
Other operations are still fixnum only.
* Makefile (CFLAGS): Add mpi directory to include file search.
(OBJS): Include new arith.o module and all of MPI_OBJS.
(MPI_OBJS, MPI_OBJS_BASE): New variables.
* configure (mpi_version, have_quilt, have_patch): New variables.
Script detects whether patch and quilt are available. Unpacks
mpi library, applies patches. Detects 128 bit integer type.
Records more information in config.h about the sizes of types.
* dep.mk: Updated.
* depend.txr: Make work with paths that have directory components.
* eval.c (eval_init): Rename of nump to fixnump.
* gc.c (finalize, mark_obj): Handle BGNUM case.
* hash.c: (hash_c_str): Changed to return unsigned long
instead of long.
(equal_hash): Handle BGNUM case.
(eql_hash): Handle bignums with equal-hash, but other
objects as eq.
* lib.c (num_s): Variable renamed to fixnum_s.
(bignum_s): New symbol variable.
(code2type): Follow rename of num_s. Handle BGNUM case.
(typeof): Follow rename of num_s.
(eql): Handle bignums using equal, and other types using eq.
(equal): Handle BGNUM case.
(chk_calloc): New function.
(c_num): Wording change in error message: is not a fixnum.
(nump): Renamed to fixnump.
(bignump): New function.
(plus): Function removed, reimplemented in arith.c.
(int_str): Handle integers which are too large for wcstol
using bignum conversion. Base 0 is no longer passed to
wcstol but converted to 10 because the special semantics
for 0 would be inconsistent for bignums.
(obj_init): Follow rename of num_s. Initialize bignum_s.
|