summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Critical regression. Hash lookup was crashing on some platformsKaz Kylheku2011-12-203-24/+40
| | | | | | | | | | | | | | due to negative hashing values being reduced modulo table size to a negative array index. * hash.c (equal_hash, eql_hash): Ensure that value returned is in the range [0,NUM_MAX]. (hash_obj): Unused function removed. (cobj_hash_op): Use hashing similar to eql hash for other kinds of references. (hash_eql, hash_equal): Removed bogus % NUM_MAX reduction. * hash.h (hash_obj): Declaration removed.
* * eval.c (eval_init): New functions registered as intrinsics.Kaz Kylheku2011-12-205-0/+68
| | | | | | | | * lib.c (copy_vec, sub_vec): New functions. * lib.h (copy_vec, sub_vec): Declared. * txr.1: Stub sections created.
* Version 049txr-049Kaz Kylheku2011-12-195-4/+64
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES: Updated.
* * eval.c (subst_vars, op_quasi_list, expand_quasi): New staticKaz Kylheku2011-12-194-4/+110
| | | | | | | | | | functions. (expand): New case for quasiliterals. (eval_init): Register quasi literal as special operator. * match.c (format_field): Linkage changed to external. * match.h (format_field): Declared. Declarations rearranged.
* * eval.c (bindings_helper): Fix format arguments.Kaz Kylheku2011-12-186-16/+77
| | | | | | | | | | | | | | | | | (eval_init): Registered new functions: symbol-function, func-get-form, func-get-env, functionp, interp-fun-p. * lib.c (nappend2, getplist_f, improper_plist_to_alist): tail variable renamed to avoid clash in macro. (func_get_form, func_get_env, interp_fun_p): New functions. * lib.h (func_get_form, func_get_env, interp_fun_p): Declared. (list_collect): Fix macro not to throw error, but handle the case. * match.c (vars_to_bindings, extract_bindings): tail variable renamed to avoid clash in macro. * txr.1: Documentation stubs.
* 2011-12-16 Kaz Kylheku <kaz@kylheku.com>Kaz Kylheku2011-12-162-11/+37
| | | | | | | | * hash.c (equal_hash): Eliminating displacement from character hashes. Simplifying some code. (eql_hash): Handle fixnums, characters and literals specially, rather than hashing all value types the same way. The shift applicable for object pointers causes adjacent integers to clash.
* * eval.c (expand_vars): Bugfix: use expand_forms rather thanKaz Kylheku2011-12-162-1/+6
| | | | expand on a list of forms.
* * txr.vim: iskeyword updated.Kaz Kylheku2011-12-162-2/+5
|
* * lib.c (appendv): bugfix: wrong way test.Kaz Kylheku2011-12-152-2/+7
| | | | (vector_list): Wrong zero used, resulting in vector(nil) being called.
* * eval.c (eval_init): not added as synonym for null.Kaz Kylheku2011-12-157-40/+368
| | | | | | | | | | | | | | | | | | | | | | | | | | * lib.c (copy_list): Use list_collect_append rather than list_collect_terminate. (append2, appendv): Simplified using new list_collect_append. (nappend2): Simplified using new list_collect_nconc. * lib.h (list_collect): Added check for accidental usage of list_collect after list_append, since PTAIL has different semantics. (list_collect_nconc, list_collect_append): Semantics fixed so that append collecting works more like the Common Lisp append function, allowing trailing atoms or a lone atom. The meaning of PTAIL is changed, however. Now PTAIL actually tracks the head of the most recently appended segment. Each append operation has to first traverse the previously added piece to get to the end. (list_collect_terminate): Macro removed. * match.c (v_gather): Removed useless use of list_collect_terminate. * parser.y: Some headers added that are needed by list_collect. * txr.1: Documented append, list, atom, null, not, consp, make-lazy-cons, lcons-fun, listp, proper-listp, length-list, mapcar, mappend, and apply.
* @# comments are becoming obsolescent. @# commentsKaz Kylheku2011-12-144-14/+47
| | | | | | | | | | | can now be used. Within nested forms, Lisp-compatible ; comments are suported. * parser.l: Support @# and ; comments. * txr.1: Documentation updated. * txr.vim: Updated.
* * lib.c (car, cdr): Set the lazy cons function to nilKaz Kylheku2011-12-143-1/+211
| | | | | | | | after calling it. (rplacd): Do not set the lazy cons function to nil in. * txr.1: Documented a bunch of functions.
* * eval.c (eval_init): Removed registration for vec_get_fil.Kaz Kylheku2011-12-146-54/+68
| | | | | | | | | | | | | | | | | | | | | | | | Renamed vec_set_fill to vec-set-length. * hash.c (equal_hash): vec_fill to vec_length name change. (hash_grow, make_hash): No need to call vec_set_length. * lib.c (equal, vecref, vec_push, length_vec, list_vector, obj_print, obj_pprint): vec_fill to vec_length name change. (vector): Argument now represents actual length, not just allocated size. (vec_get_fill): Function removed; did exactly the same thing as length_vec. (vec_set_fill): Function renamed to vec_set_length. (vector_list): Allocate a 0 length vector initially. * lib.h (enum vecindex): member changes name from vec_fill to vec_length. (vector): Parameter name changed. (vec_set_fill): Redeclared. (vec_get_fill): Declaration removed. * txr.1: Doc stubs updated.
* * lib.c (car, cdr): Semantics fix for lazy conses.Kaz Kylheku2011-12-142-4/+11
| | | | | | | | Ignore the return value of the lazy cons function: do not return nil if the function returns nil. This useless behavior was a source of inconvenience in lazy cons programming, requiring the lazy function to return non-nil in addition to installing the car and cdr fields.
* * arith.c (abso): broken for fixnums.Kaz Kylheku2011-12-142-1/+5
|
* * txr.vim: Highlight hash prefix and quote.Kaz Kylheku2011-12-142-3/+12
|
* * eval.c (op_dohash): Esbatlish anonymous block.Kaz Kylheku2011-12-143-4/+167
| | | | * txr.1: Finished documenting special operators.
* * genman.txr: Fix empty NAME section.Kaz Kylheku2011-12-142-4/+11
|
* * arith.c (minus): Allow difference between characters.Kaz Kylheku2011-12-142-0/+5
|
* * arith.c (plus, minus, gt, lt, ge, le): Handle character operands.Kaz Kylheku2011-12-146-0/+88
| | | | | | | | | | * 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.
* 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.