Mercurial > hg > xemacs-beta
changeset 2061:b75af0ab66f3
[xemacs-hg @ 2004-05-05 22:09:14 by james]
Use DEFINE_BASIC_LRECORD_IMPLEMENTATION for bignum, ratio, and bigfloat.
author | james |
---|---|
date | Wed, 05 May 2004 22:09:18 +0000 |
parents | 61e1c92f8f4e |
children | 00f374c78661 |
files | src/ChangeLog src/number.c |
diffstat | 2 files changed, 35 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Wed May 05 21:50:48 2004 +0000 +++ b/src/ChangeLog Wed May 05 22:09:18 2004 +0000 @@ -1,3 +1,17 @@ +2004-05-05 Jerry James <james@xemacs.org> + + * number.c: Use DEFINE_BASIC_LRECORD_IMPLEMENTATION instead of + DEFINE_LRECORD_IMPLEMENTATION for bignum, ratio, and bigfloat. + * number.c (bignum_finalize): Remove; we already do this with an + ADDITIONAL_FREE macro in alloc.c. + * number.c (ratio_finalize): Ditto. + * number.c (bigfloat_finalize): Ditto. + * number.c (vars_of_number): Put all initialization of + Vbigfloat_max_prec here, but leave some commented until we can + dump bignums. + * number.c (init_number): Remove Vbigfloat_max_prec + initialization. + 2004-05-03 Jerry James <james@xemacs.org> * floatfns.c (Fexpt): Don't shadow the global symbol exp.
--- a/src/number.c Wed May 05 21:50:48 2004 +0000 +++ b/src/number.c Wed May 05 22:09:18 2004 +0000 @@ -51,15 +51,6 @@ xfree (bstr, CIbyte *); } -static void -bignum_finalize (void *header, int for_disksave) -{ - if (for_disksave) - invalid_operation ("Can't dump an XEmacs containing bignum objects", - VOID_TO_LISP (header)); - bignum_fini (((Lisp_Bignum *)header)->data); -} - static int bignum_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) { @@ -77,9 +68,9 @@ { XD_END } }; -DEFINE_LRECORD_IMPLEMENTATION ("bignum", bignum, 0, 0, - bignum_print, bignum_finalize, bignum_equal, - bignum_hash, bignum_description, Lisp_Bignum); +DEFINE_BASIC_LRECORD_IMPLEMENTATION ("bignum", bignum, 0, 0, bignum_print, + 0, bignum_equal, bignum_hash, + bignum_description, Lisp_Bignum); #else /* !HAVE_BIGNUM */ @@ -138,15 +129,6 @@ xfree (rstr, CIbyte *); } -static void -ratio_finalize (void *header, int for_disksave) -{ - if (for_disksave) - invalid_operation ("Can't dump an XEmacs containing ratio objects", - VOID_TO_LISP (header)); - ratio_fini (((Lisp_Ratio *)header)->data); -} - static int ratio_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) { @@ -164,9 +146,9 @@ { XD_END } }; -DEFINE_LRECORD_IMPLEMENTATION ("ratio", ratio, 0, 0, - ratio_print, ratio_finalize, ratio_equal, - ratio_hash, ratio_description, Lisp_Ratio); +DEFINE_BASIC_LRECORD_IMPLEMENTATION ("ratio", ratio, 0, 0, ratio_print, + 0, ratio_equal, ratio_hash, + ratio_description, Lisp_Ratio); #else /* !HAVE_RATIO */ @@ -235,15 +217,6 @@ xfree (fstr, CIbyte *); } -static void -bigfloat_finalize (void *header, int for_disksave) -{ - if (for_disksave) - invalid_operation ("Can't dump an XEmacs containing bigfloat objects", - VOID_TO_LISP (header)); - bigfloat_fini (((Lisp_Bigfloat *)header)->bf); -} - static int bigfloat_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) { @@ -261,10 +234,10 @@ { XD_END } }; -DEFINE_LRECORD_IMPLEMENTATION ("bigfloat", bigfloat, 1, 0, - bigfloat_print, bigfloat_finalize, - bigfloat_equal, bigfloat_hash, - bigfloat_description, Lisp_Bigfloat); +DEFINE_BASIC_LRECORD_IMPLEMENTATION ("bigfloat", bigfloat, 1, 0, + bigfloat_print, 0, + bigfloat_equal, bigfloat_hash, + bigfloat_description, Lisp_Bigfloat); #else /* !HAVE_BIGFLOAT */ @@ -743,10 +716,19 @@ This is currently the value of ULONG_MAX on the target machine. */); - /* See init_number for the other half of Vbigfloat_max_prec initialization */ -#if defined(HAVE_BIGFLOAT) && !defined(HAVE_BIGNUM) +#ifdef HAVE_BIGFLOAT +#ifdef HAVE_BIGNUM + /* Uncomment the next two lines and remove the line below them when dumping + bignums becomes possible. */ + /* + Vbigfloat_max_prec = make_bignum (0L); + bignum_set_ulong (XBIGNUM_DATA (Vbigfloat_max_prec), ULONG_MAX); + */ Vbigfloat_max_prec = make_int (EMACS_INT_MAX); #else + Vbigfloat_max_prec = make_int (EMACS_INT_MAX); +#endif +#else Vbigfloat_max_prec = make_int (0); #endif /* HAVE_BIGFLOAT */ @@ -800,13 +782,4 @@ bigfloat_init (scratch_bigfloat2); #endif } - -#if defined(HAVE_BIGFLOAT) && defined(HAVE_BIGNUM) - /* Avoid dumping a bignum */ - if (initialized) - { - Vbigfloat_max_prec = make_bignum (0L); - bignum_set_ulong (XBIGNUM_DATA (Vbigfloat_max_prec), ULONG_MAX); - } -#endif }