summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Version 048txr-048Kaz Kylheku2011-12-135-4/+38
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES: Updated.
* * arith.c (exptmod, gcd): New functions.Kaz Kylheku2011-12-135-0/+71
| | | | | | | | * eval.c (eval_init): New functions registered as intrisics. * lib.h (exptmod, gcd): Declared. * txr.1: Documentation stubs added.
* * arith.c (evenp, oddp): New functions.Kaz Kylheku2011-12-135-1/+45
| | | | | | | | * eval.c (eval_init): New functions registered as intrinsics. * lib.h (evenp, oddp): Declared. * txr.1: Documentation stub updated.
* * arith.c (highest_bit): Linkage changed to static.Kaz Kylheku2011-12-138-3/+269
| | | | | | | | | | | | | | | | | (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.
* * arith.c (expt): Fix broken bignum x fixnum combination.Kaz Kylheku2011-12-132-1/+5
|
* * Makefile (repatch): New phony target.Kaz Kylheku2011-12-132-2/+12
| | | | (distclean): Remove mpi directory.
* Patch to shrink mpi-int to three words on 32 bit platforms,Kaz Kylheku2011-12-133-0/+30
| | | | | | | | so that obj_t stays four pointers wide. * mpi-patches/series: New patch added. * mpi-patches/shrink-mpi-int: New file.
* * mpi-patches/bit-search-optimizations (s_highest_bit): Added staticKaz Kylheku2011-12-123-4/+41
| | | | | | | | | storage class specifier. * mpi-patches/fix-mult-bug (s_mp_sqr): More braindamage found in MPI. This function performs additions and multiplication mp_digit, expecting a mp_word precision result without casting. This function is needed for exponentiation.
* Git rid of some some loops in MPI where it is searching forKaz Kylheku2011-12-123-0/+311
| | | | | | | | | the highest bit, replacing them with an adapation of the bit searching function used in arith.c. * mpi-patches/series: Patch added. * mpi-patches/bit-search-optimizations: New file.
* * arith.c (expt): New function.Kaz Kylheku2011-12-126-2/+130
| | | | | | | | | | | | * 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.
* * mpi-patches/fix-mult-bug: One more flaw discovered inKaz Kylheku2011-12-123-2/+25
| | | | | | | | | | | | s_mp_mul_d and added to patch. This one caused malloc corruption and crashes, because the incorrect arithmetic causes the function to think that the multiplication will not be needing another digit, but then there is a carry out which does spill into a new digit. * mpi-patches/series: Arg! Somehow the patch fix-bad-shift went missing from the series file, even though the patch itself is in the GIT repository.
* Version 047txr-047Kaz Kylheku2011-12-125-4/+51
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES: Updated.
* * arith.c (zerop, gt, lt, ge, le): Functions from lib.c reimplementedKaz Kylheku2011-12-116-34/+135
| | | | | | | | | | | | | | | 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.
* * arith.c (plus, mul): Plugged mpi_int memory leaks.Kaz Kylheku2011-12-112-11/+91
| | | | | (trunc): Plugged memory leaks. Straightened out semantics with negative modulus. (Residue comes out negative).
* * arith.c (trunc): Error messages prefixed with trunc:.Kaz Kylheku2011-12-113-17/+68
| | | | | | (mod): New function, reimplementation of removed mod from lib.c. * lib.c (mod): Function removed.
* Bignum division implemented. More portability bugs found in MPI:Kaz Kylheku2011-12-114-14/+122
| | | | | | | | | | | 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.
* * arith.c (ABS): New macro.Kaz Kylheku2011-12-112-10/+46
| | | | | | | (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.
* Whitespace.Kaz Kylheku2011-12-111-24/+24
|
* Removing this crutch; it's not that useful.Kaz Kylheku2011-12-112-423/+6
| | | | * arith.txr: File removed.
* * arith.c: Regenerated.Kaz Kylheku2011-12-113-18/+17
| | | | | * arith.txr (normalize): Bugfix: was not turning +/- NUM_MAX bignums into fixnums.
* * arith.c: Regenerated.Kaz Kylheku2011-12-113-0/+9
| | | | | * arith.txr (highest_bit): Missing #else added, fixing SIZEOF_PTR == 4 case.
* * arith.c: Regenerated.Kaz Kylheku2011-12-113-2/+117
| | | | | * arith.txr (highest_bit): Oops, half the logic for the 64 bit case was missing due to to a cut and paste mistake.
* * arith.c: Regenerated.Kaz Kylheku2011-12-113-26/+245
| | | | | * arith.txr (highest_bit): New function. (mul): Use highest_bit instead of shift based algorithm.
* * txr.vim (txr_atat): New match. The @@ sequence is recognizedKaz Kylheku2011-12-102-0/+7
| | | | properly and highlighted.
* Bignum support in mult function.Kaz Kylheku2011-12-107-67/+271
| | | | | | | | | | | | | | | | | | | | | | * 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.
* * mpi-patches/mpi-set-mpi-word: Bugfix and refresh.Kaz Kylheku2011-12-104-4/+68
| | | | | | * mpi-patches/mpi-set-double-intptr: New file. * mpi-patches/series (mpi-set-double-intptr): Patch added.
* * configure: add to config.h the type double_intptr_t, whichKaz Kylheku2011-12-102-0/+18
| | | | | is twice the size of intptr_t. It may not be available, so there is a HAVE_ macro to detect it.
* Adding mp_set_word function.Kaz Kylheku2011-12-102-0/+33
| | | | | | * mpi-patches/series (mpi-set-mpi-word): New patch. * mpi-patches/mpi-set-mpi-word: New file.
* * eval.c (eval_init): New functions added as intrinsics.Kaz Kylheku2011-12-105-0/+26
| | | | | | | | * hash.c (hash_eql, hash_equal): New external functions. * hash.h (hash_eql, hash_equal): Declared. * txr.1: Sections added.
* * mpi-patches/add-mp-hash: Rewrote mp_hash to only hash enoughKaz Kylheku2011-12-104-32/+37
| | | | | | | | | | | | | low-order bit material from the bignum to fill an unsigned long. We don't need to walk the entire bignum. If the low order digit of the bignum is at least as large as an unsigned long, we just take that as the hash, otherwise we take enough of the digits to fill an unsigned long. For negative numbers, we just invert the bits of the hash. * mpi-patches/add-mpi-toradix-with-case: Refreshed. * mpi-patches/fix-mult-bug: Refreshed.
* * lib.c (mulv): Recognize cases to eliminate a wasteful mul callKaz Kylheku2011-12-102-1/+10
| | | | with an initial element of 1.
* * lib.c (plusv): Recognize cases to eliminate a wasteful plus callKaz Kylheku2011-12-102-1/+10
| | | | with an initial element of zero.
* * arith.c: File is now generated using TXR.Kaz Kylheku2011-12-104-19/+257
| | | | | | | | | | | (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.
* * configure: Fix patching without quilt.Kaz Kylheku2011-12-092-1/+5
|
* Build and pass test suite on Cygwin.Kaz Kylheku2011-12-093-13/+32
| | | | | | | | | | * configure (longlong, ulonglong, superlong, usuperlong): Initialize these variables so that if the detection tests fail, the script does not access unbound variables. Avoid adding junk like .bss.* into config.h. * mpi-patches/config-types: Fixed wrong use of nonexistent SIZEOF_LONG_T.
* (Applies to previous commit.)Kaz Kylheku2011-12-091-0/+7
| | | | | * mpi-patches/config-types: Added missing definitions of MP_DIGIT_SIZE in two cases.
* 2011-12-09 Kaz Kylheku <kaz@kylheku.com>Kaz Kylheku2011-12-091-11/+13
| | | | | * mpi-patches/config-types: Added missing definitions of MP_DIGIT_SIZE in two cases.
* Bignum support, here we go!Kaz Kylheku2011-12-0926-137/+1140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* C++ maintenance.Kaz Kylheku2011-12-083-4/+10
| | | | | | * eval.c (and_s, or_s): Redundant variables removed. * match.h (do_s): extern storage class specifier added.
* * eval.c (op_defun): Transform a function body by insertingKaz Kylheku2011-12-073-3/+77
| | | | | | | | a named block around it, thereby imitating a Common Lisp feature. (op_for): Establish an anonymous block around the loop body, test form and increment forms. * txr.1: Documented named block in defun. Documented for and for *.
* * txr.vim: Updated with all operators and functions.Kaz Kylheku2011-12-072-37/+43
|
* * txr.1: flip operator documented. Bad syntax for pop fixed.Kaz Kylheku2011-12-072-3/+16
| | | | Blank section for list-vector function added.
* * eval.c (op_modplace): If the operator is push, then reverseKaz Kylheku2011-12-072-9/+34
| | | | | | | the arguments. We want (push item list) for compatibility with CL. (expand): Bugfix: some of the cases were constructing new forms using unexpanded pieces from the original form. Added separate case for push, which handles the reversed arguments.
* * debug.c (debug): Fix regression: repeat last command by hittingKaz Kylheku2011-12-075-12/+80
| | | | | | | | | | | | | | | | | | | | | | | | Enter stopped working. This was broken by recent bugfixes in the string splitting functions, which introduced a semantics change. * eval.c (flip_s, vecref_s): New symbol variables. (op_modplace): New places (vecref ...) and (flip ...). Bugfix: dec operator was incrementing. (expand_place): Handle vecref and flip. Bugfix: pop has no third argument and so is now handled by the same case as flip. Bugfix: if a modify form has no third argument, then do not resynthesize it with a nil third argument. (eval_init): Initialize new symbol variables. Register new flip operator. Register new list_vectory function as intrinsic. * lib.c (rplacd): When modifying the cdr field of a lazy cons, then lapse the lazy function to nil! This is needed by user-defined lazy conses, and it makes sense to do it this way rather than put in some explicit interface. (list_vector): New function. * lib.h (list_vector): Declared.
* * eval.c (lookup_var, lookup_fun): Reversing assoc arguments.Kaz Kylheku2011-12-078-59/+124
| | | | | | | | | | | | | | | | | | | | | | | (eval_init): New intrinsics. * hash.c (struct_hash): assoc_fun parameters reversed. (gethash, gethash_f, gethash_n): Likewise. * lib.c (assoc, assq): Reversing parameters. (find_package, acons_new, acons_new_l, aconsq_new): Reversing arguments to assoc adn assq. * lib.h (assoc, assq): Declarations updated. * match.c (dest_set, dest_bind, h_var, h_coll, h_parallel, h_fun, subst_vars, do_txeval, v_next, v_parallel, v_gather, v_collect, v_flatten, v_cat, v_output, v_filter, f_fun, match_funcall): Reversing arguments to assoc. * unwind.c (uw_get_func, uw_exception_subtype_p, uw_register_subtype): Reversing arguments to assoc. * txr.1: Blank sections created for new functions.
* * txr.1: Blank sections created for character functions.Kaz Kylheku2011-12-072-0/+32
|
* * eval.c (eval_init): New functions registered as intrinsics.Kaz Kylheku2011-12-074-0/+22
| | | | | | * lib.c (chr_toupper, chr_tolower): New functions. * lib.h (chr_toupper, chr_tolower): New functions declared.
* * parser.l: In the CHRLIT state, return a nonblank character as anKaz Kylheku2011-12-072-0/+10
| | | | IDENT token. This allows for character literals like #\$.
* * eval.c (eval_init): New character functions registered.Kaz Kylheku2011-12-074-2/+106
| | | | | | | | | | | | | * lib.c (c_num): Generalized to convert characters to numbers also. This allows functions like gt and lt to work with characters. (chr_isalnum, chr_isalpha, chr_isascii, chr_iscntrl, chr_isdigit, chr_isgraph, chr_islower, chr_isprint, chr_ispunct, chr_isspace, chr_isupper, chr_isxdigit): New functions added. * lib.h: (chr_isalnum, chr_isalpha, chr_isascii, chr_iscntrl, * chr_isdigit, chr_isgraph, chr_islower, chr_isprint, chr_ispunct, * chr_isspace, chr_isupper, chr_isxdigit): New functions declared. (c_true): New macro.
* Comment change.Kaz Kylheku2011-12-071-1/+1
|