diff options
| author | Paul Eggert | 2018-08-31 00:25:07 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-08-31 00:28:58 -0700 |
| commit | db2fed3bdfb351c3283e481829ce687931d27a3d (patch) | |
| tree | 4f2674ec4f4fe450fd483132b9ddcca48f9eaf81 /src/lisp.h | |
| parent | a451c6ec12b7b024f347364becb10c49807513ed (diff) | |
| download | emacs-db2fed3bdfb351c3283e481829ce687931d27a3d.tar.gz emacs-db2fed3bdfb351c3283e481829ce687931d27a3d.zip | |
Several fixes for formatting bignums
* src/bignum.c: Include stdlib.h, for abs.
(bignum_bufsize, bignum_to_c_string): New functions.
* src/bignum.c (bignum_to_string):
* src/print.c (print_vectorlike): Use them.
* src/editfns.c (styled_format): Instead of having a separate
buffer for sprintf (which does not work for bignums), just append
to the main buffer. When formatting bignums, add support for the
standard integer flags -, #, 0, + and space. Fix some comments.
Capitalize properly when formatting bignums with %X. Use
functions like c_isdigit rather than reinventing the wheel.
Simplify computation of excess precision.
* src/print.c: Do not include bignum.h; no longer needed.
(print_vectorlike): Avoid recalculating string length.
* test/src/editfns-tests.el (format-bignum):
Test some of the above fixes.
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lisp.h b/src/lisp.h index c5b51ba3b35..36ca32c3c05 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3278,9 +3278,12 @@ set_sub_char_table_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) | |||
| 3278 | XSUB_CHAR_TABLE (table)->contents[idx] = val; | 3278 | XSUB_CHAR_TABLE (table)->contents[idx] = val; |
| 3279 | } | 3279 | } |
| 3280 | 3280 | ||
| 3281 | /* Defined in bignum.c. */ | 3281 | /* Defined in bignum.c. This part of bignum.c's API does not require |
| 3282 | the caller to access bignum internals; see bignum.h for that. */ | ||
| 3282 | extern intmax_t bignum_to_intmax (Lisp_Object); | 3283 | extern intmax_t bignum_to_intmax (Lisp_Object); |
| 3283 | extern uintmax_t bignum_to_uintmax (Lisp_Object); | 3284 | extern uintmax_t bignum_to_uintmax (Lisp_Object); |
| 3285 | extern ptrdiff_t bignum_bufsize (Lisp_Object, int); | ||
| 3286 | extern ptrdiff_t bignum_to_c_string (char *, ptrdiff_t, Lisp_Object, int); | ||
| 3284 | extern Lisp_Object bignum_to_string (Lisp_Object, int); | 3287 | extern Lisp_Object bignum_to_string (Lisp_Object, int); |
| 3285 | extern Lisp_Object make_bignum_str (char const *, int); | 3288 | extern Lisp_Object make_bignum_str (char const *, int); |
| 3286 | extern Lisp_Object double_to_bignum (double); | 3289 | extern Lisp_Object double_to_bignum (double); |