comparison man/lispref/strings.texi @ 4885:6772ce4d982b

Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums lisp/ChangeLog addition: 2010-01-24 Aidan Kehoe <kehoea@parhasard.net> Correct the semantics of #'member*, #'eql, #'assoc* in the presence of bignums; change the integerp byte code to fixnump semantics. * bytecomp.el (fixnump, integerp, byte-compile-integerp): Change the integerp byte code to fixnump; add a byte-compile method to integerp using fixnump and numberp and avoiding a funcall most of the time, since in the non-core contexts where integerp is used, it's mostly distinguishing between fixnums and things that are not numbers at all. * byte-optimize.el (side-effect-free-fns, byte-after-unbind-ops) (byte-compile-side-effect-and-error-free-ops): Replace the integerp bytecode with fixnump; add fixnump to the side-effect-free-fns. Add the other extended number type predicates to the list in passing. * obsolete.el (floatp-safe): Mark this as obsolete. * cl.el (eql): Go into more detail in the docstring here. Don't bother checking whether both arguments are numbers; one is enough, #'equal will fail correctly if they have distinct types. (subst): Replace a call to #'integerp (deciding whether to use #'memq or not) with one to #'fixnump. Delete most-positive-fixnum, most-negative-fixnum from this file; they're now always in C, so they can't be modified from Lisp. * cl-seq.el (member*, assoc*, rassoc*): Correct these functions in the presence of bignums. * cl-macs.el (cl-make-type-test): The type test for a fixnum is now fixnump. Ditch floatp-safe, use floatp instead. (eql): Correct this compiler macro in the presence of bignums. (assoc*): Correct this compiler macro in the presence of bignums. * simple.el (undo): Change #'integerp to #'fixnump here, since we use #'delq with the same value as ELT a few lines down. src/ChangeLog addition: 2010-01-24 Aidan Kehoe <kehoea@parhasard.net> Fix problems with #'eql, extended number types, and the hash table implementation; change the Bintegerp bytecode to fixnump semantics even on bignum builds, since #'integerp can have a fast implementation in terms of #'fixnump for most of its extant uses, but not vice-versa. * lisp.h: Always #include number.h; we want the macros provided in it, even if the various number types are not available. * number.h (NON_FIXNUM_NUMBER_P): New macro, giving 1 when its argument is of non-immediate number type. Equivalent to FLOATP if WITH_NUMBER_TYPES is not defined. * elhash.c (lisp_object_eql_equal, lisp_object_eql_hash): Use NON_FIXNUM_NUMBER_P in these functions, instead of FLOATP, giving more correct behaviour in the presence of the extended number types. * bytecode.c (Bfixnump, execute_optimized_program): Rename Bintegerp to Bfixnump; change its semantics to reflect the new name on builds with bignum support. * data.c (Ffixnump, Fintegerp, syms_of_data, vars_of_data): Always make #'fixnump available, even on non-BIGNUM builds; always implement #'integerp in this file, even on BIGNUM builds. Move most-positive-fixnum, most-negative-fixnum here from number.c, so they are Lisp constants even on builds without number types, and attempts to change or bind them error. Use the NUMBERP and INTEGERP macros even on builds without extended number types. * data.c (fixnum_char_or_marker_to_int): Rename this function from integer_char_or_marker_to_int, to better reflect the arguments it accepts. * number.c (Fevenp, Foddp, syms_of_number): Never provide #'integerp in this file. Remove #'oddp, #'evenp; their implementations are overridden by those in cl.el. * number.c (vars_of_number): most-positive-fixnum, most-negative-fixnum are no longer here. man/ChangeLog addition: 2010-01-23 Aidan Kehoe <kehoea@parhasard.net> Generally: be careful to say fixnum, not integer, when talking about fixed-precision integral types. I'm sure I've missed instances, both here and in the docstrings, but this is a decent start. * lispref/text.texi (Columns): Document where only fixnums, not integers generally, are accepted. (Registers): Remove some ancient char-int confoundance here. * lispref/strings.texi (Creating Strings, Creating Strings): Be more exact in describing where fixnums but not integers in general are accepted. (Creating Strings): Use a more contemporary example to illustrate how concat deals with lists including integers about #xFF. Delete some obsolete documentation on same. (Char Table Types): Document that only fixnums are accepted as values in syntax tables. * lispref/searching.texi (String Search, Search and Replace): Be exact in describing where fixnums but not integers in general are accepted. * lispref/range-tables.texi (Range Tables): Be exact in describing them; only fixnums are accepted to describe ranges. * lispref/os.texi (Killing XEmacs, User Identification) (Time of Day, Time Conversion): Be more exact about using fixnum where only fixed-precision integers are accepted. * lispref/objects.texi (Integer Type): Be more exact (and up-to-date) about the possible values for integers. Cross-reference to documentation of the bignum extension. (Equality Predicates): (Range Table Type): (Array Type): Use fixnum, not integer, to describe a fixed-precision integer. (Syntax Table Type): Correct some English syntax here. * lispref/numbers.texi (Numbers): Change the phrasing here to use fixnum to mean the fixed-precision integers normal in emacs. Document that our terminology deviates from that of Common Lisp, and that we're working on it. (Compatibility Issues): Reiterate the Common Lisp versus Emacs Lisp compatibility issues. (Comparison of Numbers, Arithmetic Operations): * lispref/commands.texi (Command Loop Info, Working With Events): * lispref/buffers.texi (Modification Time): Be more exact in describing where fixnums but not integers in general are accepted.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 24 Jan 2010 15:21:27 +0000
parents d9eb5ea14f65
children 99f8ebc082d9
comparison
equal deleted inserted replaced
4869:e533a9912ef1 4885:6772ce4d982b
143 @end defun 143 @end defun
144 144
145 @defun make-string length character 145 @defun make-string length character
146 This function returns a new string consisting entirely of @var{length} 146 This function returns a new string consisting entirely of @var{length}
147 successive copies of @var{character}. @var{length} must be a 147 successive copies of @var{character}. @var{length} must be a
148 non-negative integer. 148 non-negative fixnum.
149 149
150 @example 150 @example
151 (make-string 5 ?x) 151 (make-string 5 ?x)
152 @result{} "xxxxx" 152 @result{} "xxxxx"
153 (make-string 0 ?x) 153 (make-string 0 ?x)
222 If the characters copied from @var{string} have duplicable extents or 222 If the characters copied from @var{string} have duplicable extents or
223 text properties, those are copied into the new string also. 223 text properties, those are copied into the new string also.
224 @xref{Duplicable Extents}. 224 @xref{Duplicable Extents}.
225 225
226 A @code{wrong-type-argument} error is signaled if either @var{start} or 226 A @code{wrong-type-argument} error is signaled if either @var{start} or
227 @var{end} is not an integer or @code{nil}. An @code{args-out-of-range} 227 @var{end} is not a fixnum or @code{nil}. An @code{args-out-of-range}
228 error is signaled if @var{start} indicates a character following 228 error is signaled if @var{start} indicates a character following
229 @var{end}, or if either integer is out of range for @var{string}. 229 @var{end}, or if either integer is out of range for @var{string}.
230 230
231 Contrast this function with @code{buffer-substring} (@pxref{Buffer 231 Contrast this function with @code{buffer-substring} (@pxref{Buffer
232 Contents}), which returns a string containing a portion of the text in 232 Contents}), which returns a string containing a portion of the text in
244 returns an empty string. 244 returns an empty string.
245 245
246 @example 246 @example
247 (concat "abc" "-def") 247 (concat "abc" "-def")
248 @result{} "abc-def" 248 @result{} "abc-def"
249 (concat "abc" (list 120 (+ 256 121)) [122]) 249 (equal (concat "abc" (list 120 (+ 256 121)) [122]) (format "abcx%cz" 377))
250 @result{} "abcxyz" 250 @result{} t
251 ;; @r{@code{nil} is an empty sequence.} 251 ;; @r{@code{nil} is an empty sequence.}
252 (concat "abc" nil "-def") 252 (concat "abc" nil "-def")
253 @result{} "abc-def" 253 @result{} "abc-def"
254 (concat "The " "quick brown " "fox.") 254 (concat "The " "quick brown " "fox.")
255 @result{} "The quick brown fox." 255 @result{} "The quick brown fox."
256 (concat) 256 (concat)
257 @result{} "" 257 @result{} ""
258 @end example 258 @end example
259 259
260 @noindent 260 @noindent
261 The second example above shows how characters stored in strings are
262 taken modulo 256. In other words, each character in the string is
263 stored in one byte.
264
265 The @code{concat} function always constructs a new string that is 261 The @code{concat} function always constructs a new string that is
266 not @code{eq} to any existing string. 262 not @code{eq} to any existing string.
267
268 When an argument is an integer (not a sequence of integers), it is
269 converted to a string of digits making up the decimal printed
270 representation of the integer. @strong{Don't use this feature; we plan
271 to eliminate it. If you already use this feature, change your programs
272 now!} The proper way to convert an integer to a decimal number in this
273 way is with @code{format} (@pxref{Formatting Strings}) or
274 @code{number-to-string} (@pxref{String Conversion}).
275
276 @example
277 @group
278 (concat 137)
279 @result{} "137"
280 (concat 54 321)
281 @result{} "54321"
282 @end group
283 @end example
284 263
285 For information about other concatenation functions, see the description 264 For information about other concatenation functions, see the description
286 of @code{mapconcat} in @ref{Mapping Functions}, @code{vconcat} in 265 of @code{mapconcat} in @ref{Mapping Functions}, @code{vconcat} in
287 @ref{Vectors}, @code{bvconcat} in @ref{Bit Vectors}, and @code{append} 266 @ref{Vectors}, @code{bvconcat} in @ref{Bit Vectors}, and @code{append}
288 in @ref{Building Lists}. 267 in @ref{Building Lists}.
1187 Used for display tables, which specify how a particular character 1166 Used for display tables, which specify how a particular character
1188 is to appear when displayed. #### Not yet implemented. 1167 is to appear when displayed. #### Not yet implemented.
1189 @item syntax 1168 @item syntax
1190 Used for syntax tables, which specify the syntax of a particular 1169 Used for syntax tables, which specify the syntax of a particular
1191 character. Higher-level Lisp functions are provided for 1170 character. Higher-level Lisp functions are provided for
1192 working with syntax tables. The valid values are integers. 1171 working with syntax tables. The valid values are fixnums.
1193 @end table 1172 @end table
1194 1173
1195 @defun char-table-type char-table 1174 @defun char-table-type char-table
1196 This function returns the type of char table @var{char-table}. 1175 This function returns the type of char table @var{char-table}.
1197 @end defun 1176 @end defun