1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-04 11:00:45 -08:00

Adjust comments/debug to match C bignum code

* doc/lispintro/emacs-lisp-intro.texi (Digression into C):
Adjust to match current C code.
* lisp/emacs-lisp/ert.el (ert--force-message-log-buffer-truncation):
Simplify.
* src/.gdbinit (Lisp_Object_Printer.to_string): Return
a string that says "make_fixnum", not "make_number".
This commit is contained in:
Paul Eggert 2019-06-04 08:29:37 -07:00
parent 7f4558e3d9
commit 741d04a879
3 changed files with 24 additions and 25 deletions

View file

@ -9014,26 +9014,24 @@ Lisp; it is written in C and is one of the primitives of the GNU Emacs
system. Since it is very simple, I will digress briefly from Lisp and system. Since it is very simple, I will digress briefly from Lisp and
describe it here. describe it here.
@c GNU Emacs 24 in src/editfns.c
@c the DEFUN for delete-and-extract-region
@need 1500 @need 1500
Like many of the other Emacs primitives, Like many of the other Emacs primitives,
@code{delete-and-extract-region} is written as an instance of a C @code{delete-and-extract-region} is written as an instance of a C
macro, a macro being a template for code. The complete macro looks macro, a macro being a template for code. The complete macro looks
like this: like this:
@c This is a copy of editfns.c's DEFUN for delete-and-extract-region.
@smallexample @smallexample
@group @group
DEFUN ("delete-and-extract-region", Fdelete_and_extract_region, DEFUN ("delete-and-extract-region", Fdelete_and_extract_region,
Sdelete_and_extract_region, 2, 2, 0, Sdelete_and_extract_region, 2, 2, 0,
doc: /* Delete the text between START and END and return it. */) doc: /* Delete the text between START and END and return it. */)
(Lisp_Object start, Lisp_Object end) (Lisp_Object start, Lisp_Object end)
@{ @{
validate_region (&start, &end); validate_region (&start, &end);
if (XINT (start) == XINT (end)) if (XFIXNUM (start) == XFIXNUM (end))
return empty_unibyte_string; return empty_unibyte_string;
return del_range_1 (XINT (start), XINT (end), 1, 1); return del_range_1 (XFIXNUM (start), XFIXNUM (end), 1, 1);
@} @}
@end group @end group
@end smallexample @end smallexample
@ -9097,9 +9095,9 @@ consists of the following four lines:
@smallexample @smallexample
@group @group
validate_region (&start, &end); validate_region (&start, &end);
if (XINT (start) == XINT (end)) if (XFIXNUM (start) == XFIXNUM (end))
return empty_unibyte_string; return empty_unibyte_string;
return del_range_1 (XINT (start), XINT (end), 1, 1); return del_range_1 (XFIXNUM (start), XFIXNUM (end), 1, 1);
@end group @end group
@end smallexample @end smallexample
@ -9111,27 +9109,28 @@ then return an empty string.
The @code{del_range_1} function actually deletes the text. It is a The @code{del_range_1} function actually deletes the text. It is a
complex function we will not look into. It updates the buffer and complex function we will not look into. It updates the buffer and
does other things. However, it is worth looking at the two arguments does other things. However, it is worth looking at the two arguments
passed to @code{del_range_1}. These are @w{@code{XINT (start)}} and passed to @code{del_range_1}. These are @w{@code{XFIXNUM (start)}} and
@w{@code{XINT (end)}}. @w{@code{XFIXNUM (end)}}.
As far as the C language is concerned, @code{start} and @code{end} are As far as the C language is concerned, @code{start} and @code{end} are
two integers that mark the beginning and end of the region to be two opaque values that mark the beginning and end of the region to be
deleted@footnote{More precisely, and requiring more expert knowledge deleted. More precisely, and requiring more expert knowledge
to understand, the two integers are of type @code{Lisp_Object}, which can to understand, the two values are of type @code{Lisp_Object}, which
also be a C union instead of an integer type.}. might be a C pointer, a C integer, or a C @code{struct}; C code
ordinarily should not care how @code{Lisp_Object} is implemented.
Integer widths depend on the machine, and are typically 32 or 64 bits. @code{Lisp_Object} widths depend on the machine, and are typically 32
A few of the bits are used to specify the type of information; the or 64 bits. A few of the bits are used to specify the type of
remaining bits are used as content. information; the remaining bits are used as content.
@samp{XINT} is a C macro that extracts the relevant number from the @samp{XFIXNUM} is a C macro that extracts the relevant integer from the
longer collection of bits; the type bits are discarded. longer collection of bits; the type bits are discarded.
@need 800 @need 800
The command in @code{delete-and-extract-region} looks like this: The command in @code{delete-and-extract-region} looks like this:
@smallexample @smallexample
del_range_1 (XINT (start), XINT (end), 1, 1); del_range_1 (XFIXNUM (start), XFIXNUM (end), 1, 1);
@end smallexample @end smallexample
@noindent @noindent

View file

@ -792,13 +792,13 @@ This mainly sets up debugger-related bindings."
This can be useful after reducing the value of `message-log-max'." This can be useful after reducing the value of `message-log-max'."
(with-current-buffer (messages-buffer) (with-current-buffer (messages-buffer)
;; This is a reimplementation of this part of message_dolog() in xdisp.c: ;; This is a reimplementation of this part of message_dolog() in xdisp.c:
;; if (NATNUMP (Vmessage_log_max)) ;; if (FIXNATP (Vmessage_log_max))
;; { ;; {
;; scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, ;; scan_newline (Z, Z_BYTE, BEG, BEG_BYTE,
;; -XFASTINT (Vmessage_log_max) - 1, 0); ;; -XFIXNAT (Vmessage_log_max) - 1, false);
;; del_range_both (BEG, BEG_BYTE, PT, PT_BYTE, 0); ;; del_range_both (BEG, BEG_BYTE, PT, PT_BYTE, false);
;; } ;; }
(when (and (integerp message-log-max) (>= message-log-max 0)) (when (natnump message-log-max)
(let ((begin (point-min)) (let ((begin (point-min))
(end (save-excursion (end (save-excursion
(goto-char (point-max)) (goto-char (point-max))

View file

@ -1316,7 +1316,7 @@ if hasattr(gdb, 'printing'):
itype = ival >> (0 if USE_LSB_TAG else VALBITS) itype = ival >> (0 if USE_LSB_TAG else VALBITS)
itype = itype & ((1 << GCTYPEBITS) - 1) itype = itype & ((1 << GCTYPEBITS) - 1)
# For a Lisp integer N, yield "make_number(N)". # For a Lisp fixnum N, yield "make_fixnum(N)".
if itype == Lisp_Int0 or itype == Lisp_Int1: if itype == Lisp_Int0 or itype == Lisp_Int1:
if USE_LSB_TAG: if USE_LSB_TAG:
ival = ival >> (GCTYPEBITS - 1) ival = ival >> (GCTYPEBITS - 1)
@ -1324,7 +1324,7 @@ if hasattr(gdb, 'printing'):
ival = ival | (-1 << VALBITS) ival = ival | (-1 << VALBITS)
else: else:
ival = ival & ((1 << VALBITS) - 1) ival = ival & ((1 << VALBITS) - 1)
return "make_number(%d)" % ival return "make_fixnum(%d)" % ival
# For non-integers other than nil yield "XIL(N)", where N is a C integer. # For non-integers other than nil yield "XIL(N)", where N is a C integer.
# This helps humans distinguish Lisp_Object values from ordinary # This helps humans distinguish Lisp_Object values from ordinary