aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2019-06-04 08:29:37 -0700
committerPaul Eggert2019-06-04 08:34:16 -0700
commit741d04a87979feac2b26e6e7b9414932f4880166 (patch)
tree810b6b32dff379e12c483968cc8d61905131dbfc
parent7f4558e3d9edbdee6901e5fbcd4a4072f49ec5b9 (diff)
downloademacs-741d04a87979feac2b26e6e7b9414932f4880166.tar.gz
emacs-741d04a87979feac2b26e6e7b9414932f4880166.zip
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".
-rw-r--r--doc/lispintro/emacs-lisp-intro.texi37
-rw-r--r--lisp/emacs-lisp/ert.el8
-rw-r--r--src/.gdbinit4
3 files changed, 24 insertions, 25 deletions
diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi
index 46d86acd4c1..c03fbfc47b2 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
9014system. Since it is very simple, I will digress briefly from Lisp and 9014system. Since it is very simple, I will digress briefly from Lisp and
9015describe it here. 9015describe it here.
9016 9016
9017@c GNU Emacs 24 in src/editfns.c
9018@c the DEFUN for delete-and-extract-region
9019
9020@need 1500 9017@need 1500
9021Like many of the other Emacs primitives, 9018Like many of the other Emacs primitives,
9022@code{delete-and-extract-region} is written as an instance of a C 9019@code{delete-and-extract-region} is written as an instance of a C
9023macro, a macro being a template for code. The complete macro looks 9020macro, a macro being a template for code. The complete macro looks
9024like this: 9021like this:
9025 9022
9023@c This is a copy of editfns.c's DEFUN for delete-and-extract-region.
9026@smallexample 9024@smallexample
9027@group 9025@group
9028DEFUN ("delete-and-extract-region", Fdelete_and_extract_region, 9026DEFUN ("delete-and-extract-region", Fdelete_and_extract_region,
9029 Sdelete_and_extract_region, 2, 2, 0, 9027 Sdelete_and_extract_region, 2, 2, 0,
9030 doc: /* Delete the text between START and END and return it. */) 9028 doc: /* Delete the text between START and END and return it. */)
9031 (Lisp_Object start, Lisp_Object end) 9029 (Lisp_Object start, Lisp_Object end)
9032@{ 9030@{
9033 validate_region (&start, &end); 9031 validate_region (&start, &end);
9034 if (XINT (start) == XINT (end)) 9032 if (XFIXNUM (start) == XFIXNUM (end))
9035 return empty_unibyte_string; 9033 return empty_unibyte_string;
9036 return del_range_1 (XINT (start), XINT (end), 1, 1); 9034 return del_range_1 (XFIXNUM (start), XFIXNUM (end), 1, 1);
9037@} 9035@}
9038@end group 9036@end group
9039@end smallexample 9037@end smallexample
@@ -9097,9 +9095,9 @@ consists of the following four lines:
9097@smallexample 9095@smallexample
9098@group 9096@group
9099validate_region (&start, &end); 9097validate_region (&start, &end);
9100if (XINT (start) == XINT (end)) 9098if (XFIXNUM (start) == XFIXNUM (end))
9101 return empty_unibyte_string; 9099 return empty_unibyte_string;
9102return del_range_1 (XINT (start), XINT (end), 1, 1); 9100return del_range_1 (XFIXNUM (start), XFIXNUM (end), 1, 1);
9103@end group 9101@end group
9104@end smallexample 9102@end smallexample
9105 9103
@@ -9111,27 +9109,28 @@ then return an empty string.
9111The @code{del_range_1} function actually deletes the text. It is a 9109The @code{del_range_1} function actually deletes the text. It is a
9112complex function we will not look into. It updates the buffer and 9110complex function we will not look into. It updates the buffer and
9113does other things. However, it is worth looking at the two arguments 9111does other things. However, it is worth looking at the two arguments
9114passed to @code{del_range_1}. These are @w{@code{XINT (start)}} and 9112passed to @code{del_range_1}. These are @w{@code{XFIXNUM (start)}} and
9115@w{@code{XINT (end)}}. 9113@w{@code{XFIXNUM (end)}}.
9116 9114
9117As far as the C language is concerned, @code{start} and @code{end} are 9115As far as the C language is concerned, @code{start} and @code{end} are
9118two integers that mark the beginning and end of the region to be 9116two opaque values that mark the beginning and end of the region to be
9119deleted@footnote{More precisely, and requiring more expert knowledge 9117deleted. More precisely, and requiring more expert knowledge
9120to understand, the two integers are of type @code{Lisp_Object}, which can 9118to understand, the two values are of type @code{Lisp_Object}, which
9121also be a C union instead of an integer type.}. 9119might be a C pointer, a C integer, or a C @code{struct}; C code
9120ordinarily should not care how @code{Lisp_Object} is implemented.
9122 9121
9123Integer widths depend on the machine, and are typically 32 or 64 bits. 9122@code{Lisp_Object} widths depend on the machine, and are typically 32
9124A few of the bits are used to specify the type of information; the 9123or 64 bits. A few of the bits are used to specify the type of
9125remaining bits are used as content. 9124information; the remaining bits are used as content.
9126 9125
9127@samp{XINT} is a C macro that extracts the relevant number from the 9126@samp{XFIXNUM} is a C macro that extracts the relevant integer from the
9128longer collection of bits; the type bits are discarded. 9127longer collection of bits; the type bits are discarded.
9129 9128
9130@need 800 9129@need 800
9131The command in @code{delete-and-extract-region} looks like this: 9130The command in @code{delete-and-extract-region} looks like this:
9132 9131
9133@smallexample 9132@smallexample
9134del_range_1 (XINT (start), XINT (end), 1, 1); 9133del_range_1 (XFIXNUM (start), XFIXNUM (end), 1, 1);
9135@end smallexample 9134@end smallexample
9136 9135
9137@noindent 9136@noindent
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index 20d013b0797..ab24efe5a71 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -792,13 +792,13 @@ This mainly sets up debugger-related bindings."
792This can be useful after reducing the value of `message-log-max'." 792This can be useful after reducing the value of `message-log-max'."
793 (with-current-buffer (messages-buffer) 793 (with-current-buffer (messages-buffer)
794 ;; This is a reimplementation of this part of message_dolog() in xdisp.c: 794 ;; This is a reimplementation of this part of message_dolog() in xdisp.c:
795 ;; if (NATNUMP (Vmessage_log_max)) 795 ;; if (FIXNATP (Vmessage_log_max))
796 ;; { 796 ;; {
797 ;; scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, 797 ;; scan_newline (Z, Z_BYTE, BEG, BEG_BYTE,
798 ;; -XFASTINT (Vmessage_log_max) - 1, 0); 798 ;; -XFIXNAT (Vmessage_log_max) - 1, false);
799 ;; del_range_both (BEG, BEG_BYTE, PT, PT_BYTE, 0); 799 ;; del_range_both (BEG, BEG_BYTE, PT, PT_BYTE, false);
800 ;; } 800 ;; }
801 (when (and (integerp message-log-max) (>= message-log-max 0)) 801 (when (natnump message-log-max)
802 (let ((begin (point-min)) 802 (let ((begin (point-min))
803 (end (save-excursion 803 (end (save-excursion
804 (goto-char (point-max)) 804 (goto-char (point-max))
diff --git a/src/.gdbinit b/src/.gdbinit
index 8c9a227ee33..c0cf6393594 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1316,7 +1316,7 @@ if hasattr(gdb, 'printing'):
1316 itype = ival >> (0 if USE_LSB_TAG else VALBITS) 1316 itype = ival >> (0 if USE_LSB_TAG else VALBITS)
1317 itype = itype & ((1 << GCTYPEBITS) - 1) 1317 itype = itype & ((1 << GCTYPEBITS) - 1)
1318 1318
1319 # For a Lisp integer N, yield "make_number(N)". 1319 # For a Lisp fixnum N, yield "make_fixnum(N)".
1320 if itype == Lisp_Int0 or itype == Lisp_Int1: 1320 if itype == Lisp_Int0 or itype == Lisp_Int1:
1321 if USE_LSB_TAG: 1321 if USE_LSB_TAG:
1322 ival = ival >> (GCTYPEBITS - 1) 1322 ival = ival >> (GCTYPEBITS - 1)
@@ -1324,7 +1324,7 @@ if hasattr(gdb, 'printing'):
1324 ival = ival | (-1 << VALBITS) 1324 ival = ival | (-1 << VALBITS)
1325 else: 1325 else:
1326 ival = ival & ((1 << VALBITS) - 1) 1326 ival = ival & ((1 << VALBITS) - 1)
1327 return "make_number(%d)" % ival 1327 return "make_fixnum(%d)" % ival
1328 1328
1329 # For non-integers other than nil yield "XIL(N)", where N is a C integer. 1329 # For non-integers other than nil yield "XIL(N)", where N is a C integer.
1330 # This helps humans distinguish Lisp_Object values from ordinary 1330 # This helps humans distinguish Lisp_Object values from ordinary