[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 741d04a 2/3: Adjust comments/debug to match C bignu
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 741d04a 2/3: Adjust comments/debug to match C bignum code |
Date: |
Tue, 4 Jun 2019 11:34:21 -0400 (EDT) |
branch: master
commit 741d04a87979feac2b26e6e7b9414932f4880166
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
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".
---
doc/lispintro/emacs-lisp-intro.texi | 37 ++++++++++++++++++-------------------
lisp/emacs-lisp/ert.el | 8 ++++----
src/.gdbinit | 4 ++--
3 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/doc/lispintro/emacs-lisp-intro.texi
b/doc/lispintro/emacs-lisp-intro.texi
index 46d86ac..c03fbfc 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -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
describe it here.
address@hidden GNU Emacs 24 in src/editfns.c
address@hidden the DEFUN for delete-and-extract-region
-
@need 1500
Like many of the other Emacs primitives,
@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
like this:
address@hidden This is a copy of editfns.c's DEFUN for
delete-and-extract-region.
@smallexample
@group
DEFUN ("delete-and-extract-region", Fdelete_and_extract_region,
Sdelete_and_extract_region, 2, 2, 0,
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);
- if (XINT (start) == XINT (end))
+ if (XFIXNUM (start) == XFIXNUM (end))
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 smallexample
@@ -9097,9 +9095,9 @@ consists of the following four lines:
@smallexample
@group
validate_region (&start, &end);
-if (XINT (start) == XINT (end))
+if (XFIXNUM (start) == XFIXNUM (end))
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 smallexample
@@ -9111,27 +9109,28 @@ then return an empty string.
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
does other things. However, it is worth looking at the two arguments
-passed to @code{del_range_1}. These are @address@hidden (start)}} and
address@hidden@code{XINT (end)}}.
+passed to @code{del_range_1}. These are @address@hidden (start)}} and
address@hidden@code{XFIXNUM (end)}}.
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
address@hidden precisely, and requiring more expert knowledge
-to understand, the two integers are of type @code{Lisp_Object}, which can
-also be a C union instead of an integer type.}.
+two opaque values that mark the beginning and end of the region to be
+deleted. More precisely, and requiring more expert knowledge
+to understand, the two values are of type @code{Lisp_Object}, which
+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.
-A few of the bits are used to specify the type of information; the
-remaining bits are used as content.
address@hidden widths depend on the machine, and are typically 32
+or 64 bits. A few of the bits are used to specify the type of
+information; the remaining bits are used as content.
address@hidden is a C macro that extracts the relevant number from the
address@hidden is a C macro that extracts the relevant integer from the
longer collection of bits; the type bits are discarded.
@need 800
The command in @code{delete-and-extract-region} looks like this:
@smallexample
-del_range_1 (XINT (start), XINT (end), 1, 1);
+del_range_1 (XFIXNUM (start), XFIXNUM (end), 1, 1);
@end smallexample
@noindent
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index 20d013b..ab24efe 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -792,13 +792,13 @@ This mainly sets up debugger-related bindings."
This can be useful after reducing the value of `message-log-max'."
(with-current-buffer (messages-buffer)
;; 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,
- ;; -XFASTINT (Vmessage_log_max) - 1, 0);
- ;; del_range_both (BEG, BEG_BYTE, PT, PT_BYTE, 0);
+ ;; -XFIXNAT (Vmessage_log_max) - 1, false);
+ ;; 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))
(end (save-excursion
(goto-char (point-max))
diff --git a/src/.gdbinit b/src/.gdbinit
index 8c9a227..c0cf639 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1316,7 +1316,7 @@ if hasattr(gdb, 'printing'):
itype = ival >> (0 if USE_LSB_TAG else VALBITS)
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 USE_LSB_TAG:
ival = ival >> (GCTYPEBITS - 1)
@@ -1324,7 +1324,7 @@ if hasattr(gdb, 'printing'):
ival = ival | (-1 << VALBITS)
else:
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.
# This helps humans distinguish Lisp_Object values from ordinary