comparison src/number.c @ 2057:471242c84954

[xemacs-hg @ 2004-05-03 15:19:10 by james] Number-related warning cleanups.
author james
date Mon, 03 May 2004 15:19:14 +0000
parents a7dd0aed0fe6
children b75af0ab66f3
comparison
equal deleted inserted replaced
2056:ab71063baf27 2057:471242c84954
79 79
80 DEFINE_LRECORD_IMPLEMENTATION ("bignum", bignum, 0, 0, 80 DEFINE_LRECORD_IMPLEMENTATION ("bignum", bignum, 0, 0,
81 bignum_print, bignum_finalize, bignum_equal, 81 bignum_print, bignum_finalize, bignum_equal,
82 bignum_hash, bignum_description, Lisp_Bignum); 82 bignum_hash, bignum_description, Lisp_Bignum);
83 83
84 Lisp_Object
85 string_to_bignum (const Ibyte *str, Bytecount len, int base)
86 {
87 Lisp_Object b = make_bignum (0L);
88 /* GMP bignum_set_string has no effect with initial + sign */
89 if (*str == '+')
90 str++;
91 /* GMP bignum_set_string has no effect when fed an empty string */
92 if (*str == '\0')
93 return make_int (0);
94 return (bignum_set_string (XBIGNUM_DATA (b), (const char *) str, base) < 0)
95 ? Fsignal (Qinvalid_read_syntax,
96 list3 (build_msg_string
97 ("Invalid integer constant in reader"),
98 make_string (str, len),
99 make_int (10)))
100 : b;
101 }
102
103 #else /* !HAVE_BIGNUM */ 84 #else /* !HAVE_BIGNUM */
104 85
105 Lisp_Object Qbignump; 86 Lisp_Object Qbignump;
106 87
107 #endif /* HAVE_BIGNUM */ 88 #endif /* HAVE_BIGNUM */
163 if (for_disksave) 144 if (for_disksave)
164 invalid_operation ("Can't dump an XEmacs containing ratio objects", 145 invalid_operation ("Can't dump an XEmacs containing ratio objects",
165 VOID_TO_LISP (header)); 146 VOID_TO_LISP (header));
166 ratio_fini (((Lisp_Ratio *)header)->data); 147 ratio_fini (((Lisp_Ratio *)header)->data);
167 } 148 }
168 ;
169 149
170 static int 150 static int
171 ratio_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) 151 ratio_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
172 { 152 {
173 return ratio_eql (XRATIO_DATA (obj1), XRATIO_DATA (obj2)); 153 return ratio_eql (XRATIO_DATA (obj1), XRATIO_DATA (obj2));