commit/XEmacs: kehoea: Update the Lisp reader test for all Unicode
code points, mule-tests.el
7 years, 3 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/8df05e6e201f/
Changeset: 8df05e6e201f
User: kehoea
Date: 2017-09-30 15:16:08+00:00
Summary: Update the Lisp reader test for all Unicode code points, mule-tests.el
tests/ChangeLog addition:
2017-09-30 Aidan Kehoe <kehoea(a)parhasard.net>
[...]
* automated/mule-tests.el:
[...]
The Lisp reader will now handle all legitimate Unicode code points
fine if unicode-internal, and Ben's code approach with old-mule
now gives a different error than the Known-Bug-Expect-Error
checked for. Update the code to reflect this.
Affected #: 2 files
diff -r 6f9111895fd5675fbdbb41da7370ff03f2cb687c -r 8df05e6e201fbbd618c7127c762bf954028ceec3 tests/ChangeLog
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -14,6 +14,10 @@
unicode-internal merge removed that charset, relying on the
just-in-time Unicode codepoint support for the corresponding
characters.
+ The Lisp reader will now handle all legitimate Unicode code points
+ fine if unicode-internal, and Ben's code approach with old-mule
+ now gives a different error than the Known-Bug-Expect-Error
+ checked for. Update the code to reflect this.
* automated/os-tests.el:
Call #'Check-Error correctly here when testing the restrictions on
the ZONE argument to #'encode-time
diff -r 6f9111895fd5675fbdbb41da7370ff03f2cb687c -r 8df05e6e201fbbd618c7127c762bf954028ceec3 tests/automated/mule-tests.el
--- a/tests/automated/mule-tests.el
+++ b/tests/automated/mule-tests.el
@@ -868,18 +868,30 @@
(Assert-elc-is-escape-quoted)
(delete-region (point-min) (point-max))))
- (Known-Bug-Expect-Error
- invalid-constant
- (loop
- for i from #x0 to #x10FFFF
- with exceptions = #s(range-table type start-closed-end-closed
- data ((#xFFFE #xFFFF) t
- (#xFDD0 #xFDEF) t
- (#xD800 #xDBFF) t
- (#xDC00 #xDFFF) t))
- do (unless (get-range-table i exceptions)
- (read (format (if (> i #xFFFF) #r"?\U%08X" #r"?\u%04X") i)))
- finally return t))
+ (labels
+ ((read-all-unicode ()
+ (with-temp-buffer
+ (loop for i from #x0 to #x10FFFF
+ with exceptions = #s(range-table type start-closed-end-closed
+ data ((#xFFFE #xFFFF) t
+ (#xFDD0 #xFDEF) t
+ (#xD800 #xDBFF) t
+ (#xDC00 #xDFFF) t))
+ with result = t
+ do (unless (get-range-table i exceptions)
+ (delete-region (point-min) (point-max))
+ (format-into (current-buffer)
+ (if (> i #xFFFF) #r"?\U%08X" #r"?\u%04X")
+ i)
+ (goto-char (point-min))
+ (setq result (and (characterp (read (current-buffer)))
+ result)))
+ finally (Assert result)))))
+ (when (compiled-function-p #'read-all-unicode)
+ (if (featurep 'unicode-internal)
+ (read-all-unicode)
+ (Known-Bug-Expect-Error syntax-error (read-all-unicode)))))
+
(loop
for i from #x00 to #xff
do (Assert
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: 2 new changesets
7 years, 3 months
Bitbucket
2 new commits in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/7d977d247549/
Changeset: 7d977d247549
User: kehoea
Date: 2017-09-30 14:51:56+00:00
Summary: Correct my Check-Error syntax, tests/automated/os-tests.el
tests/ChangeLog addition:
2017-09-30 Aidan Kehoe <kehoea(a)parhasard.net>
[...]
* automated/os-tests.el:
Call #'Check-Error correctly here when testing the restrictions on
the ZONE argument to #'encode-time
Affected #: 2 files
diff -r 82f2cfb6d5e65cb6aaddd215b77f4522b955c73d -r 7d977d2475494e52eb00fe1eb1fae9b33c5c672e tests/ChangeLog
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -14,6 +14,9 @@
unicode-internal merge removed that charset, relying on the
just-in-time Unicode codepoint support for the corresponding
characters.
+ * automated/os-tests.el:
+ Call #'Check-Error correctly here when testing the restrictions on
+ the ZONE argument to #'encode-time
2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
diff -r 82f2cfb6d5e65cb6aaddd215b77f4522b955c73d -r 7d977d2475494e52eb00fe1eb1fae9b33c5c672e tests/automated/os-tests.el
--- a/tests/automated/os-tests.el
+++ b/tests/automated/os-tests.el
@@ -125,11 +125,11 @@
;; Check some restrictions introduced to the ZONE argument to #'encode-time.
-(Check-Error (encode-time 24 4 20 11 5 2017 -86401) args-out-of-range)
+(Check-Error args-out-of-range (encode-time 24 4 20 11 5 2017 -86401))
(Assert (equal (encode-time 24 4 20 11 5 2017 -86400)
'(22806 . 5448))) ;; "05/12/17 09:04:25 PM"
(Assert (equal (encode-time 24 4 20 11 5 2017 86400)
'(22803 . 29256))) ;; "05/10/17 09:04:24 PM"
-(Check-Error (encode-time 24 4 20 11 5 2017 86401) args-out-of-range)
+(Check-Error args-out-of-range (encode-time 24 4 20 11 5 2017 86401))
;;; end of os-tests.el
https://bitbucket.org/xemacs/xemacs/commits/6f9111895fd5/
Changeset: 6f9111895fd5
User: kehoea
Date: 2017-09-30 14:56:50+00:00
Summary: Give CHAR_CODE_LIMIT a more useful value, old-Mule
src/ChangeLog addition:
2017-09-30 Aidan Kehoe <kehoea(a)parhasard.net>
* text.c (old_mule_non_ascii_valid_ichar_p):
Use CHAR_CODE_LIMIT here rather than a magic constant.
* text.h:
Give CHAR_CODE_LIMIT a more useful value on old-Mule, especially
helpful for #'test-chars in mule-tests.el
Affected #: 3 files
diff -r 7d977d2475494e52eb00fe1eb1fae9b33c5c672e -r 6f9111895fd5675fbdbb41da7370ff03f2cb687c src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2017-09-30 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * text.c (old_mule_non_ascii_valid_ichar_p):
+ Use CHAR_CODE_LIMIT here rather than a magic constant.
+ * text.h:
+ Give CHAR_CODE_LIMIT a more useful value on old-Mule, especially
+ helpful for #'test-chars in mule-tests.el
+
2017-09-28 Stephen J. Turnbull <stephen(a)xemacs.org>
Fix crash in unicode_to_charset_codepoint_raw.
diff -r 7d977d2475494e52eb00fe1eb1fae9b33c5c672e -r 6f9111895fd5675fbdbb41da7370ff03f2cb687c src/text.c
--- a/src/text.c
+++ b/src/text.c
@@ -1507,7 +1507,7 @@
int f1, f2, f3;
/* Must have only lowest 21 bits set */
- if (ch & ~0x1FFFFF)
+ if (ch & ~(CHAR_CODE_LIMIT - 1))
return 0;
f1 = ichar_field1 (ch);
diff -r 7d977d2475494e52eb00fe1eb1fae9b33c5c672e -r 6f9111895fd5675fbdbb41da7370ff03f2cb687c src/text.h
--- a/src/text.h
+++ b/src/text.h
@@ -507,13 +507,13 @@
#ifdef UNICODE_INTERNAL
#define MAX_ICHAR_LEN 6
+/* Exclusive upper bound on char codes. */
+#define CHAR_CODE_LIMIT 0x40000000
#else
#define MAX_ICHAR_LEN 4
+#define CHAR_CODE_LIMIT 0x200000
#endif
-/* Exclusive upper bound on char codes. */
-#define CHAR_CODE_LIMIT 0x40000000
-
#ifdef UNICODE_INTERNAL
#define FIRST_TRAILING_BYTE 0x80
#define LAST_TRAILING_BYTE 0xBF
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: kehoea: Now we've dropped the IPA charset,
remove those chars from HELLO
7 years, 3 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/82f2cfb6d5e6/
Changeset: 82f2cfb6d5e6
User: kehoea
Date: 2017-09-30 13:47:13+00:00
Summary: Now we've dropped the IPA charset, remove those chars from HELLO
tests/ChangeLog addition:
2017-09-30 Aidan Kehoe <kehoea(a)parhasard.net>
[...]
Remove ipa from the list of charsets in HELLO, since the
unicode-internal merge removed that charset, relying on the
just-in-time Unicode codepoint support for the corresponding
characters.
etc/ChangeLog addition:
2017-09-30 Aidan Kehoe <kehoea(a)parhasard.net>
* HELLO:
Encode the IPA using ISO-IR 196 rather than our proprietary
charset, which we dropped in the process of merging the
unicode-internal support.
Affected #: 4 files
diff -r e183dc2a264ece3c1fa543b7d8665592d444a7da -r 82f2cfb6d5e65cb6aaddd215b77f4522b955c73d etc/ChangeLog
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,10 @@
+2017-09-30 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * HELLO:
+ Encode the IPA using ISO-IR 196 rather than our proprietary
+ charset, which we dropped in the process of merging the
+ unicode-internal support.
+
2017-03-13 Aidan Kehoe <kehoea(a)parhasard.net>
* unicode/unicode-consortium/EASTASIA/OBSOLETE/BIG5.TXT:
diff -r e183dc2a264ece3c1fa543b7d8665592d444a7da -r 82f2cfb6d5e65cb6aaddd215b77f4522b955c73d etc/HELLO
--- a/etc/HELLO
+++ b/etc/HELLO
@@ -25,7 +25,7 @@
Danish (dansk) Hej / Goddag / Hall,Ax(Bj
Dutch (Nederlands) Hallo / Dag
Emacs emacs --no-splash -f view-hello-file
-English /,0p!,D?%Gɡ%@(Bl,0!L(B/ Hello
+English /%Gˈɪ%@,D?%Gɡ%@(Bl%Gɪʃ%@/ Hello
Esperanto Saluton (E,C6(Bo,C~(Ban,Cx(Bo ,Cf(Biu,C<(Ba,C}(Bde)
Estonian (eesti keel) Tere p,Ad(Bevast / Tere ,Au(Bhtust
Finnish (suomi) Hei / Hyv,Add(B p,Ad(Biv,Add(B
diff -r e183dc2a264ece3c1fa543b7d8665592d444a7da -r 82f2cfb6d5e65cb6aaddd215b77f4522b955c73d tests/ChangeLog
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -10,7 +10,11 @@
* automated/mule-tests.el (test-chars):
Update the docstring of this function. Only call it when the tests
are running byte-compiled.
-
+ Remove ipa from the list of charsets in HELLO, since the
+ unicode-internal merge removed that charset, relying on the
+ just-in-time Unicode codepoint support for the corresponding
+ characters.
+
2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/lisp-tests.el:
diff -r e183dc2a264ece3c1fa543b7d8665592d444a7da -r 82f2cfb6d5e65cb6aaddd215b77f4522b955c73d tests/automated/mule-tests.el
--- a/tests/automated/mule-tests.el
+++ b/tests/automated/mule-tests.el
@@ -668,7 +668,7 @@
(let ((sorted-charsets-in-HELLO
'(arabic-iso8859-6 ascii chinese-big5-1 chinese-gb2312
cyrillic-iso8859-5 ethiopic greek-iso8859-7 hebrew-iso8859-8
- indian-is13194 ipa japanese-jisx0208 japanese-jisx0212
+ indian-is13194 japanese-jisx0208 japanese-jisx0212
katakana-jisx0201 korean-ksc5601 lao latin-iso8859-1
latin-iso8859-2 latin-iso8859-3 latin-iso8859-4 thai-tis620
tibetan vietnamese-viscii-lower))
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: kehoea: Only call #'test-chars when running
byte-compiled, mule-tests.el
7 years, 3 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/e183dc2a264e/
Changeset: e183dc2a264e
User: kehoea
Date: 2017-09-30 13:31:19+00:00
Summary: Only call #'test-chars when running byte-compiled, mule-tests.el
2017-09-30 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/extent-tests.el:
Update check for varying-length case transformation to work
following the unicode-internal merge, LATIN CAPITAL LETTER I WITH
DOT ABOVE may be from a distinct charset on old-mule.
* automated/lisp-tests.el:
Really don't check whether #'auto-save-escape-name always creates
a new string, now it doesn't.
* automated/mule-tests.el (test-chars):
Update the docstring of this function. Only call it when the tests
are running byte-compiled.
Affected #: 2 files
diff -r 3cbfc9e40cf7617b4d15b5bc913c3c1dd12e2516 -r e183dc2a264ece3c1fa543b7d8665592d444a7da tests/ChangeLog
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -7,7 +7,10 @@
* automated/lisp-tests.el:
Really don't check whether #'auto-save-escape-name always creates
a new string, now it doesn't.
-
+ * automated/mule-tests.el (test-chars):
+ Update the docstring of this function. Only call it when the tests
+ are running byte-compiled.
+
2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/lisp-tests.el:
diff -r 3cbfc9e40cf7617b4d15b5bc913c3c1dd12e2516 -r e183dc2a264ece3c1fa543b7d8665592d444a7da tests/automated/mule-tests.el
--- a/tests/automated/mule-tests.el
+++ b/tests/automated/mule-tests.el
@@ -41,9 +41,10 @@
(defun test-chars (&optional for-test-harness)
"Insert all characters in a buffer, to see if XEmacs will crash.
-This is done by creating a string with all the legal characters
-in [0, 2^21) range, inserting it into the buffer, and checking
-that the buffer's contents are equivalent to the string.
+This is done by creating a string with all the legal characters
+\(see the documentation for the variable `char-code-limit' and the function
+`char-int'), inserting it into the buffer, and checking that the buffer's
+contents are equivalent to the string.
If FOR-TEST-HARNESS is specified, a temporary buffer is used, and
the Assert macro checks for correctness."
@@ -73,11 +74,9 @@
(insert string)
(assert (equal (buffer-string) string))))))
-;; It would be really *really* nice if test-harness allowed a way to
-;; run a test in byte-compiled mode only. It's tedious to have
-;; time-consuming tests like this one run twice, once interpreted and
-;; once compiled, for no good reason.
-(test-chars t)
+;; Run #'test-chars in byte-compiled mode only.
+(when (compiled-function-p (symbol-function 'test-chars))
+ (test-chars t))
(defun unicode-code-point-to-utf-8-string (code-point)
"Convert a Unicode code point to the equivalent UTF-8 string.
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: 2 new changesets
7 years, 3 months
Bitbucket
2 new commits in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/553b0328db22/
Changeset: 553b0328db22
User: kehoea
Date: 2017-09-30 10:01:37+00:00
Summary: Drop thai-iso8859-11, it is identical to thai-tis620 and confuses tests.
2017-09-30 Aidan Kehoe <kehoea(a)parhasard.net>
* mule/thai.el:
* mule/thai.el (thai-tis620):
* mule/thai.el (tis-620):
The charset thai-iso8859-11 is identical to thai-tis620 for our
purposes, and its presence makes the digit-char test code fail on
non-mule. Remove it. Use tis-620, the preferred IANA name for
related coding system, as the related coding system name. Provide
iso-8859-11, not actually an IANA name, as an alias.
Affected #: 2 files
diff -r 76f43a5976366dda6eccf404c05780778ba1f0f7 -r 553b0328db22a9e8d8aa6159493a344cd730d72a lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
+2017-09-30 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * mule/thai.el:
+ * mule/thai.el (thai-tis620):
+ * mule/thai.el (tis-620):
+ The charset thai-iso8859-11 is identical to thai-tis620 for our
+ purposes, and its presence makes the digit-char test code fail on
+ non-mule. Remove it. Use tis-620, the preferred IANA name for
+ related coding system, as the related coding system name. Provide
+ iso-8859-11, not actually an IANA name, as an alias.
+
2017-09-25 Aidan Kehoe <kehoea(a)parhasard.net>
* subr.el (concat):
diff -r 76f43a5976366dda6eccf404c05780778ba1f0f7 -r 553b0328db22a9e8d8aa6159493a344cd730d72a lisp/mule/thai.el
--- a/lisp/mule/thai.el
+++ b/lisp/mule/thai.el
@@ -27,29 +27,17 @@
;;; Code:
-(make-charset
- 'thai-iso8859-11
- "Right-Hand Part of Latin/Thai Alphabet (ISO/IEC 8859-11)"
- '(dimension 1
- registries ["ISO8859-11"]
- chars 96
- ;final ?T @@#### What is the final byte for this?
- graphic 1
- unicode-map ("unicode/unicode-consortium/ISO8859/8859-11.TXT" #xA0)
- short-name "Thai (ISO8859-11)"
- long-name "RHP of Thai (ISO 8859-11)"
- tags (iso8859 thai)))
+;; XEmacs; drop the thai-iso8859-11 charset, which is identical to thai-tis620
+;; for our purposes, and confuses the digit-char checks in the test suite on
+;; non-unicode-internal.
(make-coding-system
- 'thai-tis620 'multibyte "Thai/TIS620"
+ 'tis-620 'multibyte "Thai/TIS620"
'(charsets (ascii thai-tis620)
mnemonic "Thai"
post-read-conversion thai-post-read-conversion
- documentation "8-bit encoding for ASCII (MSB=0) and Thai TIS620 (MSB=1)"))
-
-(define-coding-system-alias 'th-tis620 'thai-tis620)
-(define-coding-system-alias 'tis620 'thai-tis620)
-(define-coding-system-alias 'tis-620 'thai-tis620)
+ documentation "8-bit encoding for ASCII (MSB=0) and Thai TIS620 (MSB=1)"
+ aliases (iso-8859-11 thai-tis620 th-tis620 tis620)))
(set-language-info-alist
"Thai" '((tutorial . "TUTORIAL.th")
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: 2 new changesets
7 years, 3 months
Bitbucket
2 new commits in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/956a15b5f50d/
Changeset: 956a15b5f50d
User: stephen_at_xemacs
Date: 2017-09-28 04:10:46+00:00
Summary: Fix crash in unicode_to_charset_codepoint_raw.
* mule-coding.c (vars_of_mule_coding):
Fix broken staticpro of Vbig5_precedence (cause of crash).
* unicode.c (vars_of_unicode):
Delete duplicated initialization of Vprecedence_array_cons_to_array.
(Defect, but probably harmless.)
Affected #: 3 files
diff -r 8dea4d0549ac0a49456d01bba96171399456c227 -r 956a15b5f50d8aa60c8f96c9af97042fcf1d2815 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
+2017-09-28 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ Fix crash in unicode_to_charset_codepoint_raw.
+
+ * mule-coding.c (vars_of_mule_coding):
+ Fix broken staticpro of Vbig5_precedence (cause of crash).
+
+ * unicode.c (vars_of_unicode):
+ Delete duplicated initialization of Vprecedence_array_cons_to_array.
+ (Defect, but probably harmless.)
+
2017-06-28 Aidan Kehoe <kehoea(a)parhasard.net>
* text.c (Fchar_width):
diff -r 8dea4d0549ac0a49456d01bba96171399456c227 -r 956a15b5f50d8aa60c8f96c9af97042fcf1d2815 src/mule-coding.c
--- a/src/mule-coding.c
+++ b/src/mule-coding.c
@@ -4169,7 +4169,7 @@
staticpro (&Vshift_jis_precedence);
Vbig5_precedence = Qnil;
- staticpro (&Vshift_jis_precedence);
+ staticpro (&Vbig5_precedence);
}
void
diff -r 8dea4d0549ac0a49456d01bba96171399456c227 -r 956a15b5f50d8aa60c8f96c9af97042fcf1d2815 src/unicode.c
--- a/src/unicode.c
+++ b/src/unicode.c
@@ -3999,15 +3999,12 @@
Vprecedence_array_charsets_seen_hash =
make_lisp_hash_table (20, HASH_TABLE_NON_WEAK, Qeq);
- staticpro (&Vprecedence_array_charsets_seen_hash);
- Vprecedence_array_charsets_seen_hash =
- make_lisp_hash_table (20, HASH_TABLE_NON_WEAK, Qeq);
-
staticpro (&Vprecedence_list_to_array);
Vprecedence_list_to_array =
/* The entries are lists, but for speed in lookup, we only compare
using `eq'. */
make_lisp_hash_table (20, HASH_TABLE_KEY_WEAK, Qeq);
+
staticpro (&Vprecedence_array_cons_to_array);
Vprecedence_array_cons_to_array =
/* We must compare with `equal' since we have conses. We make the table
https://bitbucket.org/xemacs/xemacs/commits/76f43a597636/
Changeset: 76f43a597636
User: stephen_at_xemacs
Date: 2017-09-28 04:47:26+00:00
Summary: Merge fix for crash in unicode_to_charset_codepoint_raw.
Affected #: 3 files
diff -r 75f4aa8ac1314dcbbdfc21602ff4084b4a0253c0 -r 76f43a5976366dda6eccf404c05780778ba1f0f7 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
+2017-09-28 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ Fix crash in unicode_to_charset_codepoint_raw.
+
+ * mule-coding.c (vars_of_mule_coding):
+ Fix broken staticpro of Vbig5_precedence (cause of crash).
+
+ * unicode.c (vars_of_unicode):
+ Delete duplicated initialization of Vprecedence_array_cons_to_array.
+ (Defect, but probably harmless.)
+
2017-09-25 Aidan Kehoe <kehoea(a)parhasard.net>
* data.c (Fchar_to_int):
diff -r 75f4aa8ac1314dcbbdfc21602ff4084b4a0253c0 -r 76f43a5976366dda6eccf404c05780778ba1f0f7 src/mule-coding.c
--- a/src/mule-coding.c
+++ b/src/mule-coding.c
@@ -4169,7 +4169,7 @@
staticpro (&Vshift_jis_precedence);
Vbig5_precedence = Qnil;
- staticpro (&Vshift_jis_precedence);
+ staticpro (&Vbig5_precedence);
}
void
diff -r 75f4aa8ac1314dcbbdfc21602ff4084b4a0253c0 -r 76f43a5976366dda6eccf404c05780778ba1f0f7 src/unicode.c
--- a/src/unicode.c
+++ b/src/unicode.c
@@ -4000,15 +4000,12 @@
Vprecedence_array_charsets_seen_hash =
make_lisp_hash_table (20, HASH_TABLE_NON_WEAK, Qeq);
- staticpro (&Vprecedence_array_charsets_seen_hash);
- Vprecedence_array_charsets_seen_hash =
- make_lisp_hash_table (20, HASH_TABLE_NON_WEAK, Qeq);
-
staticpro (&Vprecedence_list_to_array);
Vprecedence_list_to_array =
/* The entries are lists, but for speed in lookup, we only compare
using `eq'. */
make_lisp_hash_table (20, HASH_TABLE_KEY_WEAK, Qeq);
+
staticpro (&Vprecedence_array_cons_to_array);
Vprecedence_array_cons_to_array =
/* We must compare with `equal' since we have conses. We make the table
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: kehoea: Correct, expand some docstrings, data.c,
elhash.c, subr.el
7 years, 3 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/75f4aa8ac131/
Changeset: 75f4aa8ac131
User: kehoea
Date: 2017-09-25 06:26:00+00:00
Summary: Correct, expand some docstrings, data.c, elhash.c, subr.el
src/ChangeLog addition:
2017-09-25 Aidan Kehoe <kehoea(a)parhasard.net>
* data.c (Fchar_to_int):
Clarify the details of the integer to character mapping in the
docstring, mentioning Unicode.
* elhash.c (Fdefine_hash_table_test):
Correct my understanding of the required range for hash values;
since we get the modulus of the hash value base HT->SIZE, the most
significant bits don't matter as much.
* fns.c (Fstring_lessp):
Fix a typo in a comment here.
lisp/ChangeLog addition:
2017-09-25 Aidan Kehoe <kehoea(a)parhasard.net>
* subr.el (concat):
This function hasn't accepted individual fixnums as arguments in
twenty years, and GNU's version of the function doesn't
either. Remove all mention of it.
Clarify the types of the elements accepted in the argument sequences.
* subr.el (bvconcat):
Clarify the types of the elements accepted in the argument sequences.
Affected #: 6 files
diff -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 -r 75f4aa8ac1314dcbbdfc21602ff4084b4a0253c0 lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
+2017-09-25 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * subr.el (concat):
+ This function hasn't accepted individual fixnums as arguments in
+ twenty years, and GNU's version of the function doesn't
+ either. Remove all mention of it.
+ Clarify the types of the elements accepted in the argument sequences.
+ * subr.el (bvconcat):
+ Clarify the types of the elements accepted in the argument sequences.
+
2017-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
* rect.el (delete-extract-rectangle-line):
diff -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 -r 75f4aa8ac1314dcbbdfc21602ff4084b4a0253c0 lisp/subr.el
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -206,12 +206,10 @@
(defun concat (&rest args)
"Concatenate all the arguments and make the result a string.
The result is a string whose elements are the elements of all the arguments.
-Each argument may be a string or a list or vector of characters.
+Each argument may be a list, vector, bit-vector or string.
-As of XEmacs 21.0, this function does NOT accept individual integers
-as arguments. Old code that relies on, for example, (concat \"foo\" 50)
-returning \"foo50\" will fail. To fix such code, either apply
-`int-to-string' to the integer argument, or use `format'."
+Argument elements must be characters, or integers that can be converted to
+characters; see `char-int'."
(apply #'concatenate 'string args))
(defun vconcat (&rest args)
@@ -223,7 +221,10 @@
(defun bvconcat (&rest args)
"Concatenate all the arguments and make the result a bit vector.
The result is a bit vector whose elements are the elements of all the
-arguments. Each argument may be a list, vector, bit vector, or string."
+arguments. Each argument may be a list, vector, bit vector, or string.
+
+Argument elements must be the integers zero or one, or the characters ?\\x00,
+?\\x01."
(apply #'concatenate 'bit-vector args))
;; XEmacs; move these non-basic predicates that can be easily implemented in
diff -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 -r 75f4aa8ac1314dcbbdfc21602ff4084b4a0253c0 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
+2017-09-25 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * data.c (Fchar_to_int):
+ Clarify the details of the integer to character mapping in the
+ docstring, mentioning Unicode.
+ * elhash.c (Fdefine_hash_table_test):
+ Correct my understanding of the required range for hash values;
+ since we get the modulus of the hash value base HT->SIZE, the most
+ significant bits don't matter as much.
+ * fns.c (Fstring_lessp):
+ Fix a typo in a comment here.
+
2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
* chartab.c (chartab_data_validate):
diff -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 -r 75f4aa8ac1314dcbbdfc21602ff4084b4a0253c0 src/data.c
--- a/src/data.c
+++ b/src/data.c
@@ -394,10 +394,15 @@
128 - 159 Control set 1
160 - 255 Right half of ISO-8859-1
-If support for Mule does not exist, these are the only valid character
-values. When Mule support exists, the values assigned to other characters
-may vary depending on the particular version of XEmacs, the order in which
-character sets were loaded, etc., and you should not depend on them.
+If the `unicode-internal' feature is available, other integer values reflect
+ISO-10646 values for character codes. Otherwise, if the `mule' feature is
+available, the values assigned to other characters may vary depending on the
+particular version of XEmacs, the order in which character sets were loaded,
+and you should not depend on them.
+
+Some XEmacs builds have neither the `mule' nor the `unicode-internal' features
+available, and in these builds no character has an integer value greater than
+255.
*/
(character))
{
diff -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 -r 75f4aa8ac1314dcbbdfc21602ff4084b4a0253c0 src/elhash.c
--- a/src/elhash.c
+++ b/src/elhash.c
@@ -2557,14 +2557,15 @@
if both arguments are the same. HASH-FUNCTION must be a function taking one
argument and returning an integer that is the hash code of the argument.
-Computation should use the whole value range of the underlying machine long
-type. In XEmacs this will necessitate bignums for values above
-`most-positive-fixnum' but below (1+ (* most-positive-fixnum 2)) and
-analogous values below `most-negative-fixnum'. Relatively poor hashing
-performance is guaranteed in a build without bignums.
-
-This function returns t if successful, and errors if NAME
-cannot be defined as a hash table test.
+Computation should ideally use the whole value range of the underlying machine
+long type. In XEmacs this necessitates bignums for values above
+`most-positive-fixnum' but below (1+ (* most-positive-fixnum 2)) and analogous
+values below `most-negative-fixnum'. With this implementation, however, the
+low-order bits are the most important, and so it is reasonable not to bother
+producing bignums.
+
+This function returns t if successful, and errors if NAME cannot be defined as
+a hash table test.
*/
(name, equal_function, hash_function))
{
diff -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 -r 75f4aa8ac1314dcbbdfc21602ff4084b4a0253c0 src/fns.c
--- a/src/fns.c
+++ b/src/fns.c
@@ -267,7 +267,7 @@
/* Since we've assigned Control-1 and Latin-1 the two lowest leading
bytes, the statement above about them and their ordering w.r.t. other
charsets is guaranteed. Also, UTF-8 preserves Unicode character order
- when comparing byte-by-byte. So need no to do an actual char-by-char
+ when comparing byte-by-byte. So no need to do an actual char-by-char
comparison. */
if (qxememcmp4 (XSTRING_DATA (p1), XSTRING_LENGTH (p1),
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: 3 new changesets
7 years, 3 months
Bitbucket
3 new commits in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/dfe676a17eba/
Changeset: dfe676a17eba
User: kehoea
Date: 2017-09-24 08:16:02+00:00
Summary: Support the full bit width of the underlying Fixnum, const-integer variables
src/ChangeLog addition:
2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
* symbols.c (do_symval_forwarding):
* symbols.c (store_symval_forwarding):
If we have bignum support, and a const-integer or built-in integer
value (bit width one more than Lisp fixnums) needs bignum support
to pass its value to Lisp, use that support.
Affected #: 2 files
diff -r d3e0eec3a5082a28cdff11a9e5629b076abd4a17 -r dfe676a17ebadf7f07b8b5afb67f38e30fc65400 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * symbols.c (do_symval_forwarding):
+ * symbols.c (store_symval_forwarding):
+ If we have bignum support, and a const-integer or built-in integer
+ value (bit width one more than Lisp fixnums) needs bignum support
+ to pass its value to Lisp, use that support.
+
2017-09-23 Aidan Kehoe <kehoea(a)parhasard.net>
* process.c (read_process_output): Have this return a Bytecount,
diff -r d3e0eec3a5082a28cdff11a9e5629b076abd4a17 -r dfe676a17ebadf7f07b8b5afb67f38e30fc65400 src/symbols.c
--- a/src/symbols.c
+++ b/src/symbols.c
@@ -875,7 +875,7 @@
{
case SYMVAL_FIXNUM_FORWARD:
case SYMVAL_CONST_FIXNUM_FORWARD:
- return make_fixnum (*((Fixnum *)symbol_value_forward_forward (fwd)));
+ return make_integer (*((Fixnum *)symbol_value_forward_forward (fwd)));
case SYMVAL_BOOLEAN_FORWARD:
case SYMVAL_CONST_BOOLEAN_FORWARD:
@@ -1045,10 +1045,29 @@
switch (XSYMBOL_VALUE_MAGIC_TYPE (ovalue))
{
case SYMVAL_FIXNUM_FORWARD:
- CHECK_FIXNUM (newval);
+ CHECK_INTEGER (newval);
if (magicfun)
magicfun (sym, &newval, Qnil, 0);
- *((Fixnum *) symbol_value_forward_forward (fwd)) = XFIXNUM (newval);
+#if HAVE_BIGNUM
+ if (BIGNUMP (newval))
+ {
+ if (bignum_fits_emacs_int_p (XBIGNUM_DATA (newval)))
+ {
+ *((Fixnum *) symbol_value_forward_forward (fwd))
+ = bignum_to_emacs_int (XBIGNUM_DATA (newval));
+ }
+ else
+ {
+ args_out_of_range (sym, newval);
+ }
+ }
+ else
+#endif
+ {
+ *((Fixnum *) symbol_value_forward_forward (fwd))
+ = XFIXNUM (newval);
+ }
+
return;
case SYMVAL_BOOLEAN_FORWARD:
https://bitbucket.org/xemacs/xemacs/commits/0d158ce02501/
Changeset: 0d158ce02501
User: kehoea
Date: 2017-09-24 09:43:32+00:00
Summary: Error when passed lengths that would overflow, #'make-vector, #'make-string
src/ChangeLog addition:
2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
Error when passed values that would overflow, #'make-vector,
#'make-string, #'make-bit-vector
* lisp.h:
Make ARRAY_DIMENSION_LIMIT more realistic; provide analagous
but larger STRING_BYTE_TOTAL_SIZE_LIMIT,
BIT_VECTOR_TOTAL_SIZE_LIMIT.
* lisp.h (struct Lisp_Vector):
SIZE is now an Elemcount, not a long.
* alloc.c:
Provide Vstring_total_size_limit, Vbit_vector_total_size_limit.
* alloc.c (make_uninit_vector):
Do our size calculation with EMACS_UINT; assert we haven't
overflowed.
* alloc.c (Fmake_vector):
Check LENGTH for range more correctly.
* alloc.c (Fvector):
Check NARGS for range.
* alloc.c (make_bit_vector_internal):
Document why we don't need to check SIZEI for range in this
function.
* alloc.c (make_bit_vector_from_byte_vector):
Check the range here, no point creating a bit vector where the
trailing elements can't be referenced from Lisp.
* alloc.c (Fmake_bit_vector):
Check LENGTH using BIT_VECTOR_TOTAL_SIZE_LIMIT; check that BIT is
a bit before allocating anything.
* alloc.c (Fbit_vector):
Check NARGS for range.
* alloc.c (make_uninit_string):
Do the length calculation and overflow assertion check with
EMACS_UINTs, so GCC doesn't eliminate the check when optimising.
* alloc.c (Fmake_string):
Check LENGTH for possible overflow in this function.
* alloc.c (Fstring):
Check NARGS for possible overflow in this function.
* alloc.c (vars_of_alloc):
Provide, document `string-total-size-limit',
`bit-vector-total-size-limit'.
* event-stream.c (Frecent_keys):
Use ARRAY_DIMENSION_LIMIT correctly here.
* sequence.c (concatenate):
Check for overflow before allocating strings, vectors, using
unsigned arithmetic so GCC doesn't optimize away signed checks.
tests/ChangeLog addition:
2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/lisp-tests.el:
Basic checks that array-total-size-limit,
bit-vector-total-size-limit, string-total-size-limit are
respected.
Affected #: 7 files
diff -r dfe676a17ebadf7f07b8b5afb67f38e30fc65400 -r 0d158ce025013acbf1023cfb86be2fde9c495a84 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,49 @@
+2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ Error when passed values that would overflow, #'make-vector,
+ #'make-string, #'make-bit-vector
+ * lisp.h:
+ Make ARRAY_DIMENSION_LIMIT more realistic; provide analagous
+ but larger STRING_BYTE_TOTAL_SIZE_LIMIT,
+ BIT_VECTOR_TOTAL_SIZE_LIMIT.
+ * lisp.h (struct Lisp_Vector):
+ SIZE is now an Elemcount, not a long.
+ * alloc.c:
+ Provide Vstring_total_size_limit, Vbit_vector_total_size_limit.
+ * alloc.c (make_uninit_vector):
+ Do our size calculation with EMACS_UINT; assert we haven't
+ overflowed.
+ * alloc.c (Fmake_vector):
+ Check LENGTH for range more correctly.
+ * alloc.c (Fvector):
+ Check NARGS for range.
+ * alloc.c (make_bit_vector_internal):
+ Document why we don't need to check SIZEI for range in this
+ function.
+ * alloc.c (make_bit_vector_from_byte_vector):
+ Check the range here, no point creating a bit vector where the
+ trailing elements can't be referenced from Lisp.
+ * alloc.c (Fmake_bit_vector):
+ Check LENGTH using BIT_VECTOR_TOTAL_SIZE_LIMIT; check that BIT is
+ a bit before allocating anything.
+ * alloc.c (Fbit_vector):
+ Check NARGS for range.
+ * alloc.c (make_uninit_string):
+ Do the length calculation and overflow assertion check with
+ EMACS_UINTs, so GCC doesn't eliminate the check when optimising.
+ * alloc.c (Fmake_string):
+ Check LENGTH for possible overflow in this function.
+ * alloc.c (Fstring):
+ Check NARGS for possible overflow in this function.
+ * alloc.c (vars_of_alloc):
+ Provide, document `string-total-size-limit',
+ `bit-vector-total-size-limit'.
+ * event-stream.c (Frecent_keys):
+ Use ARRAY_DIMENSION_LIMIT correctly here.
+ * sequence.c (concatenate):
+ Check for overflow before allocating strings, vectors, using
+ unsigned arithmetic so GCC doesn't optimize away signed checks.
+
2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
* symbols.c (do_symval_forwarding):
diff -r dfe676a17ebadf7f07b8b5afb67f38e30fc65400 -r 0d158ce025013acbf1023cfb86be2fde9c495a84 src/alloc.c
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -95,6 +95,7 @@
#endif
Fixnum Varray_dimension_limit, Varray_total_size_limit, Varray_rank_limit;
+Fixnum Vstring_total_size_limit, Vbit_vector_total_size_limit;
int need_to_check_c_alloca;
int need_to_signal_post_gc;
@@ -1864,11 +1865,16 @@
make_uninit_vector (Elemcount sizei)
{
/* no `next' field; we use lcrecords */
- Bytecount sizem = FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Vector, Lisp_Object,
- contents, sizei);
- Lisp_Object obj = ALLOC_SIZED_LISP_OBJECT (sizem, vector);
- Lisp_Vector *p = XVECTOR (obj);
-
+ EMACS_UINT sizeui = sizei;
+ EMACS_UINT sizem = FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Vector, Lisp_Object,
+ contents, sizeui);
+ Lisp_Object obj;
+ Lisp_Vector *p;
+
+ structure_checking_assert (sizem >= sizeui);
+
+ obj = ALLOC_SIZED_LISP_OBJECT (sizem, vector);
+ p = XVECTOR (obj);
p->size = sizei;
return obj;
}
@@ -1891,7 +1897,10 @@
*/
(length, object))
{
- check_integer_range (length, Qzero, make_fixnum (ARRAY_DIMENSION_LIMIT));
+ check_integer_range (length, Qzero,
+ /* array-dimension-limit is an exclusive upper bound,
+ check_integer_range() does <=, adjust for this. */
+ make_fixnum (ARRAY_DIMENSION_LIMIT - 1));
return make_vector (XFIXNUM (length), object);
}
@@ -1903,7 +1912,12 @@
*/
(int nargs, Lisp_Object *args))
{
- Lisp_Object result = make_uninit_vector (nargs);
+ Lisp_Object result;
+ check_integer_range (make_fixnum (nargs), Qzero,
+ /* array-dimension-limit is an exclusive upper bound,
+ check_integer_range() does <=, adjust for this. */
+ make_fixnum (ARRAY_DIMENSION_LIMIT - 1));
+ result = make_uninit_vector (nargs);
memcpy (XVECTOR_DATA (result), args, sizeof (Lisp_Object) * nargs);
return result;
}
@@ -2135,6 +2149,9 @@
Bytecount sizem = FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Bit_Vector,
unsigned long,
bits, num_longs);
+ /* No need to do the overflow checks we do for vectors and strings, for
+ large values of SIZEI the number of longs is always going to be less than
+ SIZEI, the number of bits. */
Lisp_Object obj = ALLOC_SIZED_LISP_OBJECT (sizem, bit_vector);
Lisp_Bit_Vector *p = XBIT_VECTOR (obj);
@@ -2169,7 +2186,12 @@
make_bit_vector_from_byte_vector (unsigned char *bytevec, Elemcount length)
{
Elemcount i;
- Lisp_Bit_Vector *p = make_bit_vector_internal (length);
+ Lisp_Bit_Vector *p;
+
+ check_integer_range (make_integer (length), Qzero,
+ make_fixnum (BIT_VECTOR_TOTAL_SIZE_LIMIT - 1));
+
+ p = make_bit_vector_internal (length);
for (i = 0; i < length; i++)
set_bit_vector_bit (p, i, bytevec[i]);
@@ -2194,7 +2216,9 @@
*/
(length, bit))
{
- check_integer_range (length, Qzero, make_fixnum (ARRAY_DIMENSION_LIMIT));
+ check_integer_range (length, Qzero,
+ make_fixnum (BIT_VECTOR_TOTAL_SIZE_LIMIT - 1));
+ CHECK_BIT (bit);
return make_bit_vector (XFIXNUM (length), bit);
}
@@ -2208,7 +2232,11 @@
(int nargs, Lisp_Object *args))
{
int i;
- Lisp_Bit_Vector *p = make_bit_vector_internal (nargs);
+ Lisp_Bit_Vector *p;
+
+ check_integer_range (make_fixnum (nargs), Qzero,
+ make_fixnum (BIT_VECTOR_TOTAL_SIZE_LIMIT - 1));
+ p = make_bit_vector_internal (nargs);
for (i = 0; i < nargs; i++)
{
@@ -2944,10 +2972,11 @@
Lisp_Object
make_uninit_string (Bytecount length)
{
+ EMACS_UINT ulength = length, fullsize = STRING_FULLSIZE (ulength);
Lisp_String *s;
- Bytecount fullsize = STRING_FULLSIZE (length);
-
- assert (length >= 0 && fullsize > 0);
+
+ structure_checking_assert (length >= 0 && fullsize >= ulength
+ && ((Bytecount) fullsize) >= 0);
#ifdef NEW_GC
s = XSTRING (ALLOC_NORMAL_LISP_OBJECT (string));
@@ -3228,43 +3257,90 @@
DEFUN ("make-string", Fmake_string, 2, 2, 0, /*
Return a new string consisting of LENGTH copies of CHARACTER.
LENGTH must be a non-negative integer.
+See the variable `string-total-size-limit' for restrictions on LENGTH.
*/
(length, character))
{
- check_integer_range (length, Qzero, make_fixnum (ARRAY_DIMENSION_LIMIT));
+ Ibyte init_str[MAX_ICHAR_LEN];
+ Bytecount onelen;
+ Lisp_Object val;
+
CHECK_CHAR_COERCE_INT (character);
- {
- Ibyte init_str[MAX_ICHAR_LEN];
- int len = set_itext_ichar (init_str, XCHAR (character));
- Lisp_Object val = make_uninit_string (len * XFIXNUM (length));
-
- if (len == 1)
- {
- /* Optimize the single-byte case */
- memset (XSTRING_DATA (val), XCHAR (character), XSTRING_LENGTH (val));
- XSET_STRING_ASCII_BEGIN (val, min (MAX_STRING_ASCII_BEGIN,
- len * XFIXNUM (length)));
- }
- else
- {
- EMACS_INT i;
- Ibyte *ptr = XSTRING_DATA (val);
-
- for (i = XFIXNUM (length); i; i--)
- {
- Ibyte *init_ptr = init_str;
- switch (len)
- {
- case 4: *ptr++ = *init_ptr++;
- case 3: *ptr++ = *init_ptr++;
- case 2: *ptr++ = *init_ptr++;
- case 1: *ptr++ = *init_ptr++;
- }
- }
- }
- sledgehammer_check_ascii_begin (val);
- return val;
- }
+ onelen = set_itext_ichar (init_str, XCHAR (character));
+
+ if (onelen == 1)
+ {
+ /* Optimize the single-byte case */
+ check_integer_range (length, Qzero,
+ /* Exclusive upper bound, but check_integer_range()
+ is inclusive. */
+ make_fixnum (STRING_BYTE_TOTAL_SIZE_LIMIT - 1));
+
+ val = make_uninit_string (XFIXNUM (length));
+ memset (XSTRING_DATA (val), XCHAR (character), XSTRING_LENGTH (val));
+ XSET_STRING_ASCII_BEGIN (val, min (MAX_STRING_ASCII_BEGIN,
+ XSTRING_LENGTH (val)));
+ }
+ else if (FIXNUMP (length) && XREALFIXNUM (length) >= 0)
+ {
+ EMACS_UINT clen = XREALFIXNUM (length);
+ EMACS_UINT oproduct = clen, product = clen, fsize;
+ EMACS_INT i;
+ Ibyte *ptr;
+
+ for (i = onelen, --i; i; i--)
+ {
+ product += clen;
+ if (product < oproduct)
+ {
+ /* We're adding, not multiplying, because it's far harder to
+ detect overflow when you multiply MOST_POSITIVE_FIXNUM by six
+ on 32-bit platforms; you get a number greater than
+ MOST_POSITIVE_FIXNUM that is still less than the number you
+ want. */
+ goto range_issue;
+ }
+ oproduct = product;
+ }
+
+ if ((fsize = STRING_FULLSIZE (product)) < oproduct
+ || ((Bytecount) fsize < 0))
+ {
+ goto range_issue;
+ }
+
+ val = make_uninit_string ((Bytecount) product);
+ ptr = XSTRING_DATA (val);
+
+ for (i = clen; i; i--)
+ {
+ Ibyte *init_ptr = init_str;
+ switch (onelen)
+ {
+#if MAX_ICHAR_LEN > 6
+#error "unimplemented"
+#elif MAX_ICHAR_LEN > 4
+ case 6: *ptr++ = *init_ptr++;
+ case 5: *ptr++ = *init_ptr++;
+#endif
+ case 4: *ptr++ = *init_ptr++;
+ case 3: *ptr++ = *init_ptr++;
+ case 2: *ptr++ = *init_ptr++;
+ case 1: *ptr++ = *init_ptr++;
+ }
+ }
+ }
+ else
+ {
+ range_issue:
+ check_integer_range (length, Qzero,
+ make_fixnum ((STRING_BYTE_TOTAL_SIZE_LIMIT - 1) /
+ onelen));
+ return Qnil;
+ }
+
+ sledgehammer_check_ascii_begin (val);
+ return val;
}
DEFUN ("string", Fstring, 0, MANY, 0, /*
@@ -3274,8 +3350,15 @@
*/
(int nargs, Lisp_Object *args))
{
- Ibyte *storage = alloca_ibytes (nargs * MAX_ICHAR_LEN);
- Ibyte *p = storage;
+ Ibyte *storage, *p;
+
+ /* No need to work too hard at this overflow check, it will be very rare
+ that NARGS will be greater than #x10000. */
+ check_integer_range (make_fixnum (nargs), Qzero,
+ make_fixnum ((STRING_BYTE_TOTAL_SIZE_LIMIT - 1) /
+ MAX_ICHAR_LEN));
+
+ storage = p = alloca_ibytes (nargs * MAX_ICHAR_LEN);
for (; nargs; nargs--, args++)
{
@@ -6159,11 +6242,36 @@
and multi-dimensional arrays need to be implemented by the user with arrays
of arrays.
-Note that XEmacs may not have enough memory available to create an array
-with this dimension.
+This limit is a result of the bit widths used in the implementation of the
+`vector' type. Note that XEmacs may not have enough memory available to create
+an array with this number of elements.
*/);
Varray_total_size_limit = ARRAY_DIMENSION_LIMIT;
+ DEFVAR_CONST_INT ("string-total-size-limit", &Vstring_total_size_limit /*
+The exclusive upper bound on a string's length.
+
+This is usually significantly more than `array-total-size-limit'.
+Exclusively-ASCII strings can approach this limit in terms of their character
+count, but strings with significant non-ASCII content are more restricted,
+since each non-ASCII character takes more byte space than does an ASCII
+character.
+
+This limit is a result of the range limitations on arguments to `aref' and
+`aset', and the amount of memory available to XEmacs is a separate question.
+*/);
+ Vstring_total_size_limit = STRING_BYTE_TOTAL_SIZE_LIMIT;
+
+ DEFVAR_CONST_INT ("bit-vector-total-size-limit",
+ &Vbit_vector_total_size_limit /*
+The exclusive upper bound on a bit vector's length.
+
+This limit is a result of the range limitations on arguments to `aref' and
+`aset'. As with any operation that allocates memory, it is possible for
+`make-bit-vector' to fail if there is insufficient memory available to XEmacs.
+*/);
+ Vbit_vector_total_size_limit = BIT_VECTOR_TOTAL_SIZE_LIMIT;
+
#ifdef DEBUG_XEMACS
DEFVAR_INT ("debug-allocation", &debug_allocation /*
If non-zero, print out information to stderr about all objects allocated.
diff -r dfe676a17ebadf7f07b8b5afb67f38e30fc65400 -r 0d158ce025013acbf1023cfb86be2fde9c495a84 src/event-stream.c
--- a/src/event-stream.c
+++ b/src/event-stream.c
@@ -3801,7 +3801,10 @@
else
{
check_integer_range (number, Qzero,
- make_fixnum (ARRAY_DIMENSION_LIMIT));
+ /* array-dimension-limit is an exclusive upper
+ bound, check_integer_range() does <=, adjust for
+ this. */
+ make_fixnum (ARRAY_DIMENSION_LIMIT - 1));
nwanted = XFIXNUM (number);
}
diff -r dfe676a17ebadf7f07b8b5afb67f38e30fc65400 -r 0d158ce025013acbf1023cfb86be2fde9c495a84 src/lisp.h
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2851,7 +2851,7 @@
struct Lisp_Vector
{
NORMAL_LISP_OBJECT_HEADER header;
- long size;
+ Elemcount size;
Lisp_Object contents[1];
};
typedef struct Lisp_Vector Lisp_Vector;
@@ -4412,8 +4412,26 @@
void disksave_object_finalization (void);
void finish_object_memory_usage_stats (void);
extern int purify_flag;
-#define ARRAY_DIMENSION_LIMIT MOST_POSITIVE_FIXNUM
-extern Fixnum Varray_dimension_limit;
+
+/* ALLOC_SIZED_LISP_OBJECT() takes a signed Bytecount, and so the limitation
+ on the size of a vector is that number that would cause a signed Bytecount
+ to overflow, when plugged into FLEXIBLE_ARRAY_STRUCT_SIZEOF(). */
+#define ARRAY_DIMENSION_LIMIT ((MOST_POSITIVE_FIXNUM / sizeof (Lisp_Object)) \
+ - (offsetof (Lisp_Vector, contents) \
+ / sizeof (Lisp_Object)) + 1)
+
+/* String lengths are less restrictive, since there's no multiplication needed
+ in the calculation of the Bytecount. This is an exclusive bound. */
+#define STRING_BYTE_TOTAL_SIZE_LIMIT (MOST_POSITIVE_FIXNUM + 1)
+
+/* This could be even less restrictive than its string counterpart. We would
+ need to allow bignum string indices for that, which we currently reject in
+ #'aset, #'aref. */
+#define BIT_VECTOR_TOTAL_SIZE_LIMIT (MOST_POSITIVE_FIXNUM + 1)
+
+extern Fixnum Varray_dimension_limit, Vstring_total_size_limit;
+extern Fixnum Vfixnum_total_size_limit;
+
#ifndef NEW_GC
extern EMACS_INT gc_generation_number[1];
#endif /* not NEW_GC */
diff -r dfe676a17ebadf7f07b8b5afb67f38e30fc65400 -r 0d158ce025013acbf1023cfb86be2fde9c495a84 src/sequence.c
--- a/src/sequence.c
+++ b/src/sequence.c
@@ -4836,7 +4836,8 @@
Lisp_Object result_type, Boolint reuse_last_listp)
{
Lisp_Object *lisp_staging = NULL, *lisp_cursor = NULL, result = Qnil;
- Elemcount ii, jj, staging_len = 0;
+ Elemcount ii, jj;
+ EMACS_UINT staging_len = 0, olen = 0;
struct gcpro gcpro1, gcpro2;
/* We can GC in #'coerce, and in copy_string_extents(). Our callers don't
@@ -4852,7 +4853,7 @@
#'byte-length)), no need for character lengths or INC_IBYTEPTR. */
if (EQ (result_type, Qstring))
{
- Bytecount bstaging_len = 0;
+ EMACS_UINT bstaging_len = 0;
Ibyte *bstaging = NULL, *cursor = NULL;
struct merge_string_extents_struct *args_mse
= alloca_array (struct merge_string_extents_struct, nsequences);
@@ -4860,6 +4861,7 @@
for (ii = 0; ii < nsequences; ++ii)
{
+ olen = bstaging_len;
if (STRINGP (sequences[ii]))
{
bstaging_len += XSTRING_LENGTH (sequences[ii]);
@@ -4873,6 +4875,16 @@
bstaging_len
+= (XFIXNUM (Flength (sequences[ii]))) * MAX_ICHAR_LEN;
}
+
+ if (bstaging_len >= STRING_BYTE_TOTAL_SIZE_LIMIT
+ || bstaging_len < olen)
+ {
+ invalid_argument_2 ("concatenate: length overflow",
+ result_type,
+ /* Don't pass SEQUENCES[II] to the error
+ handling, we don't want it printed */
+ make_unsigned_integer (bstaging_len));
+ }
}
result = make_uninit_string (bstaging_len);
@@ -4934,11 +4946,13 @@
}
}
- if ((cursor - bstaging) != bstaging_len)
+ assert (cursor >= bstaging);
+
+ if ((EMACS_UINT) (cursor - bstaging) != bstaging_len)
{
Bytecount used_len = cursor - bstaging;
- text_checking_assert (used_len < bstaging_len);
+ text_checking_assert ((EMACS_UINT) used_len < bstaging_len);
/* No-one else has a pointer to RESULT, and calling resize_string()
gives crashes in temacs, its implementation isn't thoroughly
@@ -5030,6 +5044,7 @@
for (ii = 0; ii < nsequences; ++ii)
{
+ olen = staging_len;
if (STRINGP (sequences[ii]))
{
/* No need to actually get the char length, since the byte length
@@ -5044,6 +5059,15 @@
type and circularity, well-formedness. */
staging_len += (XFIXNUM (Flength (sequences[ii])));
}
+
+ if (staging_len >= ARRAY_DIMENSION_LIMIT || staging_len < olen)
+ {
+ invalid_argument_2 ("concatenate: length overflow",
+ result_type,
+ /* Don't pass SEQUENCES[II] to the error
+ handling, we don't want it printed */
+ make_unsigned_integer (staging_len));
+ }
}
if (EQ (result_type, Qvector) || EQ (result_type, Qarray))
diff -r dfe676a17ebadf7f07b8b5afb67f38e30fc65400 -r 0d158ce025013acbf1023cfb86be2fde9c495a84 tests/ChangeLog
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,10 @@
+2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * automated/lisp-tests.el:
+ Basic checks that array-total-size-limit,
+ bit-vector-total-size-limit, string-total-size-limit are
+ respected.
+
2017-05-11 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/os-tests.el:
diff -r dfe676a17ebadf7f07b8b5afb67f38e30fc65400 -r 0d158ce025013acbf1023cfb86be2fde9c495a84 tests/automated/lisp-tests.el
--- a/tests/automated/lisp-tests.el
+++ b/tests/automated/lisp-tests.el
@@ -1184,6 +1184,8 @@
(Assert (not (equal [1 2 3 4] [1 2 3])))
(Assert (equal (vector 1 2 3) [1 2 3]))
(Assert (equal (make-vector 3 1) [1 1 1]))
+(Check-Error args-out-of-range (make-vector array-total-size-limit ?a))
+(Check-Error args-out-of-range (make-vector -1 ?a))
;;-----------------------------------------------------
;; Test bit-vector functions
@@ -1198,6 +1200,24 @@
(Assert (equal (bit-vector 0 1 0) #*010))
(Assert (equal (make-bit-vector 3 1) #*111))
(Assert (equal (make-bit-vector 3 0) #*000))
+(Check-Error args-out-of-range (make-bit-vector bit-vector-total-size-limit 1))
+(Check-Error args-out-of-range (make-bit-vector -1 1))
+(Check-Error wrong-type-argument (make-bit-vector most-positive-fixnum -1))
+
+;;-----------------------------------------------------
+;; Test string functions
+;;-----------------------------------------------------
+(Assert (equal "abc" "abc"))
+(Assert (equal "" ""))
+(Assert (not (equal "abc" "")))
+(Assert (not (equal "abc" "abd")))
+(Assert (not (equal "abc" "bcd")))
+(Assert (equal (string ?a ?b ?c) "abc"))
+(Assert (equal (string 1 2 3) "\x01\x02\x03"))
+(Assert (equal (make-string 3 ?a) "aaa"))
+(Assert (equal (make-string 3 0) "\0\0\0"))
+(Check-Error args-out-of-range (make-string string-total-size-limit ?a))
+(Check-Error args-out-of-range (make-string -1 ?a))
;;-----------------------------------------------------
;; Test buffer-local variables used as (ugh!) function parameters
https://bitbucket.org/xemacs/xemacs/commits/8ac369598a2e/
Changeset: 8ac369598a2e
User: kehoea
Date: 2017-09-24 15:04:49+00:00
Summary: Silence compiler warnings, fix some bugs elicited by same, src/, lib-src/
src/ChangeLog addition:
2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
* chartab.c (chartab_data_validate):
Silence an unused-variable compiler warning here.
* doprnt.c (bignum_to_string_1):
Fix a bug in this function, thank you clang++4.0.
* gc.c (KKCC_DO_CHECK_FREE):
Avoid an unused-variable warning when not ERROR_CHECK_GC.
* gccache-x.c (describe_gc_cache):
Fix a bug in this function, thank you clang++4.0.
* mule-charset.c (validate_charset_offset_or_size):
Be a bit more idiomatic in getting an external list length, and
silence a compiler warning while doing so.
* redisplay.c (create_text_block):
* redisplay.c (create_string_text_block):
Fix the same bug in these two functions, thank you clang++4.0.
* regex.c (re_compile_fastmap):
* regex.c (re_search_2):
* regex.c (re_match_2_internal):
Silence compiler warnings in this file, both when #define EMACS
and when not.
* text.c (copy_buffer_text_out):
Silence compiler warning here, add an assert to ensure the
approach is OK.
* unicode.c (free_precedence_array):
* unicode.c (recalculate_unicode_precedence):
Silence unused variable warnings in these two functions.
lib-src/ChangeLog addition:
2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
* b2m.c (main):
* etags.c:
* etags.c (just_read_file):
* movemail.c (main):
* ootags.c (just_read_file):
Silence a few compiler warnings in these files.
Affected #: 15 files
diff -r 0d158ce025013acbf1023cfb86be2fde9c495a84 -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 lib-src/ChangeLog
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,12 @@
+2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * b2m.c (main):
+ * etags.c:
+ * etags.c (just_read_file):
+ * movemail.c (main):
+ * ootags.c (just_read_file):
+ Silence a few compiler warnings in these files.
+
2017-03-15 Aidan Kehoe <kehoea(a)parhasard.net>
* make-docfile.c (scan_lisp_file):
diff -r 0d158ce025013acbf1023cfb86be2fde9c495a84 -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 lib-src/b2m.c
--- a/lib-src/b2m.c
+++ b/lib-src/b2m.c
@@ -95,7 +95,7 @@
logical labels_saved, printing, header, first, last_was_blank_line;
time_t ltoday;
struct tm *tm;
- char *labels, *p, *today;
+ char *labels = NULL, *p, *today;
struct linebuffer data;
#ifdef MSDOS
diff -r 0d158ce025013acbf1023cfb86be2fde9c495a84 -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 lib-src/etags.c
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -4172,6 +4172,8 @@
LOOP_ON_INPUT_LINES (inf, lb, dummy)
continue;
+
+ (void) (dummy); /* Silence compiler warning. */
}
diff -r 0d158ce025013acbf1023cfb86be2fde9c495a84 -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 lib-src/movemail.c
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -338,6 +338,8 @@
#ifndef WIN32_NATIVE
setuid (getuid ());
#endif
+#else /* MAIL_USE_POP */
+ (void) (poppass); /* Silence compiler warning. */
#endif /* MAIL_USE_POP */
#ifndef DISABLE_DIRECT_ACCESS
diff -r 0d158ce025013acbf1023cfb86be2fde9c495a84 -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 lib-src/ootags.c
--- a/lib-src/ootags.c
+++ b/lib-src/ootags.c
@@ -3465,6 +3465,8 @@
LOOP_ON_INPUT_LINES (inf, lb, dummy)
continue;
+
+ (void)(dummy); /* Silence compiler warning. */
}
/* Fortran parsing */
diff -r 0d158ce025013acbf1023cfb86be2fde9c495a84 -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,31 @@
+2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * chartab.c (chartab_data_validate):
+ Silence an unused-variable compiler warning here.
+ * doprnt.c (bignum_to_string_1):
+ Fix a bug in this function, thank you clang++4.0.
+ * gc.c (KKCC_DO_CHECK_FREE):
+ Avoid an unused-variable warning when not ERROR_CHECK_GC.
+ * gccache-x.c (describe_gc_cache):
+ Fix a bug in this function, thank you clang++4.0.
+ * mule-charset.c (validate_charset_offset_or_size):
+ Be a bit more idiomatic in getting an external list length, and
+ silence a compiler warning while doing so.
+ * redisplay.c (create_text_block):
+ * redisplay.c (create_string_text_block):
+ Fix the same bug in these two functions, thank you clang++4.0.
+ * regex.c (re_compile_fastmap):
+ * regex.c (re_search_2):
+ * regex.c (re_match_2_internal):
+ Silence compiler warnings in this file, both when #define EMACS
+ and when not.
+ * text.c (copy_buffer_text_out):
+ Silence compiler warning here, add an assert to ensure the
+ approach is OK.
+ * unicode.c (free_precedence_array):
+ * unicode.c (recalculate_unicode_precedence):
+ Silence unused variable warnings in these two functions.
+
2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
Error when passed values that would overflow, #'make-vector,
diff -r 0d158ce025013acbf1023cfb86be2fde9c495a84 -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 src/chartab.c
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -1960,6 +1960,7 @@
else if (CHARP (range))
continue;
sferror ("Invalid range format", range);
+ USED (data);
}
return 1;
diff -r 0d158ce025013acbf1023cfb86be2fde9c495a84 -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 src/doprnt.c
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -364,10 +364,10 @@
bignum_to_string_1 (Ibyte **buf, Bytecount *size_inout, bignum bn,
EMACS_UINT radix, Lisp_Object table)
{
- Boolint minusp, heap_allocp = size_inout < 0;
- Ibyte *buf1 = *size_inout > -1 ? *buf :
+ Boolint minusp, heap_allocp = (*buf == NULL);
+ Ibyte *buf1 = heap_allocp ?
((*size_inout = 128 * MAX_ICHAR_LEN),
- (*buf = xnew_array (Ibyte, *size_inout)));
+ (*buf = xnew_array (Ibyte, *size_inout))) : *buf;
Ibyte *end = buf1 + *size_inout, *cursor = end, *this_digit = NULL;
Ibyte *ftmdata = XSTRING_DATA (table);
/* Since, in contrast with the fixnum code, we are repeatedly checking the
diff -r 0d158ce025013acbf1023cfb86be2fde9c495a84 -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 src/gc.c
--- a/src/gc.c
+++ b/src/gc.c
@@ -1358,7 +1358,7 @@
} \
} while (0)
#else
-#define KKCC_DO_CHECK_FREE(obj, allow_free) DO_NOTHING
+#define KKCC_DO_CHECK_FREE(obj, allow_free) (USED (allow_free))
#endif
static inline void
diff -r 0d158ce025013acbf1023cfb86be2fde9c495a84 -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 src/gccache-x.c
--- a/src/gccache-x.c
+++ b/src/gccache-x.c
@@ -294,7 +294,7 @@
int count = 0;
struct gc_cache_cell *cell = cache->head;
- if (! flags & DGCCFLAG_SUMMARY) return;
+ if (!(flags & DGCCFLAG_SUMMARY)) return;
stderr_out ("\nsize: %d", cache->size);
stderr_out ("\ncreated: %d", cache->create_count);
diff -r 0d158ce025013acbf1023cfb86be2fde9c495a84 -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 src/mule-charset.c
--- a/src/mule-charset.c
+++ b/src/mule-charset.c
@@ -589,12 +589,11 @@
}
else
{
- int len = 0;
+ Elemcount len = 0;
Lisp_Object tem;
- {
- EXTERNAL_LIST_LOOP_1 (value)
- len++;
- }
+
+ GET_EXTERNAL_LIST_LENGTH (value, len);
+
if (len < 1 || len > 2)
invalid_constant_2
("Invalid value for property (list of 1 or 2 integers)",
diff -r 0d158ce025013acbf1023cfb86be2fde9c495a84 -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 src/redisplay.c
--- a/src/redisplay.c
+++ b/src/redisplay.c
@@ -2933,7 +2933,7 @@
if (!(rb->type == RUNE_CHAR && rb->object.chr.ch < 0x100
&& isspace (rb->object.chr.ch))
- && !rb->type == RUNE_BLANK)
+ && rb->type != RUNE_BLANK)
{
dl->bounds.right_white = rb->xpos + rb->width;
done = 1;
@@ -5185,7 +5185,7 @@
if (!(rb->type == RUNE_CHAR && rb->object.chr.ch < 0x100
&& isspace (rb->object.chr.ch))
- && !rb->type == RUNE_BLANK)
+ && rb->type != RUNE_BLANK)
{
dl->bounds.right_white = rb->xpos + rb->width;
done = 1;
diff -r 0d158ce025013acbf1023cfb86be2fde9c495a84 -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 src/regex.c
--- a/src/regex.c
+++ b/src/regex.c
@@ -4368,7 +4368,6 @@
case charset_mule:
{
int nentries;
- int i;
Bitbyte flags = *p++;
if (flags)
@@ -4957,9 +4956,7 @@
int depth;
#endif
#endif /* emacs */
-#if 1
int forward_search_p;
-#endif
/* Check for out-of-range STARTPOS. */
if (startpos < 0 || startpos > total_size)
@@ -4972,9 +4969,10 @@
else if (endpos > total_size)
range = total_size - startpos;
-#if 1
forward_search_p = range > 0;
-#endif
+
+ (void) (forward_search_p); /* This is only used with assertions, silence the
+ compiler warning when they're turned off. */
/* If the search isn't to be a backwards one, don't waste time in a
search for a pattern that must be anchored. */
@@ -5104,9 +5102,7 @@
INC_IBYTEPTR_FMT (d, fmt);
range -= d - orig_d;
startpos += d - orig_d;
-#if 1
assert (!forward_search_p || range >= 0);
-#endif
}
else if (range < 0)
{
@@ -5175,9 +5171,7 @@
#endif /* MULE */
INC_IBYTEPTR_FMT (d, fmt);
range -= (d - old_d);
-#if 1
assert (!forward_search_p || range >= 0);
-#endif
}
}
#ifdef MULE
@@ -5193,9 +5187,7 @@
break;
INC_IBYTEPTR_FMT (d, fmt);
range -= (d - old_d);
-#if 1
assert (!forward_search_p || range >= 0);
-#endif
}
}
#endif /* MULE */
@@ -5206,9 +5198,7 @@
re_char *old_d = d;
INC_IBYTEPTR (d);
range -= (d - old_d);
-#if 1
- assert (!forward_search_p || range >= 0);
-#endif
+ assert (!forward_search_p || range >= 0);
}
}
@@ -5288,9 +5278,7 @@
(startpos >= size1 ? string2 - size1 : string1) + startpos);
d_size = itext_ichar_len_fmt (d, fmt);
range -= d_size;
-#if 1
- assert (!forward_search_p || range >= 0);
-#endif
+ assert (!forward_search_p || range >= 0);
startpos += d_size;
}
else
@@ -5303,9 +5291,7 @@
DEC_IBYTEPTR_FMT (d, fmt);
d_size = itext_ichar_len_fmt (d, fmt);
range += d_size;
-#if 1
- assert (!forward_search_p || range >= 0);
-#endif
+ assert (!forward_search_p || range >= 0);
startpos -= d_size;
}
}
@@ -6677,6 +6663,7 @@
POP_FAILURE_POINT (sdummy, pdummy,
dummy_low_reg, dummy_high_reg,
reg_dummy, reg_dummy, reg_info_dummy);
+ USED (pdummy);
}
/* Note fall through. */
diff -r 0d158ce025013acbf1023cfb86be2fde9c495a84 -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 src/text.c
--- a/src/text.c
+++ b/src/text.c
@@ -2437,7 +2437,7 @@
{
BUFFER_TEXT_LOOP (buf, pos, len, runptr, runlen)
{
- Bytecount the_src_used, the_dst_used;
+ Bytecount the_src_used = -1, the_dst_used;
the_dst_used = copy_text_between_formats (runptr, runlen,
BUF_FORMAT (buf),
@@ -2446,7 +2446,10 @@
dstobj, &the_src_used);
dst_used += the_dst_used;
if (src_used)
- *src_used += the_src_used;
+ {
+ text_checking_assert (the_src_used >= 0);
+ *src_used += the_src_used;
+ }
if (dst)
{
dst += the_dst_used;
diff -r 0d158ce025013acbf1023cfb86be2fde9c495a84 -r 8ac369598a2ef9ce4785ffa64fc8945cce945ca5 src/unicode.c
--- a/src/unicode.c
+++ b/src/unicode.c
@@ -1771,8 +1771,9 @@
/* We shouldn't be trying to free any precarray that's attached to a
buffer */
{
- ALIST_LOOP_3 (name, buf, Vbuffer_alist)
- assert (!EQ (precarray, XBUFFER (buf)->unicode_precedence_array));
+ LIST_LOOP_2 (elt, Vbuffer_alist)
+ assert (!EQ (precarray,
+ XBUFFER (XCDR (elt))->unicode_precedence_array));
}
assert (!EQ (precarray, Vdefault_unicode_precedence_array));
#endif /* ERROR_CHECK_TEXT */
@@ -1962,9 +1963,9 @@
recalculate_unicode_precedence_1 (Vdefault_unicode_precedence_list,
flags | RUP_MAKE_FULL_P);
{
- ALIST_LOOP_3 (name, buffer, Vbuffer_alist)
+ LIST_LOOP_2 (elt, Vbuffer_alist)
{
- struct buffer *buf = XBUFFER (buffer);
+ struct buffer *buf = XBUFFER (XCDR (elt));
buf->unicode_precedence_array =
recalculate_unicode_precedence_1 (buf->unicode_precedence_list,
flags);
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: kehoea: Return a Bytecount, read_process_output(),
no need for bytecount_to_charcount()
7 years, 3 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/d3e0eec3a508/
Changeset: d3e0eec3a508
User: kehoea
Date: 2017-09-23 10:18:46+00:00
Summary: Return a Bytecount, read_process_output(), no need for bytecount_to_charcount()
src/ChangeLog addition:
2017-09-23 Aidan Kehoe <kehoea(a)parhasard.net>
* process.c (read_process_output): Have this return a Bytecount,
not a Charcount; the precise number of characters wasn't used by
our callers, so we were usually calling bytecount_to_charcount()
for no reason.
* process.h: Update the declaration of this function.
Affected #: 3 files
diff -r 8dea4d0549ac0a49456d01bba96171399456c227 -r d3e0eec3a5082a28cdff11a9e5629b076abd4a17 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2017-09-23 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * process.c (read_process_output): Have this return a Bytecount,
+ not a Charcount; the precise number of characters wasn't used by
+ our callers, so we were usually calling bytecount_to_charcount()
+ for no reason.
+ * process.h: Update the declaration of this function.
+
2017-06-28 Aidan Kehoe <kehoea(a)parhasard.net>
* text.c (Fchar_width):
diff -r 8dea4d0549ac0a49456d01bba96171399456c227 -r d3e0eec3a5082a28cdff11a9e5629b076abd4a17 src/process.c
--- a/src/process.c
+++ b/src/process.c
@@ -1079,17 +1079,16 @@
/* Read pending output from the process channel,
starting with our buffered-ahead character if we have one.
- Yield number of characters read.
+ Yield number of bytes read.
This function reads at most 1024 bytes.
If you want to read all available subprocess output,
you must call it repeatedly until it returns zero. */
-
-Charcount
+Bytecount
read_process_output (Lisp_Object process, int read_stderr)
{
/* This function can GC */
- Bytecount nbytes, nchars;
+ Bytecount nbytes;
Ibyte chars[1025];
Lisp_Object outstream;
Lisp_Process *p = XPROCESS (process);
@@ -1139,16 +1138,16 @@
/* !!#### if the coding system changed as a result of reading, we
need to change the output coding system accordingly. */
- nchars = bytecount_to_charcount (chars, nbytes);
outstream = filter;
if (!NILP (outstream))
{
/* Some FSF junk with running_asynch_code, to preserve the match
data. Not necessary because we don't call process filters
asynchronously (i.e. from within QUIT). */
- /* Don't catch errors here; we're not in any critical code. */
+ /* Don't catch errors here; we're not in any critical code. call2() will
+ GCPRO() the string argument. */
call2 (outstream, process, make_string (chars, nbytes));
- return nchars;
+ return nbytes;
}
/* If no filter, write into buffer if it isn't dead. */
@@ -1177,7 +1176,8 @@
unbind_to (spec);
UNGCPRO;
}
- return nchars;
+
+ return nbytes;
}
int
diff -r 8dea4d0549ac0a49456d01bba96171399456c227 -r d3e0eec3a5082a28cdff11a9e5629b076abd4a17 src/process.h
--- a/src/process.h
+++ b/src/process.h
@@ -99,7 +99,7 @@
void status_notify (void);
void kick_status_notify (void);
void deactivate_process (Lisp_Object proc);
-Charcount read_process_output (Lisp_Object proc, int read_stderr);
+Bytecount read_process_output (Lisp_Object proc, int read_stderr);
int process_has_separate_stderr (Lisp_Object proc);
const char *signal_name (int signum);
Lisp_Object canonicalize_host_name (Lisp_Object host);
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/cc-mode: acm: Fix irregularities with CC Mode fontification,
particularly with "known types"
7 years, 3 months
Bitbucket
1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/commits/31e4abcac399/
Changeset: 31e4abcac399
User: acm
Date: 2017-09-18 08:31:38+00:00
Summary: Fix irregularities with CC Mode fontification, particularly with "known types"
* cc-fonts.el (c-font-lock-declarators): Introduce a new optional parameter,
template-class. In "class <X = Y>", fontify "Y" as a type.
(c-font-lock-single-decl): New variable template-class, set to non-nil when we
have a construct like the above. Pass this as argument to
c-font-lock-declarators.
(c-font-lock-cut-off-declarators): Check more rigorously that a declaration
being processed starts before the function's starting position.
(c-complex-decl-matchers): Remove the redundant clause which fontified "types
preceded by, e.g., "struct"".
* cc-langs.el (c-template-typename-kwds, c-template-typename-key): New lang
defconsts and defvar.
Affected #: 2 files
diff -r a8a9fbb96c60e0d68e7aee22ffaaee192a1fc966 -r 31e4abcac39929366dbd6be1d224351064226973 cc-fonts.el
--- a/cc-fonts.el
+++ b/cc-fonts.el
@@ -1026,7 +1026,8 @@
(goto-char pos)))))
nil)
-(defun c-font-lock-declarators (limit list types not-top)
+(defun c-font-lock-declarators (limit list types not-top
+ &optional template-class)
;; Assuming the point is at the start of a declarator in a declaration,
;; fontify the identifier it declares. (If TYPES is set, it does this via
;; the macro `c-fontify-types-and-refs'.)
@@ -1040,6 +1041,11 @@
;; non-nil, we are not at the top-level ("top-level" includes being directly
;; inside a class or namespace, etc.).
;;
+ ;; TEMPLATE-CLASS is non-nil when the declaration is in template delimiters
+ ;; and was introduced by, e.g. "typename" or "class", such that if there is
+ ;; a default (introduced by "="), it will be fontified as a type.
+ ;; E.g. "<class X = Y>".
+ ;;
;; Nil is always returned. The function leaves point at the delimiter after
;; the last declarator it processes.
;;
@@ -1112,6 +1118,13 @@
(goto-char next-pos)
(setq pos nil) ; So as to terminate the enclosing `while' form.
+ (if (and template-class
+ (eq got-init ?=) ; C++ "<class X = Y>"?
+ (c-forward-token-2 1 nil limit) ; Over "="
+ (let ((c-promote-possible-types t))
+ (c-forward-type t))) ; Over "Y"
+ (setq list nil)) ; Shouldn't be needed. We can't have a list, here.
+
(when list
;; Jump past any initializer or function prototype to see if
;; there's a ',' to continue at.
@@ -1340,8 +1353,12 @@
(c-backward-syntactic-ws)
(and (c-simple-skip-symbol-backward)
(looking-at c-paren-stmt-key))))
- t)))
-
+ t))
+ (template-class (and (eq context '<>)
+ (save-excursion
+ (goto-char match-pos)
+ (c-forward-syntactic-ws)
+ (looking-at c-template-typename-key)))))
;; Fix the `c-decl-id-start' or `c-decl-type-start' property
;; before the first declarator if it's a list.
;; `c-font-lock-declarators' handles the rest.
@@ -1353,10 +1370,9 @@
(if (cadr decl-or-cast)
'c-decl-type-start
'c-decl-id-start)))))
-
(c-font-lock-declarators
(min limit (point-max)) decl-list
- (cadr decl-or-cast) (not toplev)))
+ (cadr decl-or-cast) (not toplev) template-class))
;; A declaration has been successfully identified, so do all the
;; fontification of types and refs that've been recorded.
@@ -1650,7 +1666,8 @@
;; font-lock-keyword-face. It always returns NIL to inhibit this and
;; prevent a repeat invocation. See elisp/lispref page "Search-based
;; fontification".
- (let ((decl-search-lim (c-determine-limit 1000))
+ (let ((here (point))
+ (decl-search-lim (c-determine-limit 1000))
paren-state encl-pos token-end context decl-or-cast
start-pos top-level c-restricted-<>-arglists
c-recognize-knr-p) ; Strictly speaking, bogus, but it
@@ -1667,26 +1684,27 @@
(when (or (bobp)
(memq (char-before) '(?\; ?{ ?})))
(setq token-end (point))
- (c-forward-syntactic-ws)
- ;; We're now putatively at the declaration.
- (setq start-pos (point))
- (setq paren-state (c-parse-state))
- ;; At top level or inside a "{"?
- (if (or (not (setq encl-pos
- (c-most-enclosing-brace paren-state)))
- (eq (char-after encl-pos) ?\{))
- (progn
- (setq top-level (c-at-toplevel-p))
- (let ((got-context (c-get-fontification-context
- token-end nil top-level)))
- (setq context (car got-context)
- c-restricted-<>-arglists (cdr got-context)))
- (setq decl-or-cast
- (c-forward-decl-or-cast-1 token-end context nil))
- (when (consp decl-or-cast)
- (goto-char start-pos)
- (c-font-lock-single-decl limit decl-or-cast token-end
- context top-level)))))))
+ (c-forward-syntactic-ws here)
+ (when (< (point) here)
+ ;; We're now putatively at the declaration.
+ (setq start-pos (point))
+ (setq paren-state (c-parse-state))
+ ;; At top level or inside a "{"?
+ (if (or (not (setq encl-pos
+ (c-most-enclosing-brace paren-state)))
+ (eq (char-after encl-pos) ?\{))
+ (progn
+ (setq top-level (c-at-toplevel-p))
+ (let ((got-context (c-get-fontification-context
+ token-end nil top-level)))
+ (setq context (car got-context)
+ c-restricted-<>-arglists (cdr got-context)))
+ (setq decl-or-cast
+ (c-forward-decl-or-cast-1 token-end context nil))
+ (when (consp decl-or-cast)
+ (goto-char start-pos)
+ (c-font-lock-single-decl limit decl-or-cast token-end
+ context top-level))))))))
nil))
(defun c-font-lock-enclosing-decls (limit)
@@ -1996,85 +2014,6 @@
2 font-lock-type-face)
`(,(concat "\\<\\(" re "\\)\\>")
1 'font-lock-type-face)))
-
- ;; Fontify types preceded by `c-type-prefix-kwds' (e.g. "struct").
- ,@(when (c-lang-const c-type-prefix-kwds)
- `((,(byte-compile
- `(lambda (limit)
- (c-fontify-types-and-refs
- ((c-promote-possible-types t)
- ;; The font-lock package in Emacs is known to clobber
- ;; `parse-sexp-lookup-properties' (when it exists).
- (parse-sexp-lookup-properties
- (cc-eval-when-compile
- (boundp 'parse-sexp-lookup-properties))))
- (save-restriction
- ;; Narrow to avoid going past the limit in
- ;; `c-forward-type'.
- (narrow-to-region (point) limit)
- (while (re-search-forward
- ,(concat "\\<\\("
- (c-make-keywords-re nil
- (c-lang-const c-type-prefix-kwds))
- "\\)\\>")
- limit t)
- (unless (c-skip-comments-and-strings limit)
- (c-forward-syntactic-ws)
- ;; Handle prefix declaration specifiers.
- (while
- (or
- (when (or (looking-at c-prefix-spec-kwds-re)
- (and (c-major-mode-is 'java-mode)
- (looking-at "@[A-Za-z0-9]+")))
- (c-forward-keyword-clause 1)
- t)
- (when (and c-opt-cpp-prefix
- (looking-at
- c-noise-macro-with-parens-name-re))
- (c-forward-noise-clause)
- t)))
- ,(if (c-major-mode-is 'c++-mode)
- `(when (and (c-forward-type)
- (eq (char-after) ?=))
- ;; In C++ we additionally check for a "class
- ;; X = Y" construct which is used in
- ;; templates, to fontify Y as a type.
- (forward-char)
- (c-forward-syntactic-ws)
- (c-forward-type))
- `(c-forward-type))
- )))))))))
-
- ;; Fontify symbols after closing braces as declaration
- ;; identifiers under the assumption that they are part of
- ;; declarations like "class Foo { ... } foo;". It's too
- ;; expensive to check this accurately by skipping past the
- ;; brace block, so we use the heuristic that it's such a
- ;; declaration if the first identifier is on the same line as
- ;; the closing brace. `c-font-lock-declarations' will later
- ;; override it if it turns out to be an new declaration, but
- ;; it will be wrong if it's an expression (see the test
- ;; decls-8.cc).
-;; ,@(when (c-lang-const c-opt-block-decls-with-vars-key)
-;; `((,(c-make-font-lock-search-function
-;; (concat "}"
-;; (c-lang-const c-single-line-syntactic-ws)
-;; "\\(" ; 1 + c-single-line-syntactic-ws-depth
-;; (c-lang-const c-type-decl-prefix-key)
-;; "\\|"
-;; (c-lang-const c-symbol-key)
-;; "\\)")
-;; `((c-font-lock-declarators limit t nil) ; That `nil' says use `font-lock-variable-name-face';
-;; ; `t' would mean `font-lock-function-name-face'.
-;; (progn
-;; (c-put-char-property (match-beginning 0) 'c-type
-;; 'c-decl-id-start)
-;; ; 'c-decl-type-start)
-;; (goto-char (match-beginning
-;; ,(1+ (c-lang-const
-;; c-single-line-syntactic-ws-depth)))))
-;; (goto-char (match-end 0)))))))
-
;; Fontify the type in C++ "new" expressions.
,@(when (c-major-mode-is 'c++-mode)
;; This pattern is a probably a "(MATCHER . ANCHORED-HIGHLIGHTER)"
diff -r a8a9fbb96c60e0d68e7aee22ffaaee192a1fc966 -r 31e4abcac39929366dbd6be1d224351064226973 cc-langs.el
--- a/cc-langs.el
+++ b/cc-langs.el
@@ -1874,6 +1874,17 @@
t (c-make-keywords-re t (c-lang-const c-typeof-kwds)))
(c-lang-defvar c-typeof-key (c-lang-const c-typeof-key))
+(c-lang-defconst c-template-typename-kwds
+ "Keywords which, within a template declaration, can introduce a
+declaration with a type as a default value. This is used only in
+C++ Mode, e.g. \"<typename X = Y>\"."
+ t nil
+ c++ '("class" "typename"))
+
+(c-lang-defconst c-template-typename-key
+ t (c-make-keywords-re t (c-lang-const c-template-typename-kwds)))
+(c-lang-defvar c-template-typename-key (c-lang-const c-template-typename-key))
+
(c-lang-defconst c-type-prefix-kwds
"Keywords where the following name - if any - is a type name, and
where the keyword together with the symbol works as a type in
Repository URL: https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.