comparison src/fns.c @ 109793:b60dcdd855f0

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sun, 08 Aug 2010 22:52:25 +0000
parents df8e0cd18128
children 0b99cd248806
comparison
equal deleted inserted replaced
109649:1f8f03cfcd2b 109793:b60dcdd855f0
223 || memcmp (SDATA (s1), SDATA (s2), SBYTES (s1))) 223 || memcmp (SDATA (s1), SDATA (s2), SBYTES (s1)))
224 return Qnil; 224 return Qnil;
225 return Qt; 225 return Qt;
226 } 226 }
227 227
228 DEFUN ("compare-strings", Fcompare_strings, 228 DEFUN ("compare-strings", Fcompare_strings, Scompare_strings, 6, 7, 0,
229 Scompare_strings, 6, 7, 0, 229 doc: /* Compare the contents of two strings, converting to multibyte if needed.
230 doc: /* Compare the contents of two strings, converting to multibyte if needed.
231 In string STR1, skip the first START1 characters and stop at END1. 230 In string STR1, skip the first START1 characters and stop at END1.
232 In string STR2, skip the first START2 characters and stop at END2. 231 In string STR2, skip the first START2 characters and stop at END2.
233 END1 and END2 default to the full lengths of the respective strings. 232 END1 and END2 default to the full lengths of the respective strings.
234 233
235 Case is significant in this comparison if IGNORE-CASE is nil. 234 Case is significant in this comparison if IGNORE-CASE is nil.
1197 } 1196 }
1198 1197
1199 1198
1200 DEFUN ("substring-no-properties", Fsubstring_no_properties, Ssubstring_no_properties, 1, 3, 0, 1199 DEFUN ("substring-no-properties", Fsubstring_no_properties, Ssubstring_no_properties, 1, 3, 0,
1201 doc: /* Return a substring of STRING, without text properties. 1200 doc: /* Return a substring of STRING, without text properties.
1202 It starts at index FROM and ending before TO. 1201 It starts at index FROM and ends before TO.
1203 TO may be nil or omitted; then the substring runs to the end of STRING. 1202 TO may be nil or omitted; then the substring runs to the end of STRING.
1204 If FROM is nil or omitted, the substring starts at the beginning of STRING. 1203 If FROM is nil or omitted, the substring starts at the beginning of STRING.
1205 If FROM or TO is negative, it counts from the end. 1204 If FROM or TO is negative, it counts from the end.
1206 1205
1207 With one argument, just copy STRING without its properties. */) 1206 With one argument, just copy STRING without its properties. */)
1289 1288
1290 return res; 1289 return res;
1291 } 1290 }
1292 1291
1293 DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0, 1292 DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0,
1294 doc: /* Take cdr N times on LIST, returns the result. */) 1293 doc: /* Take cdr N times on LIST, return the result. */)
1295 (Lisp_Object n, Lisp_Object list) 1294 (Lisp_Object n, Lisp_Object list)
1296 { 1295 {
1297 register int i, num; 1296 register int i, num;
1298 CHECK_NUMBER (n); 1297 CHECK_NUMBER (n);
1299 num = XINT (n); 1298 num = XINT (n);
1326 CHECK_ARRAY (sequence, Qsequencep); 1325 CHECK_ARRAY (sequence, Qsequencep);
1327 return Faref (sequence, n); 1326 return Faref (sequence, n);
1328 } 1327 }
1329 1328
1330 DEFUN ("member", Fmember, Smember, 2, 2, 0, 1329 DEFUN ("member", Fmember, Smember, 2, 2, 0,
1331 doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `equal'. 1330 doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `equal'.
1332 The value is actually the tail of LIST whose car is ELT. */) 1331 The value is actually the tail of LIST whose car is ELT. */)
1333 (register Lisp_Object elt, Lisp_Object list) 1332 (register Lisp_Object elt, Lisp_Object list)
1334 { 1333 {
1335 register Lisp_Object tail; 1334 register Lisp_Object tail;
1336 for (tail = list; CONSP (tail); tail = XCDR (tail)) 1335 for (tail = list; CONSP (tail); tail = XCDR (tail))
1344 } 1343 }
1345 return Qnil; 1344 return Qnil;
1346 } 1345 }
1347 1346
1348 DEFUN ("memq", Fmemq, Smemq, 2, 2, 0, 1347 DEFUN ("memq", Fmemq, Smemq, 2, 2, 0,
1349 doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `eq'. 1348 doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `eq'.
1350 The value is actually the tail of LIST whose car is ELT. */) 1349 The value is actually the tail of LIST whose car is ELT. */)
1351 (register Lisp_Object elt, Lisp_Object list) 1350 (register Lisp_Object elt, Lisp_Object list)
1352 { 1351 {
1353 while (1) 1352 while (1)
1354 { 1353 {
1370 CHECK_LIST (list); 1369 CHECK_LIST (list);
1371 return list; 1370 return list;
1372 } 1371 }
1373 1372
1374 DEFUN ("memql", Fmemql, Smemql, 2, 2, 0, 1373 DEFUN ("memql", Fmemql, Smemql, 2, 2, 0,
1375 doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `eql'. 1374 doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `eql'.
1376 The value is actually the tail of LIST whose car is ELT. */) 1375 The value is actually the tail of LIST whose car is ELT. */)
1377 (register Lisp_Object elt, Lisp_Object list) 1376 (register Lisp_Object elt, Lisp_Object list)
1378 { 1377 {
1379 register Lisp_Object tail; 1378 register Lisp_Object tail;
1380 1379
2700 } 2699 }
2701 2700
2702 Lisp_Object Vfeatures, Qsubfeatures; 2701 Lisp_Object Vfeatures, Qsubfeatures;
2703 2702
2704 DEFUN ("featurep", Ffeaturep, Sfeaturep, 1, 2, 0, 2703 DEFUN ("featurep", Ffeaturep, Sfeaturep, 1, 2, 0,
2705 doc: /* Returns t if FEATURE is present in this Emacs. 2704 doc: /* Return t if FEATURE is present in this Emacs.
2706 2705
2707 Use this to conditionalize execution of lisp code based on the 2706 Use this to conditionalize execution of lisp code based on the
2708 presence or absence of Emacs or environment extensions. 2707 presence or absence of Emacs or environment extensions.
2709 Use `provide' to declare that a feature is available. This function 2708 Use `provide' to declare that a feature is available. This function
2710 looks at the value of the variable `features'. The optional argument 2709 looks at the value of the variable `features'. The optional argument
4423 fills up. If REHASH-SIZE is an integer, add that many space. If it 4422 fills up. If REHASH-SIZE is an integer, add that many space. If it
4424 is a float, it must be > 1.0, and the new size is computed by 4423 is a float, it must be > 1.0, and the new size is computed by
4425 multiplying the old size with that factor. Default is 1.5. 4424 multiplying the old size with that factor. Default is 1.5.
4426 4425
4427 :rehash-threshold THRESHOLD -- THRESHOLD must a float > 0, and <= 1.0. 4426 :rehash-threshold THRESHOLD -- THRESHOLD must a float > 0, and <= 1.0.
4428 Resize the hash table when ratio of the number of entries in the 4427 Resize the hash table when the ratio (number of entries / table size)
4429 table. Default is 0.8. 4428 is greater or equal than THRESHOLD. Default is 0.8.
4430 4429
4431 :weakness WEAK -- WEAK must be one of nil, t, `key', `value', 4430 :weakness WEAK -- WEAK must be one of nil, t, `key', `value',
4432 `key-or-value', or `key-and-value'. If WEAK is not nil, the table 4431 `key-or-value', or `key-and-value'. If WEAK is not nil, the table
4433 returned is a weak table. Key/value pairs are removed from a weak 4432 returned is a weak table. Key/value pairs are removed from a weak
4434 hash table when there are no non-weak references pointing to their 4433 hash table when there are no non-weak references pointing to their
4547 4546
4548 4547
4549 DEFUN ("hash-table-size", Fhash_table_size, Shash_table_size, 1, 1, 0, 4548 DEFUN ("hash-table-size", Fhash_table_size, Shash_table_size, 1, 1, 0,
4550 doc: /* Return the size of TABLE. 4549 doc: /* Return the size of TABLE.
4551 The size can be used as an argument to `make-hash-table' to create 4550 The size can be used as an argument to `make-hash-table' to create
4552 a hash table than can hold as many elements of TABLE holds 4551 a hash table than can hold as many elements as TABLE holds
4553 without need for resizing. */) 4552 without need for resizing. */)
4554 (Lisp_Object table) 4553 (Lisp_Object table)
4555 { 4554 {
4556 struct Lisp_Hash_Table *h = check_hash_table (table); 4555 struct Lisp_Hash_Table *h = check_hash_table (table);
4557 return make_number (HASH_TABLE_SIZE (h)); 4556 return make_number (HASH_TABLE_SIZE (h));