comparison src/fns.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 0293115a14e9
children 441bb1e64a06
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
108 memory_hash (v->bits, 108 memory_hash (v->bits,
109 BIT_VECTOR_LONG_STORAGE (bit_vector_length (v)) * 109 BIT_VECTOR_LONG_STORAGE (bit_vector_length (v)) *
110 sizeof (long))); 110 sizeof (long)));
111 } 111 }
112 112
113 DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0 /* 113 DEFUN ("identity", Fidentity, 1, 1, 0, /*
114 Return the argument unchanged. 114 Return the argument unchanged.
115 */ ) 115 */
116 (arg) 116 (arg))
117 Lisp_Object arg;
118 { 117 {
119 return arg; 118 return arg;
120 } 119 }
121 120
122 extern long get_random (void); 121 extern long get_random (void);
123 extern void seed_random (long arg); 122 extern void seed_random (long arg);
124 123
125 DEFUN ("random", Frandom, Srandom, 0, 1, 0 /* 124 DEFUN ("random", Frandom, 0, 1, 0, /*
126 Return a pseudo-random number. 125 Return a pseudo-random number.
127 All integers representable in Lisp are equally likely.\n\ 126 All integers representable in Lisp are equally likely.\n\
128 On most systems, this is 28 bits' worth.\n\ 127 On most systems, this is 28 bits' worth.\n\
129 With positive integer argument N, return random number in interval [0,N).\n\ 128 With positive integer argument N, return random number in interval [0,N).\n\
130 With argument t, set the random number seed from the current time and pid. 129 With argument t, set the random number seed from the current time and pid.
131 */ ) 130 */
132 (limit) 131 (limit))
133 Lisp_Object limit;
134 { 132 {
135 EMACS_INT val; 133 EMACS_INT val;
136 Lisp_Object lispy_val; 134 Lisp_Object lispy_val;
137 unsigned long denominator; 135 unsigned long denominator;
138 136
197 (seq, 195 (seq,
198 "As of 19.14, `%s' no longer works with compiled-function objects", 196 "As of 19.14, `%s' no longer works with compiled-function objects",
199 function); 197 function);
200 } 198 }
201 199
202 DEFUN ("length", Flength, Slength, 1, 1, 0 /* 200 DEFUN ("length", Flength, 1, 1, 0, /*
203 Return the length of vector, bit vector, list or string SEQUENCE. 201 Return the length of vector, bit vector, list or string SEQUENCE.
204 */ ) 202 */
205 (obj) 203 (obj))
206 Lisp_Object obj;
207 { 204 {
208 Lisp_Object tail; 205 Lisp_Object tail;
209 int i; 206 int i;
210 207
211 retry: 208 retry:
238 } 235 }
239 236
240 /* This does not check for quits. That is safe 237 /* This does not check for quits. That is safe
241 since it must terminate. */ 238 since it must terminate. */
242 239
243 DEFUN ("safe-length", Fsafe_length, Ssafe_length, 1, 1, 0 /* 240 DEFUN ("safe-length", Fsafe_length, 1, 1, 0, /*
244 Return the length of a list, but avoid error or infinite loop. 241 Return the length of a list, but avoid error or infinite loop.
245 This function never gets an error. If LIST is not really a list, 242 This function never gets an error. If LIST is not really a list,
246 it returns 0. If LIST is circular, it returns a finite value 243 it returns 0. If LIST is circular, it returns a finite value
247 which is at least the number of distinct elements. 244 which is at least the number of distinct elements.
248 */ ) 245 */
249 (list) 246 (list))
250 Lisp_Object list;
251 { 247 {
252 Lisp_Object tail, halftail, length; 248 Lisp_Object tail, halftail, length;
253 int len = 0; 249 int len = 0;
254 250
255 /* halftail is used to detect circular lists. */ 251 /* halftail is used to detect circular lists. */
267 return length; 263 return length;
268 } 264 }
269 265
270 /*** string functions. ***/ 266 /*** string functions. ***/
271 267
272 DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0 /* 268 DEFUN ("string-equal", Fstring_equal, 2, 2, 0, /*
273 T if two strings have identical contents. 269 T if two strings have identical contents.
274 Case is significant. Text properties are ignored. 270 Case is significant. Text properties are ignored.
275 (Under XEmacs, `equal' also ignores text properties and extents in 271 (Under XEmacs, `equal' also ignores text properties and extents in
276 strings, but this is not the case under FSF Emacs.) 272 strings, but this is not the case under FSF Emacs.)
277 Symbols are also allowed; their print names are used instead. 273 Symbols are also allowed; their print names are used instead.
278 */ ) 274 */
279 (s1, s2) 275 (s1, s2))
280 Lisp_Object s1, s2;
281 { 276 {
282 int len; 277 int len;
283 278
284 if (SYMBOLP (s1)) 279 if (SYMBOLP (s1))
285 XSETSTRING (s1, XSYMBOL (s1)->name); 280 XSETSTRING (s1, XSYMBOL (s1)->name);
294 return Qnil; 289 return Qnil;
295 return Qt; 290 return Qt;
296 } 291 }
297 292
298 293
299 DEFUN ("string-lessp", Fstring_lessp, Sstring_lessp, 2, 2, 0 /* 294 DEFUN ("string-lessp", Fstring_lessp, 2, 2, 0, /*
300 T if first arg string is less than second in lexicographic order. 295 T if first arg string is less than second in lexicographic order.
301 If I18N2 support was compiled in, ordering is determined by the locale. 296 If I18N2 support was compiled in, ordering is determined by the locale.
302 Case is significant for the default C locale. 297 Case is significant for the default C locale.
303 Symbols are also allowed; their print names are used instead. 298 Symbols are also allowed; their print names are used instead.
304 */ ) 299 */
305 (s1, s2) 300 (s1, s2))
306 Lisp_Object s1, s2;
307 { 301 {
308 struct Lisp_String *p1, *p2; 302 struct Lisp_String *p1, *p2;
309 Charcount end, len2; 303 Charcount end, len2;
310 304
311 if (SYMBOLP (s1)) 305 if (SYMBOLP (s1))
350 won't work right in I18N2 case */ 344 won't work right in I18N2 case */
351 return ((end < len2) ? Qt : Qnil); 345 return ((end < len2) ? Qt : Qnil);
352 } 346 }
353 } 347 }
354 348
355 DEFUN ("string-modified-tick", Fstring_modified_tick, Sstring_modified_tick, 349 DEFUN ("string-modified-tick", Fstring_modified_tick, 1, 1, 0, /*
356 1, 1, 0 /*
357 Return STRING's tick counter, incremented for each change to the string. 350 Return STRING's tick counter, incremented for each change to the string.
358 Each string has a tick counter which is incremented each time the contents 351 Each string has a tick counter which is incremented each time the contents
359 of the string are changed (e.g. with `aset'). It wraps around occasionally. 352 of the string are changed (e.g. with `aset'). It wraps around occasionally.
360 */ ) 353 */
361 (string) 354 (string))
362 Lisp_Object string;
363 { 355 {
364 struct Lisp_String *s; 356 struct Lisp_String *s;
365 357
366 CHECK_STRING (string); 358 CHECK_STRING (string);
367 s = XSTRING (string); 359 s = XSTRING (string);
432 args[1] = s2; 424 args[1] = s2;
433 args[2] = s3; 425 args[2] = s3;
434 return concat (3, args, c_vector, 0); 426 return concat (3, args, c_vector, 0);
435 } 427 }
436 428
437 DEFUN ("append", Fappend, Sappend, 0, MANY, 0 /* 429 DEFUN ("append", Fappend, 0, MANY, 0, /*
438 Concatenate all the arguments and make the result a list. 430 Concatenate all the arguments and make the result a list.
439 The result is a list whose elements are the elements of all the arguments. 431 The result is a list whose elements are the elements of all the arguments.
440 Each argument may be a list, vector, bit vector, or string. 432 Each argument may be a list, vector, bit vector, or string.
441 The last argument is not copied, just used as the tail of the new list. 433 The last argument is not copied, just used as the tail of the new list.
442 */ ) 434 */
443 (nargs, args) 435 (int nargs, Lisp_Object *args))
444 int nargs;
445 Lisp_Object *args;
446 { 436 {
447 return concat (nargs, args, c_cons, 1); 437 return concat (nargs, args, c_cons, 1);
448 } 438 }
449 439
450 DEFUN ("concat", Fconcat, Sconcat, 0, MANY, 0 /* 440 DEFUN ("concat", Fconcat, 0, MANY, 0, /*
451 Concatenate all the arguments and make the result a string. 441 Concatenate all the arguments and make the result a string.
452 The result is a string whose elements are the elements of all the arguments. 442 The result is a string whose elements are the elements of all the arguments.
453 Each argument may be a string or a list or vector of characters (integers). 443 Each argument may be a string or a list or vector of characters (integers).
454 444
455 Do not use individual integers as arguments! 445 Do not use individual integers as arguments!
456 The behavior of `concat' in that case will be changed later! 446 The behavior of `concat' in that case will be changed later!
457 If your program passes an integer as an argument to `concat', 447 If your program passes an integer as an argument to `concat',
458 you should change it right away not to do so. 448 you should change it right away not to do so.
459 */ ) 449 */
460 (nargs, args) 450 (int nargs, Lisp_Object *args))
461 int nargs;
462 Lisp_Object *args;
463 { 451 {
464 return concat (nargs, args, c_string, 0); 452 return concat (nargs, args, c_string, 0);
465 } 453 }
466 454
467 DEFUN ("vconcat", Fvconcat, Svconcat, 0, MANY, 0 /* 455 DEFUN ("vconcat", Fvconcat, 0, MANY, 0, /*
468 Concatenate all the arguments and make the result a vector. 456 Concatenate all the arguments and make the result a vector.
469 The result is a vector whose elements are the elements of all the arguments. 457 The result is a vector whose elements are the elements of all the arguments.
470 Each argument may be a list, vector, bit vector, or string. 458 Each argument may be a list, vector, bit vector, or string.
471 */ ) 459 */
472 (nargs, args) 460 (int nargs, Lisp_Object *args))
473 int nargs;
474 Lisp_Object *args;
475 { 461 {
476 return concat (nargs, args, c_vector, 0); 462 return concat (nargs, args, c_vector, 0);
477 } 463 }
478 464
479 DEFUN ("bvconcat", Fbvconcat, Sbvconcat, 0, MANY, 0 /* 465 DEFUN ("bvconcat", Fbvconcat, 0, MANY, 0, /*
480 Concatenate all the arguments and make the result a bit vector. 466 Concatenate all the arguments and make the result a bit vector.
481 The result is a bit vector whose elements are the elements of all the 467 The result is a bit vector whose elements are the elements of all the
482 arguments. Each argument may be a list, vector, bit vector, or string. 468 arguments. Each argument may be a list, vector, bit vector, or string.
483 */ ) 469 */
484 (nargs, args) 470 (int nargs, Lisp_Object *args))
485 int nargs;
486 Lisp_Object *args;
487 { 471 {
488 return concat (nargs, args, c_bit_vector, 0); 472 return concat (nargs, args, c_bit_vector, 0);
489 } 473 }
490 474
491 DEFUN ("copy-sequence", Fcopy_sequence, Scopy_sequence, 1, 1, 0 /* 475 DEFUN ("copy-sequence", Fcopy_sequence, 1, 1, 0, /*
492 Return a copy of a list, vector, bit vector or string. 476 Return a copy of a list, vector, bit vector or string.
493 The elements of a list or vector are not copied; they are shared 477 The elements of a list or vector are not copied; they are shared
494 with the original. 478 with the original.
495 */ ) 479 */
496 (arg) 480 (arg))
497 Lisp_Object arg;
498 { 481 {
499 again: 482 again:
500 if (NILP (arg)) return arg; 483 if (NILP (arg)) return arg;
501 /* We handle conses separately because concat() is big and hairy and 484 /* We handle conses separately because concat() is big and hairy and
502 doesn't handle (copy-sequence '(a b . c)) and it's easier to redo this 485 doesn't handle (copy-sequence '(a b . c)) and it's easier to redo this
780 XCDR (prev) = last_tail; 763 XCDR (prev) = last_tail;
781 764
782 RETURN_UNGCPRO (val); 765 RETURN_UNGCPRO (val);
783 } 766 }
784 767
785 DEFUN ("copy-alist", Fcopy_alist, Scopy_alist, 1, 1, 0 /* 768 DEFUN ("copy-alist", Fcopy_alist, 1, 1, 0, /*
786 Return a copy of ALIST. 769 Return a copy of ALIST.
787 This is an alist which represents the same mapping from objects to objects, 770 This is an alist which represents the same mapping from objects to objects,
788 but does not share the alist structure with ALIST. 771 but does not share the alist structure with ALIST.
789 The objects mapped (cars and cdrs of elements of the alist) 772 The objects mapped (cars and cdrs of elements of the alist)
790 are shared, however. 773 are shared, however.
791 Elements of ALIST that are not conses are also shared. 774 Elements of ALIST that are not conses are also shared.
792 */ ) 775 */
793 (alist) 776 (alist))
794 Lisp_Object alist;
795 { 777 {
796 Lisp_Object tem; 778 Lisp_Object tem;
797 779
798 CHECK_LIST (alist); 780 CHECK_LIST (alist);
799 if (NILP (alist)) 781 if (NILP (alist))
808 XCAR (tem) = Fcons (XCAR (car), XCDR (car)); 790 XCAR (tem) = Fcons (XCAR (car), XCDR (car));
809 } 791 }
810 return alist; 792 return alist;
811 } 793 }
812 794
813 DEFUN ("copy-tree", Fcopy_tree, Scopy_tree, 1, 2, 0 /* 795 DEFUN ("copy-tree", Fcopy_tree, 1, 2, 0, /*
814 Return a copy of a list and substructures. 796 Return a copy of a list and substructures.
815 The argument is copied, and any lists contained within it are copied 797 The argument is copied, and any lists contained within it are copied
816 recursively. Circularities and shared substructures are not preserved. 798 recursively. Circularities and shared substructures are not preserved.
817 Second arg VECP causes vectors to be copied, too. Strings and bit vectors 799 Second arg VECP causes vectors to be copied, too. Strings and bit vectors
818 are not copied. 800 are not copied.
819 */ ) 801 */
820 (arg, vecp) 802 (arg, vecp))
821 Lisp_Object arg, vecp;
822 { 803 {
823 if (CONSP (arg)) 804 if (CONSP (arg))
824 { 805 {
825 Lisp_Object rest; 806 Lisp_Object rest;
826 rest = arg = Fcopy_sequence (arg); 807 rest = arg = Fcopy_sequence (arg);
849 } 830 }
850 } 831 }
851 return arg; 832 return arg;
852 } 833 }
853 834
854 DEFUN ("substring", Fsubstring, Ssubstring, 2, 3, 0 /* 835 DEFUN ("substring", Fsubstring, 2, 3, 0, /*
855 Return a substring of STRING, starting at index FROM and ending before TO. 836 Return a substring of STRING, starting at index FROM and ending before TO.
856 TO may be nil or omitted; then the substring runs to the end of STRING. 837 TO may be nil or omitted; then the substring runs to the end of STRING.
857 If FROM or TO is negative, it counts from the end. 838 If FROM or TO is negative, it counts from the end.
858 Relevant parts of the string-extent-data are copied in the new string. 839 Relevant parts of the string-extent-data are copied in the new string.
859 */ ) 840 */
860 (string, from, to) 841 (string, from, to))
861 Lisp_Object string;
862 Lisp_Object from, to;
863 { 842 {
864 Charcount ccfr, ccto; 843 Charcount ccfr, ccto;
865 Bytecount bfr, bto; 844 Bytecount bfr, bto;
866 Lisp_Object val; 845 Lisp_Object val;
867 846
876 /* Copy any applicable extent information into the new string: */ 855 /* Copy any applicable extent information into the new string: */
877 copy_string_extents (val, string, 0, bfr, bto - bfr); 856 copy_string_extents (val, string, 0, bfr, bto - bfr);
878 return (val); 857 return (val);
879 } 858 }
880 859
881 DEFUN ("subseq", Fsubseq, Ssubseq, 2, 3, 0 /* 860 DEFUN ("subseq", Fsubseq, 2, 3, 0, /*
882 Return a subsequence of SEQ, starting at index FROM and ending before TO. 861 Return a subsequence of SEQ, starting at index FROM and ending before TO.
883 TO may be nil or omitted; then the subsequence runs to the end of SEQ. 862 TO may be nil or omitted; then the subsequence runs to the end of SEQ.
884 If FROM or TO is negative, it counts from the end. 863 If FROM or TO is negative, it counts from the end.
885 The resulting subsequence is always the same type as the original 864 The resulting subsequence is always the same type as the original
886 sequence. 865 sequence.
887 If SEQ is a string, relevant parts of the string-extent-data are copied 866 If SEQ is a string, relevant parts of the string-extent-data are copied
888 in the new string. 867 in the new string.
889 */ ) 868 */
890 (seq, from, to) 869 (seq, from, to))
891 Lisp_Object seq;
892 Lisp_Object from, to;
893 { 870 {
894 int len, f, t; 871 int len, f, t;
895 872
896 if (STRINGP (seq)) 873 if (STRINGP (seq))
897 return Fsubstring (seq, from, to); 874 return Fsubstring (seq, from, to);
963 return result; 940 return result;
964 } 941 }
965 } 942 }
966 943
967 944
968 DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0 /* 945 DEFUN ("nthcdr", Fnthcdr, 2, 2, 0, /*
969 Take cdr N times on LIST, returns the result. 946 Take cdr N times on LIST, returns the result.
970 */ ) 947 */
971 (n, list) 948 (n, list))
972 Lisp_Object n;
973 Lisp_Object list;
974 { 949 {
975 REGISTER int i, num; 950 REGISTER int i, num;
976 CHECK_INT (n); 951 CHECK_INT (n);
977 num = XINT (n); 952 num = XINT (n);
978 for (i = 0; i < num && !NILP (list); i++) 953 for (i = 0; i < num && !NILP (list); i++)
981 list = Fcdr (list); 956 list = Fcdr (list);
982 } 957 }
983 return list; 958 return list;
984 } 959 }
985 960
986 DEFUN ("nth", Fnth, Snth, 2, 2, 0 /* 961 DEFUN ("nth", Fnth, 2, 2, 0, /*
987 Return the Nth element of LIST. 962 Return the Nth element of LIST.
988 N counts from zero. If LIST is not that long, nil is returned. 963 N counts from zero. If LIST is not that long, nil is returned.
989 */ ) 964 */
990 (n, list) 965 (n, list))
991 Lisp_Object n, list;
992 { 966 {
993 return Fcar (Fnthcdr (n, list)); 967 return Fcar (Fnthcdr (n, list));
994 } 968 }
995 969
996 DEFUN ("elt", Felt, Selt, 2, 2, 0 /* 970 DEFUN ("elt", Felt, 2, 2, 0, /*
997 Return element of SEQUENCE at index N. 971 Return element of SEQUENCE at index N.
998 */ ) 972 */
999 (seq, n) 973 (seq, n))
1000 Lisp_Object seq, n;
1001 { 974 {
1002 retry: 975 retry:
1003 CHECK_INT_COERCE_CHAR (n); /* yuck! */ 976 CHECK_INT_COERCE_CHAR (n); /* yuck! */
1004 if (CONSP (seq) || NILP (seq)) 977 if (CONSP (seq) || NILP (seq))
1005 { 978 {
1067 seq = wrong_type_argument (Qsequencep, seq); 1040 seq = wrong_type_argument (Qsequencep, seq);
1068 goto retry; 1041 goto retry;
1069 } 1042 }
1070 } 1043 }
1071 1044
1072 DEFUN ("member", Fmember, Smember, 2, 2, 0 /* 1045 DEFUN ("member", Fmember, 2, 2, 0, /*
1073 Return non-nil if ELT is an element of LIST. Comparison done with `equal'. 1046 Return non-nil if ELT is an element of LIST. Comparison done with `equal'.
1074 The value is actually the tail of LIST whose car is ELT. 1047 The value is actually the tail of LIST whose car is ELT.
1075 */ ) 1048 */
1076 (elt, list) 1049 (elt, list))
1077 Lisp_Object elt;
1078 Lisp_Object list;
1079 { 1050 {
1080 REGISTER Lisp_Object tail, tem; 1051 REGISTER Lisp_Object tail, tem;
1081 for (tail = list; !NILP (tail); tail = Fcdr (tail)) 1052 for (tail = list; !NILP (tail); tail = Fcdr (tail))
1082 { 1053 {
1083 tem = Fcar (tail); 1054 tem = Fcar (tail);
1086 QUIT; 1057 QUIT;
1087 } 1058 }
1088 return Qnil; 1059 return Qnil;
1089 } 1060 }
1090 1061
1091 DEFUN ("memq", Fmemq, Smemq, 2, 2, 0 /* 1062 DEFUN ("memq", Fmemq, 2, 2, 0, /*
1092 Return non-nil if ELT is an element of LIST. Comparison done with `eq'. 1063 Return non-nil if ELT is an element of LIST. Comparison done with `eq'.
1093 The value is actually the tail of LIST whose car is ELT. 1064 The value is actually the tail of LIST whose car is ELT.
1094 */ ) 1065 */
1095 (elt, list) 1066 (elt, list))
1096 Lisp_Object elt;
1097 Lisp_Object list;
1098 { 1067 {
1099 REGISTER Lisp_Object tail, tem; 1068 REGISTER Lisp_Object tail, tem;
1100 for (tail = list; !NILP (tail); tail = Fcdr (tail)) 1069 for (tail = list; !NILP (tail); tail = Fcdr (tail))
1101 { 1070 {
1102 tem = Fcar (tail); 1071 tem = Fcar (tail);
1116 if (HACKEQ_UNSAFE (elt, tem)) return tail; 1085 if (HACKEQ_UNSAFE (elt, tem)) return tail;
1117 } 1086 }
1118 return Qnil; 1087 return Qnil;
1119 } 1088 }
1120 1089
1121 DEFUN ("assoc", Fassoc, Sassoc, 2, 2, 0 /* 1090 DEFUN ("assoc", Fassoc, 2, 2, 0, /*
1122 Return non-nil if KEY is `equal' to the car of an element of LIST. 1091 Return non-nil if KEY is `equal' to the car of an element of LIST.
1123 The value is actually the element of LIST whose car equals KEY. 1092 The value is actually the element of LIST whose car equals KEY.
1124 */ ) 1093 */
1125 (key, list) 1094 (key, list))
1126 Lisp_Object key;
1127 Lisp_Object list;
1128 { 1095 {
1129 /* This function can GC. */ 1096 /* This function can GC. */
1130 REGISTER Lisp_Object tail, elt, tem; 1097 REGISTER Lisp_Object tail, elt, tem;
1131 for (tail = list; !NILP (tail); tail = Fcdr (tail)) 1098 for (tail = list; !NILP (tail); tail = Fcdr (tail))
1132 { 1099 {
1145 int speccount = specpdl_depth (); 1112 int speccount = specpdl_depth ();
1146 specbind (Qinhibit_quit, Qt); 1113 specbind (Qinhibit_quit, Qt);
1147 return (unbind_to (speccount, Fassoc (key, list))); 1114 return (unbind_to (speccount, Fassoc (key, list)));
1148 } 1115 }
1149 1116
1150 DEFUN ("assq", Fassq, Sassq, 2, 2, 0 /* 1117 DEFUN ("assq", Fassq, 2, 2, 0, /*
1151 Return non-nil if KEY is `eq' to the car of an element of LIST. 1118 Return non-nil if KEY is `eq' to the car of an element of LIST.
1152 The value is actually the element of LIST whose car is KEY. 1119 The value is actually the element of LIST whose car is KEY.
1153 Elements of LIST that are not conses are ignored. 1120 Elements of LIST that are not conses are ignored.
1154 */ ) 1121 */
1155 (key, list) 1122 (key, list))
1156 Lisp_Object key;
1157 Lisp_Object list;
1158 { 1123 {
1159 REGISTER Lisp_Object tail, elt, tem; 1124 REGISTER Lisp_Object tail, elt, tem;
1160 for (tail = list; !NILP (tail); tail = Fcdr (tail)) 1125 for (tail = list; !NILP (tail); tail = Fcdr (tail))
1161 { 1126 {
1162 elt = Fcar (tail); 1127 elt = Fcar (tail);
1184 if (HACKEQ_UNSAFE (key, tem)) return elt; 1149 if (HACKEQ_UNSAFE (key, tem)) return elt;
1185 } 1150 }
1186 return Qnil; 1151 return Qnil;
1187 } 1152 }
1188 1153
1189 DEFUN ("rassoc", Frassoc, Srassoc, 2, 2, 0 /* 1154 DEFUN ("rassoc", Frassoc, 2, 2, 0, /*
1190 Return non-nil if KEY is `equal' to the cdr of an element of LIST. 1155 Return non-nil if KEY is `equal' to the cdr of an element of LIST.
1191 The value is actually the element of LIST whose cdr equals KEY. 1156 The value is actually the element of LIST whose cdr equals KEY.
1192 */ ) 1157 */
1193 (key, list) 1158 (key, list))
1194 Lisp_Object key;
1195 Lisp_Object list;
1196 { 1159 {
1197 REGISTER Lisp_Object tail; 1160 REGISTER Lisp_Object tail;
1198 for (tail = list; !NILP (tail); tail = Fcdr (tail)) 1161 for (tail = list; !NILP (tail); tail = Fcdr (tail))
1199 { 1162 {
1200 REGISTER Lisp_Object elt, tem; 1163 REGISTER Lisp_Object elt, tem;
1205 QUIT; 1168 QUIT;
1206 } 1169 }
1207 return Qnil; 1170 return Qnil;
1208 } 1171 }
1209 1172
1210 DEFUN ("rassq", Frassq, Srassq, 2, 2, 0 /* 1173 DEFUN ("rassq", Frassq, 2, 2, 0, /*
1211 Return non-nil if KEY is `eq' to the cdr of an element of LIST. 1174 Return non-nil if KEY is `eq' to the cdr of an element of LIST.
1212 The value is actually the element of LIST whose cdr is KEY. 1175 The value is actually the element of LIST whose cdr is KEY.
1213 */ ) 1176 */
1214 (key, list) 1177 (key, list))
1215 Lisp_Object key;
1216 Lisp_Object list;
1217 { 1178 {
1218 REGISTER Lisp_Object tail, elt, tem; 1179 REGISTER Lisp_Object tail, elt, tem;
1219 for (tail = list; !NILP (tail); tail = Fcdr (tail)) 1180 for (tail = list; !NILP (tail); tail = Fcdr (tail))
1220 { 1181 {
1221 elt = Fcar (tail); 1182 elt = Fcar (tail);
1240 } 1201 }
1241 return Qnil; 1202 return Qnil;
1242 } 1203 }
1243 1204
1244 1205
1245 DEFUN ("delete", Fdelete, Sdelete, 2, 2, 0 /* 1206 DEFUN ("delete", Fdelete, 2, 2, 0, /*
1246 Delete by side effect any occurrences of ELT as a member of LIST. 1207 Delete by side effect any occurrences of ELT as a member of LIST.
1247 The modified LIST is returned. Comparison is done with `equal'. 1208 The modified LIST is returned. Comparison is done with `equal'.
1248 If the first member of LIST is ELT, there is no way to remove it by side 1209 If the first member of LIST is ELT, there is no way to remove it by side
1249 effect; therefore, write `(setq foo (delete element foo))' to be sure 1210 effect; therefore, write `(setq foo (delete element foo))' to be sure
1250 of changing the value of `foo'. 1211 of changing the value of `foo'.
1251 */ ) 1212 */
1252 (elt, list) 1213 (elt, list))
1253 Lisp_Object elt;
1254 Lisp_Object list;
1255 { 1214 {
1256 REGISTER Lisp_Object tail, prev; 1215 REGISTER Lisp_Object tail, prev;
1257 1216
1258 tail = list; 1217 tail = list;
1259 prev = Qnil; 1218 prev = Qnil;
1272 QUIT; 1231 QUIT;
1273 } 1232 }
1274 return list; 1233 return list;
1275 } 1234 }
1276 1235
1277 DEFUN ("delq", Fdelq, Sdelq, 2, 2, 0 /* 1236 DEFUN ("delq", Fdelq, 2, 2, 0, /*
1278 Delete by side effect any occurrences of ELT as a member of LIST. 1237 Delete by side effect any occurrences of ELT as a member of LIST.
1279 The modified LIST is returned. Comparison is done with `eq'. 1238 The modified LIST is returned. Comparison is done with `eq'.
1280 If the first member of LIST is ELT, there is no way to remove it by side 1239 If the first member of LIST is ELT, there is no way to remove it by side
1281 effect; therefore, write `(setq foo (delq element foo))' to be sure of 1240 effect; therefore, write `(setq foo (delq element foo))' to be sure of
1282 changing the value of `foo'. 1241 changing the value of `foo'.
1283 */ ) 1242 */
1284 (elt, list) 1243 (elt, list))
1285 Lisp_Object elt;
1286 Lisp_Object list;
1287 { 1244 {
1288 REGISTER Lisp_Object tail, prev; 1245 REGISTER Lisp_Object tail, prev;
1289 REGISTER Lisp_Object tem; 1246 REGISTER Lisp_Object tem;
1290 1247
1291 tail = list; 1248 tail = list;
1369 free_cons (XCONS (cons_to_free)); 1326 free_cons (XCONS (cons_to_free));
1370 } 1327 }
1371 return list; 1328 return list;
1372 } 1329 }
1373 1330
1374 DEFUN ("remassoc", Fremassoc, Sremassoc, 2, 2, 0 /* 1331 DEFUN ("remassoc", Fremassoc, 2, 2, 0, /*
1375 Delete by side effect any elements of LIST whose car is `equal' to KEY. 1332 Delete by side effect any elements of LIST whose car is `equal' to KEY.
1376 The modified LIST is returned. If the first member of LIST has a car 1333 The modified LIST is returned. If the first member of LIST has a car
1377 that is `equal' to KEY, there is no way to remove it by side effect; 1334 that is `equal' to KEY, there is no way to remove it by side effect;
1378 therefore, write `(setq foo (remassoc key foo))' to be sure of changing 1335 therefore, write `(setq foo (remassoc key foo))' to be sure of changing
1379 the value of `foo'. 1336 the value of `foo'.
1380 */ ) 1337 */
1381 (key, list) 1338 (key, list))
1382 Lisp_Object key;
1383 Lisp_Object list;
1384 { 1339 {
1385 REGISTER Lisp_Object tail, prev; 1340 REGISTER Lisp_Object tail, prev;
1386 1341
1387 tail = list; 1342 tail = list;
1388 prev = Qnil; 1343 prev = Qnil;
1410 int speccount = specpdl_depth (); 1365 int speccount = specpdl_depth ();
1411 specbind (Qinhibit_quit, Qt); 1366 specbind (Qinhibit_quit, Qt);
1412 return (unbind_to (speccount, Fremassoc (key, list))); 1367 return (unbind_to (speccount, Fremassoc (key, list)));
1413 } 1368 }
1414 1369
1415 DEFUN ("remassq", Fremassq, Sremassq, 2, 2, 0 /* 1370 DEFUN ("remassq", Fremassq, 2, 2, 0, /*
1416 Delete by side effect any elements of LIST whose car is `eq' to KEY. 1371 Delete by side effect any elements of LIST whose car is `eq' to KEY.
1417 The modified LIST is returned. If the first member of LIST has a car 1372 The modified LIST is returned. If the first member of LIST has a car
1418 that is `eq' to KEY, there is no way to remove it by side effect; 1373 that is `eq' to KEY, there is no way to remove it by side effect;
1419 therefore, write `(setq foo (remassq key foo))' to be sure of changing 1374 therefore, write `(setq foo (remassq key foo))' to be sure of changing
1420 the value of `foo'. 1375 the value of `foo'.
1421 */ ) 1376 */
1422 (key, list) 1377 (key, list))
1423 Lisp_Object key;
1424 Lisp_Object list;
1425 { 1378 {
1426 REGISTER Lisp_Object tail, prev; 1379 REGISTER Lisp_Object tail, prev;
1427 1380
1428 tail = list; 1381 tail = list;
1429 prev = Qnil; 1382 prev = Qnil;
1470 tail = XCDR (tail); 1423 tail = XCDR (tail);
1471 } 1424 }
1472 return list; 1425 return list;
1473 } 1426 }
1474 1427
1475 DEFUN ("remrassoc", Fremrassoc, Sremrassoc, 2, 2, 0 /* 1428 DEFUN ("remrassoc", Fremrassoc, 2, 2, 0, /*
1476 Delete by side effect any elements of LIST whose cdr is `equal' to VALUE. 1429 Delete by side effect any elements of LIST whose cdr is `equal' to VALUE.
1477 The modified LIST is returned. If the first member of LIST has a car 1430 The modified LIST is returned. If the first member of LIST has a car
1478 that is `equal' to VALUE, there is no way to remove it by side effect; 1431 that is `equal' to VALUE, there is no way to remove it by side effect;
1479 therefore, write `(setq foo (remrassoc value foo))' to be sure of changing 1432 therefore, write `(setq foo (remrassoc value foo))' to be sure of changing
1480 the value of `foo'. 1433 the value of `foo'.
1481 */ ) 1434 */
1482 (value, list) 1435 (value, list))
1483 Lisp_Object value;
1484 Lisp_Object list;
1485 { 1436 {
1486 REGISTER Lisp_Object tail, prev; 1437 REGISTER Lisp_Object tail, prev;
1487 1438
1488 tail = list; 1439 tail = list;
1489 prev = Qnil; 1440 prev = Qnil;
1503 QUIT; 1454 QUIT;
1504 } 1455 }
1505 return list; 1456 return list;
1506 } 1457 }
1507 1458
1508 DEFUN ("remrassq", Fremrassq, Sremrassq, 2, 2, 0 /* 1459 DEFUN ("remrassq", Fremrassq, 2, 2, 0, /*
1509 Delete by side effect any elements of LIST whose cdr is `eq' to VALUE. 1460 Delete by side effect any elements of LIST whose cdr is `eq' to VALUE.
1510 The modified LIST is returned. If the first member of LIST has a car 1461 The modified LIST is returned. If the first member of LIST has a car
1511 that is `eq' to VALUE, there is no way to remove it by side effect; 1462 that is `eq' to VALUE, there is no way to remove it by side effect;
1512 therefore, write `(setq foo (remrassq value foo))' to be sure of changing 1463 therefore, write `(setq foo (remrassq value foo))' to be sure of changing
1513 the value of `foo'. 1464 the value of `foo'.
1514 */ ) 1465 */
1515 (value, list) 1466 (value, list))
1516 Lisp_Object value;
1517 Lisp_Object list;
1518 { 1467 {
1519 REGISTER Lisp_Object tail, prev; 1468 REGISTER Lisp_Object tail, prev;
1520 1469
1521 tail = list; 1470 tail = list;
1522 prev = Qnil; 1471 prev = Qnil;
1563 tail = XCDR (tail); 1512 tail = XCDR (tail);
1564 } 1513 }
1565 return list; 1514 return list;
1566 } 1515 }
1567 1516
1568 DEFUN ("nreverse", Fnreverse, Snreverse, 1, 1, 0 /* 1517 DEFUN ("nreverse", Fnreverse, 1, 1, 0, /*
1569 Reverse LIST by modifying cdr pointers. 1518 Reverse LIST by modifying cdr pointers.
1570 Returns the beginning of the reversed list. 1519 Returns the beginning of the reversed list.
1571 */ ) 1520 */
1572 (list) 1521 (list))
1573 Lisp_Object list;
1574 { 1522 {
1575 Lisp_Object prev, tail, next; 1523 Lisp_Object prev, tail, next;
1576 struct gcpro gcpro1, gcpro2; 1524 struct gcpro gcpro1, gcpro2;
1577 1525
1578 /* We gcpro our args; see `nconc' */ 1526 /* We gcpro our args; see `nconc' */
1589 } 1537 }
1590 UNGCPRO; 1538 UNGCPRO;
1591 return prev; 1539 return prev;
1592 } 1540 }
1593 1541
1594 DEFUN ("reverse", Freverse, Sreverse, 1, 1, 0 /* 1542 DEFUN ("reverse", Freverse, 1, 1, 0, /*
1595 Reverse LIST, copying. Returns the beginning of the reversed list. 1543 Reverse LIST, copying. Returns the beginning of the reversed list.
1596 See also the function `nreverse', which is used more often. 1544 See also the function `nreverse', which is used more often.
1597 */ ) 1545 */
1598 (list) 1546 (list))
1599 Lisp_Object list;
1600 { 1547 {
1601 Lisp_Object length; 1548 Lisp_Object length;
1602 Lisp_Object *vec; 1549 Lisp_Object *vec;
1603 Lisp_Object tail; 1550 Lisp_Object tail;
1604 REGISTER int i; 1551 REGISTER int i;
1666 return -1; 1613 return -1;
1667 else 1614 else
1668 return 1; 1615 return 1;
1669 } 1616 }
1670 1617
1671 DEFUN ("sort", Fsort, Ssort, 2, 2, 0 /* 1618 DEFUN ("sort", Fsort, 2, 2, 0, /*
1672 Sort LIST, stably, comparing elements using PREDICATE. 1619 Sort LIST, stably, comparing elements using PREDICATE.
1673 Returns the sorted list. LIST is modified by side effects. 1620 Returns the sorted list. LIST is modified by side effects.
1674 PREDICATE is called with two elements of LIST, and should return T 1621 PREDICATE is called with two elements of LIST, and should return T
1675 if the first element is \"less\" than the second. 1622 if the first element is \"less\" than the second.
1676 */ ) 1623 */
1677 (list, pred) 1624 (list, pred))
1678 Lisp_Object list, pred;
1679 { 1625 {
1680 return list_sort (list, pred, merge_pred_function); 1626 return list_sort (list, pred, merge_pred_function);
1681 } 1627 }
1682 1628
1683 Lisp_Object 1629 Lisp_Object
1834 1780
1835 MISMATCH: 1781 MISMATCH:
1836 return 1; 1782 return 1;
1837 } 1783 }
1838 1784
1839 DEFUN ("plists-eq", Fplists_eq, Splists_eq, 2, 3, 0 /* 1785 DEFUN ("plists-eq", Fplists_eq, 2, 3, 0, /*
1840 Return non-nil if property lists A and B are `eq'. 1786 Return non-nil if property lists A and B are `eq'.
1841 A property list is an alternating list of keywords and values. 1787 A property list is an alternating list of keywords and values.
1842 This function does order-insensitive comparisons of the property lists: 1788 This function does order-insensitive comparisons of the property lists:
1843 For example, the property lists '(a 1 b 2) and '(b 2 a 1) are equal. 1789 For example, the property lists '(a 1 b 2) and '(b 2 a 1) are equal.
1844 Comparison between values is done using `eq'. See also `plists-equal'. 1790 Comparison between values is done using `eq'. See also `plists-equal'.
1845 If optional arg NIL-MEANS-NOT-PRESENT is non-nil, then a property with 1791 If optional arg NIL-MEANS-NOT-PRESENT is non-nil, then a property with
1846 a nil value is ignored. This feature is a virus that has infected 1792 a nil value is ignored. This feature is a virus that has infected
1847 old Lisp implementations, but should not be used except for backward 1793 old Lisp implementations, but should not be used except for backward
1848 compatibility. 1794 compatibility.
1849 */ ) 1795 */
1850 (a, b, nil_means_not_present) 1796 (a, b, nil_means_not_present))
1851 Lisp_Object a, b, nil_means_not_present;
1852 { 1797 {
1853 return (plists_differ (a, b, !NILP (nil_means_not_present), 0, -1) 1798 return (plists_differ (a, b, !NILP (nil_means_not_present), 0, -1)
1854 ? Qnil : Qt); 1799 ? Qnil : Qt);
1855 } 1800 }
1856 1801
1857 DEFUN ("plists-equal", Fplists_equal, Splists_equal, 2, 3, 0 /* 1802 DEFUN ("plists-equal", Fplists_equal, 2, 3, 0, /*
1858 Return non-nil if property lists A and B are `equal'. 1803 Return non-nil if property lists A and B are `equal'.
1859 A property list is an alternating list of keywords and values. This 1804 A property list is an alternating list of keywords and values. This
1860 function does order-insensitive comparisons of the property lists: For 1805 function does order-insensitive comparisons of the property lists: For
1861 example, the property lists '(a 1 b 2) and '(b 2 a 1) are equal. 1806 example, the property lists '(a 1 b 2) and '(b 2 a 1) are equal.
1862 Comparison between values is done using `equal'. See also `plists-eq'. 1807 Comparison between values is done using `equal'. See also `plists-eq'.
1863 If optional arg NIL-MEANS-NOT-PRESENT is non-nil, then a property with 1808 If optional arg NIL-MEANS-NOT-PRESENT is non-nil, then a property with
1864 a nil value is ignored. This feature is a virus that has infected 1809 a nil value is ignored. This feature is a virus that has infected
1865 old Lisp implementations, but should not be used except for backward 1810 old Lisp implementations, but should not be used except for backward
1866 compatibility. 1811 compatibility.
1867 */ ) 1812 */
1868 (a, b, nil_means_not_present) 1813 (a, b, nil_means_not_present))
1869 Lisp_Object a, b, nil_means_not_present;
1870 { 1814 {
1871 return (plists_differ (a, b, !NILP (nil_means_not_present), 0, 1) 1815 return (plists_differ (a, b, !NILP (nil_means_not_present), 0, 1)
1872 ? Qnil : Qt); 1816 ? Qnil : Qt);
1873 } 1817 }
1874 1818
1875 1819
1876 DEFUN ("lax-plists-eq", Flax_plists_eq, Slax_plists_eq, 2, 3, 0 /* 1820 DEFUN ("lax-plists-eq", Flax_plists_eq, 2, 3, 0, /*
1877 Return non-nil if lax property lists A and B are `eq'. 1821 Return non-nil if lax property lists A and B are `eq'.
1878 A property list is an alternating list of keywords and values. 1822 A property list is an alternating list of keywords and values.
1879 This function does order-insensitive comparisons of the property lists: 1823 This function does order-insensitive comparisons of the property lists:
1880 For example, the property lists '(a 1 b 2) and '(b 2 a 1) are equal. 1824 For example, the property lists '(a 1 b 2) and '(b 2 a 1) are equal.
1881 Comparison between values is done using `eq'. See also `plists-equal'. 1825 Comparison between values is done using `eq'. See also `plists-equal'.
1883 keywords is done using `equal' instead of `eq'. 1827 keywords is done using `equal' instead of `eq'.
1884 If optional arg NIL-MEANS-NOT-PRESENT is non-nil, then a property with 1828 If optional arg NIL-MEANS-NOT-PRESENT is non-nil, then a property with
1885 a nil value is ignored. This feature is a virus that has infected 1829 a nil value is ignored. This feature is a virus that has infected
1886 old Lisp implementations, but should not be used except for backward 1830 old Lisp implementations, but should not be used except for backward
1887 compatibility. 1831 compatibility.
1888 */ ) 1832 */
1889 (a, b, nil_means_not_present) 1833 (a, b, nil_means_not_present))
1890 Lisp_Object a, b, nil_means_not_present;
1891 { 1834 {
1892 return (plists_differ (a, b, !NILP (nil_means_not_present), 1, -1) 1835 return (plists_differ (a, b, !NILP (nil_means_not_present), 1, -1)
1893 ? Qnil : Qt); 1836 ? Qnil : Qt);
1894 } 1837 }
1895 1838
1896 DEFUN ("lax-plists-equal", Flax_plists_equal, Slax_plists_equal, 2, 3, 0 /* 1839 DEFUN ("lax-plists-equal", Flax_plists_equal, 2, 3, 0, /*
1897 Return non-nil if lax property lists A and B are `equal'. 1840 Return non-nil if lax property lists A and B are `equal'.
1898 A property list is an alternating list of keywords and values. This 1841 A property list is an alternating list of keywords and values. This
1899 function does order-insensitive comparisons of the property lists: For 1842 function does order-insensitive comparisons of the property lists: For
1900 example, the property lists '(a 1 b 2) and '(b 2 a 1) are equal. 1843 example, the property lists '(a 1 b 2) and '(b 2 a 1) are equal.
1901 Comparison between values is done using `equal'. See also `plists-eq'. 1844 Comparison between values is done using `equal'. See also `plists-eq'.
1903 keywords is done using `equal' instead of `eq'. 1846 keywords is done using `equal' instead of `eq'.
1904 If optional arg NIL-MEANS-NOT-PRESENT is non-nil, then a property with 1847 If optional arg NIL-MEANS-NOT-PRESENT is non-nil, then a property with
1905 a nil value is ignored. This feature is a virus that has infected 1848 a nil value is ignored. This feature is a virus that has infected
1906 old Lisp implementations, but should not be used except for backward 1849 old Lisp implementations, but should not be used except for backward
1907 compatibility. 1850 compatibility.
1908 */ ) 1851 */
1909 (a, b, nil_means_not_present) 1852 (a, b, nil_means_not_present))
1910 Lisp_Object a, b, nil_means_not_present;
1911 { 1853 {
1912 return (plists_differ (a, b, !NILP (nil_means_not_present), 1, 1) 1854 return (plists_differ (a, b, !NILP (nil_means_not_present), 1, 1)
1913 ? Qnil : Qt); 1855 ? Qnil : Qt);
1914 } 1856 }
1915 1857
2214 } 2156 }
2215 2157
2216 return 0; 2158 return 0;
2217 } 2159 }
2218 2160
2219 DEFUN ("plist-get", Fplist_get, Splist_get, 2, 3, 0 /* 2161 DEFUN ("plist-get", Fplist_get, 2, 3, 0, /*
2220 Extract a value from a property list. 2162 Extract a value from a property list.
2221 PLIST is a property list, which is a list of the form 2163 PLIST is a property list, which is a list of the form
2222 \(PROP1 VALUE1 PROP2 VALUE2...). This function returns the value 2164 \(PROP1 VALUE1 PROP2 VALUE2...). This function returns the value
2223 corresponding to the given PROP, or DEFAULT if PROP is not 2165 corresponding to the given PROP, or DEFAULT if PROP is not
2224 one of the properties on the list. 2166 one of the properties on the list.
2225 */ ) 2167 */
2226 (plist, prop, defalt) /* Cant spel in C */ 2168 (plist, prop, defalt)) /* Cant spel in C */
2227 Lisp_Object plist, prop, defalt;
2228 { 2169 {
2229 Lisp_Object val = external_plist_get (&plist, prop, 0, ERROR_ME); 2170 Lisp_Object val = external_plist_get (&plist, prop, 0, ERROR_ME);
2230 if (UNBOUNDP (val)) 2171 if (UNBOUNDP (val))
2231 return defalt; 2172 return defalt;
2232 return val; 2173 return val;
2233 } 2174 }
2234 2175
2235 DEFUN ("plist-put", Fplist_put, Splist_put, 3, 3, 0 /* 2176 DEFUN ("plist-put", Fplist_put, 3, 3, 0, /*
2236 Change value in PLIST of PROP to VAL. 2177 Change value in PLIST of PROP to VAL.
2237 PLIST is a property list, which is a list of the form \(PROP1 VALUE1 2178 PLIST is a property list, which is a list of the form \(PROP1 VALUE1
2238 PROP2 VALUE2 ...). PROP is usually a symbol and VAL is any object. 2179 PROP2 VALUE2 ...). PROP is usually a symbol and VAL is any object.
2239 If PROP is already a property on the list, its value is set to VAL, 2180 If PROP is already a property on the list, its value is set to VAL,
2240 otherwise the new PROP VAL pair is added. The new plist is returned; 2181 otherwise the new PROP VAL pair is added. The new plist is returned;
2241 use `(setq x (plist-put x prop val))' to be sure to use the new value. 2182 use `(setq x (plist-put x prop val))' to be sure to use the new value.
2242 The PLIST is modified by side effects. 2183 The PLIST is modified by side effects.
2243 */ ) 2184 */
2244 (plist, prop, val) 2185 (plist, prop, val))
2245 Lisp_Object plist, prop, val;
2246 { 2186 {
2247 external_plist_put (&plist, prop, val, 0, ERROR_ME); 2187 external_plist_put (&plist, prop, val, 0, ERROR_ME);
2248 return plist; 2188 return plist;
2249 } 2189 }
2250 2190
2251 DEFUN ("plist-remprop", Fplist_remprop, Splist_remprop, 2, 2, 0 /* 2191 DEFUN ("plist-remprop", Fplist_remprop, 2, 2, 0, /*
2252 Remove from PLIST the property PROP and its value. 2192 Remove from PLIST the property PROP and its value.
2253 PLIST is a property list, which is a list of the form \(PROP1 VALUE1 2193 PLIST is a property list, which is a list of the form \(PROP1 VALUE1
2254 PROP2 VALUE2 ...). PROP is usually a symbol. The new plist is 2194 PROP2 VALUE2 ...). PROP is usually a symbol. The new plist is
2255 returned; use `(setq x (plist-remprop x prop val))' to be sure to use 2195 returned; use `(setq x (plist-remprop x prop val))' to be sure to use
2256 the new value. The PLIST is modified by side effects. 2196 the new value. The PLIST is modified by side effects.
2257 */ ) 2197 */
2258 (plist, prop) 2198 (plist, prop))
2259 Lisp_Object plist, prop;
2260 { 2199 {
2261 external_remprop (&plist, prop, 0, ERROR_ME); 2200 external_remprop (&plist, prop, 0, ERROR_ME);
2262 return plist; 2201 return plist;
2263 } 2202 }
2264 2203
2265 DEFUN ("plist-member", Fplist_member, Splist_member, 2, 2, 0 /* 2204 DEFUN ("plist-member", Fplist_member, 2, 2, 0, /*
2266 Return t if PROP has a value specified in PLIST. 2205 Return t if PROP has a value specified in PLIST.
2267 */ ) 2206 */
2268 (plist, prop) 2207 (plist, prop))
2269 Lisp_Object plist, prop;
2270 { 2208 {
2271 return UNBOUNDP (Fplist_get (plist, prop, Qunbound)) ? Qnil : Qt; 2209 return UNBOUNDP (Fplist_get (plist, prop, Qunbound)) ? Qnil : Qt;
2272 } 2210 }
2273 2211
2274 DEFUN ("check-valid-plist", Fcheck_valid_plist, Scheck_valid_plist, 2212 DEFUN ("check-valid-plist", Fcheck_valid_plist, 1, 1, 0, /*
2275 1, 1, 0 /*
2276 Given a plist, signal an error if there is anything wrong with it. 2213 Given a plist, signal an error if there is anything wrong with it.
2277 This means that it's a malformed or circular plist. 2214 This means that it's a malformed or circular plist.
2278 */ ) 2215 */
2279 (plist) 2216 (plist))
2280 Lisp_Object plist;
2281 { 2217 {
2282 Lisp_Object *tortoise; 2218 Lisp_Object *tortoise;
2283 Lisp_Object *hare; 2219 Lisp_Object *hare;
2284 2220
2285 start_over: 2221 start_over:
2296 } 2232 }
2297 2233
2298 return Qnil; 2234 return Qnil;
2299 } 2235 }
2300 2236
2301 DEFUN ("valid-plist-p", Fvalid_plist_p, Svalid_plist_p, 2237 DEFUN ("valid-plist-p", Fvalid_plist_p, 1, 1, 0, /*
2302 1, 1, 0 /*
2303 Given a plist, return non-nil if its format is correct. 2238 Given a plist, return non-nil if its format is correct.
2304 If it returns nil, `check-valid-plist' will signal an error when given 2239 If it returns nil, `check-valid-plist' will signal an error when given
2305 the plist; that means it's a malformed or circular plist or has non-symbols 2240 the plist; that means it's a malformed or circular plist or has non-symbols
2306 as keywords. 2241 as keywords.
2307 */ ) 2242 */
2308 (plist) 2243 (plist))
2309 Lisp_Object plist;
2310 { 2244 {
2311 Lisp_Object *tortoise; 2245 Lisp_Object *tortoise;
2312 Lisp_Object *hare; 2246 Lisp_Object *hare;
2313 2247
2314 tortoise = &plist; 2248 tortoise = &plist;
2324 } 2258 }
2325 2259
2326 return Qt; 2260 return Qt;
2327 } 2261 }
2328 2262
2329 DEFUN ("canonicalize-plist", Fcanonicalize_plist, Scanonicalize_plist, 2263 DEFUN ("canonicalize-plist", Fcanonicalize_plist, 1, 2, 0, /*
2330 1, 2, 0 /*
2331 Destructively remove any duplicate entries from a plist. 2264 Destructively remove any duplicate entries from a plist.
2332 In such cases, the first entry applies. 2265 In such cases, the first entry applies.
2333 2266
2334 If optional arg NIL-MEANS-NOT-PRESENT is non-nil, then a property with 2267 If optional arg NIL-MEANS-NOT-PRESENT is non-nil, then a property with
2335 a nil value is removed. This feature is a virus that has infected 2268 a nil value is removed. This feature is a virus that has infected
2337 compatibility. 2270 compatibility.
2338 2271
2339 The new plist is returned. If NIL-MEANS-NOT-PRESENT is given, the 2272 The new plist is returned. If NIL-MEANS-NOT-PRESENT is given, the
2340 return value may not be EQ to the passed-in value, so make sure to 2273 return value may not be EQ to the passed-in value, so make sure to
2341 `setq' the value back into where it came from. 2274 `setq' the value back into where it came from.
2342 */ ) 2275 */
2343 (plist, nil_means_not_present) 2276 (plist, nil_means_not_present))
2344 Lisp_Object plist, nil_means_not_present;
2345 { 2277 {
2346 Lisp_Object head = plist; 2278 Lisp_Object head = plist;
2347 2279
2348 Fcheck_valid_plist (plist); 2280 Fcheck_valid_plist (plist);
2349 2281
2368 } 2300 }
2369 2301
2370 return head; 2302 return head;
2371 } 2303 }
2372 2304
2373 DEFUN ("lax-plist-get", Flax_plist_get, Slax_plist_get, 2, 3, 0 /* 2305 DEFUN ("lax-plist-get", Flax_plist_get, 2, 3, 0, /*
2374 Extract a value from a lax property list. 2306 Extract a value from a lax property list.
2375 2307
2376 LAX-PLIST is a lax property list, which is a list of the form \(PROP1 2308 LAX-PLIST is a lax property list, which is a list of the form \(PROP1
2377 VALUE1 PROP2 VALUE2...), where comparions between properties is done 2309 VALUE1 PROP2 VALUE2...), where comparions between properties is done
2378 using `equal' instead of `eq'. This function returns the value 2310 using `equal' instead of `eq'. This function returns the value
2379 corresponding to the given PROP, or DEFAULT if PROP is not one of the 2311 corresponding to the given PROP, or DEFAULT if PROP is not one of the
2380 properties on the list. 2312 properties on the list.
2381 */ ) 2313 */
2382 (lax_plist, prop, defalt) /* Cant spel in C */ 2314 (lax_plist, prop, defalt)) /* Cant spel in C */
2383 Lisp_Object lax_plist, prop, defalt;
2384 { 2315 {
2385 Lisp_Object val = external_plist_get (&lax_plist, prop, 1, ERROR_ME); 2316 Lisp_Object val = external_plist_get (&lax_plist, prop, 1, ERROR_ME);
2386 if (UNBOUNDP (val)) 2317 if (UNBOUNDP (val))
2387 return defalt; 2318 return defalt;
2388 return val; 2319 return val;
2389 } 2320 }
2390 2321
2391 DEFUN ("lax-plist-put", Flax_plist_put, Slax_plist_put, 3, 3, 0 /* 2322 DEFUN ("lax-plist-put", Flax_plist_put, 3, 3, 0, /*
2392 Change value in LAX-PLIST of PROP to VAL. 2323 Change value in LAX-PLIST of PROP to VAL.
2393 LAX-PLIST is a lax property list, which is a list of the form \(PROP1 2324 LAX-PLIST is a lax property list, which is a list of the form \(PROP1
2394 VALUE1 PROP2 VALUE2...), where comparions between properties is done 2325 VALUE1 PROP2 VALUE2...), where comparions between properties is done
2395 using `equal' instead of `eq'. PROP is usually a symbol and VAL is 2326 using `equal' instead of `eq'. PROP is usually a symbol and VAL is
2396 any object. If PROP is already a property on the list, its value is 2327 any object. If PROP is already a property on the list, its value is
2397 set to VAL, otherwise the new PROP VAL pair is added. The new plist 2328 set to VAL, otherwise the new PROP VAL pair is added. The new plist
2398 is returned; use `(setq x (lax-plist-put x prop val))' to be sure to 2329 is returned; use `(setq x (lax-plist-put x prop val))' to be sure to
2399 use the new value. The LAX-PLIST is modified by side effects. 2330 use the new value. The LAX-PLIST is modified by side effects.
2400 */ ) 2331 */
2401 (lax_plist, prop, val) 2332 (lax_plist, prop, val))
2402 Lisp_Object lax_plist, prop, val;
2403 { 2333 {
2404 external_plist_put (&lax_plist, prop, val, 1, ERROR_ME); 2334 external_plist_put (&lax_plist, prop, val, 1, ERROR_ME);
2405 return lax_plist; 2335 return lax_plist;
2406 } 2336 }
2407 2337
2408 DEFUN ("lax-plist-remprop", Flax_plist_remprop, Slax_plist_remprop, 2, 2, 0 /* 2338 DEFUN ("lax-plist-remprop", Flax_plist_remprop, 2, 2, 0, /*
2409 Remove from LAX-PLIST the property PROP and its value. 2339 Remove from LAX-PLIST the property PROP and its value.
2410 LAX-PLIST is a lax property list, which is a list of the form \(PROP1 2340 LAX-PLIST is a lax property list, which is a list of the form \(PROP1
2411 VALUE1 PROP2 VALUE2...), where comparions between properties is done 2341 VALUE1 PROP2 VALUE2...), where comparions between properties is done
2412 using `equal' instead of `eq'. PROP is usually a symbol. The new 2342 using `equal' instead of `eq'. PROP is usually a symbol. The new
2413 plist is returned; use `(setq x (lax-plist-remprop x prop val))' to be 2343 plist is returned; use `(setq x (lax-plist-remprop x prop val))' to be
2414 sure to use the new value. The LAX-PLIST is modified by side effects. 2344 sure to use the new value. The LAX-PLIST is modified by side effects.
2415 */ ) 2345 */
2416 (lax_plist, prop) 2346 (lax_plist, prop))
2417 Lisp_Object lax_plist, prop;
2418 { 2347 {
2419 external_remprop (&lax_plist, prop, 1, ERROR_ME); 2348 external_remprop (&lax_plist, prop, 1, ERROR_ME);
2420 return lax_plist; 2349 return lax_plist;
2421 } 2350 }
2422 2351
2423 DEFUN ("lax-plist-member", Flax_plist_member, Slax_plist_member, 2, 2, 0 /* 2352 DEFUN ("lax-plist-member", Flax_plist_member, 2, 2, 0, /*
2424 Return t if PROP has a value specified in LAX-PLIST. 2353 Return t if PROP has a value specified in LAX-PLIST.
2425 LAX-PLIST is a lax property list, which is a list of the form \(PROP1 2354 LAX-PLIST is a lax property list, which is a list of the form \(PROP1
2426 VALUE1 PROP2 VALUE2...), where comparions between properties is done 2355 VALUE1 PROP2 VALUE2...), where comparions between properties is done
2427 using `equal' instead of `eq'. 2356 using `equal' instead of `eq'.
2428 */ ) 2357 */
2429 (lax_plist, prop) 2358 (lax_plist, prop))
2430 Lisp_Object lax_plist, prop;
2431 { 2359 {
2432 return UNBOUNDP (Flax_plist_get (lax_plist, prop, Qunbound)) ? Qnil : Qt; 2360 return UNBOUNDP (Flax_plist_get (lax_plist, prop, Qunbound)) ? Qnil : Qt;
2433 } 2361 }
2434 2362
2435 DEFUN ("canonicalize-lax-plist", Fcanonicalize_lax_plist, 2363 DEFUN ("canonicalize-lax-plist", Fcanonicalize_lax_plist, 1, 2, 0, /*
2436 Scanonicalize_lax_plist, 1, 2, 0 /*
2437 Destructively remove any duplicate entries from a lax plist. 2364 Destructively remove any duplicate entries from a lax plist.
2438 In such cases, the first entry applies. 2365 In such cases, the first entry applies.
2439 2366
2440 If optional arg NIL-MEANS-NOT-PRESENT is non-nil, then a property with 2367 If optional arg NIL-MEANS-NOT-PRESENT is non-nil, then a property with
2441 a nil value is removed. This feature is a virus that has infected 2368 a nil value is removed. This feature is a virus that has infected
2443 compatibility. 2370 compatibility.
2444 2371
2445 The new plist is returned. If NIL-MEANS-NOT-PRESENT is given, the 2372 The new plist is returned. If NIL-MEANS-NOT-PRESENT is given, the
2446 return value may not be EQ to the passed-in value, so make sure to 2373 return value may not be EQ to the passed-in value, so make sure to
2447 `setq' the value back into where it came from. 2374 `setq' the value back into where it came from.
2448 */ ) 2375 */
2449 (lax_plist, nil_means_not_present) 2376 (lax_plist, nil_means_not_present))
2450 Lisp_Object lax_plist, nil_means_not_present;
2451 { 2377 {
2452 Lisp_Object head = lax_plist; 2378 Lisp_Object head = lax_plist;
2453 2379
2454 Fcheck_valid_plist (lax_plist); 2380 Fcheck_valid_plist (lax_plist);
2455 2381
2476 return head; 2402 return head;
2477 } 2403 }
2478 2404
2479 /* In C because the frame props stuff uses it */ 2405 /* In C because the frame props stuff uses it */
2480 2406
2481 DEFUN ("destructive-alist-to-plist", Fdestructive_alist_to_plist, 2407 DEFUN ("destructive-alist-to-plist", Fdestructive_alist_to_plist, 1, 1, 0, /*
2482 Sdestructive_alist_to_plist, 1, 1, 0 /*
2483 Convert association list ALIST into the equivalent property-list form. 2408 Convert association list ALIST into the equivalent property-list form.
2484 The plist is returned. This converts from 2409 The plist is returned. This converts from
2485 2410
2486 \((a . 1) (b . 2) (c . 3)) 2411 \((a . 1) (b . 2) (c . 3))
2487 2412
2489 2414
2490 \(a 1 b 2 c 3) 2415 \(a 1 b 2 c 3)
2491 2416
2492 The original alist is destroyed in the process of constructing the plist. 2417 The original alist is destroyed in the process of constructing the plist.
2493 See also `alist-to-plist'. 2418 See also `alist-to-plist'.
2494 */ ) 2419 */
2495 (alist) 2420 (alist))
2496 Lisp_Object alist;
2497 { 2421 {
2498 Lisp_Object head = alist; 2422 Lisp_Object head = alist;
2499 while (!NILP (alist)) 2423 while (!NILP (alist))
2500 { 2424 {
2501 /* remember the alist element. */ 2425 /* remember the alist element. */
2585 string_plist (struct Lisp_String *s) 2509 string_plist (struct Lisp_String *s)
2586 { 2510 {
2587 return *string_plist_ptr (s); 2511 return *string_plist_ptr (s);
2588 } 2512 }
2589 2513
2590 DEFUN ("get", Fget, Sget, 2, 3, 0 /* 2514 DEFUN ("get", Fget, 2, 3, 0, /*
2591 Return the value of OBJECT's PROPNAME property. 2515 Return the value of OBJECT's PROPNAME property.
2592 This is the last VALUE stored with `(put OBJECT PROPNAME VALUE)'. 2516 This is the last VALUE stored with `(put OBJECT PROPNAME VALUE)'.
2593 If there is no such property, return optional third arg DEFAULT 2517 If there is no such property, return optional third arg DEFAULT
2594 (which defaults to `nil'). OBJECT can be a symbol, face, extent, 2518 (which defaults to `nil'). OBJECT can be a symbol, face, extent,
2595 or string. See also `put', `remprop', and `object-plist'. 2519 or string. See also `put', `remprop', and `object-plist'.
2596 */ ) 2520 */
2597 (object, propname, defalt) /* Cant spel in C */ 2521 (object, propname, defalt)) /* Cant spel in C */
2598 Lisp_Object object, propname, defalt;
2599 { 2522 {
2600 Lisp_Object val; 2523 Lisp_Object val;
2601 2524
2602 /* Various places in emacs call Fget() and expect it not to quit, 2525 /* Various places in emacs call Fget() and expect it not to quit,
2603 so don't quit. */ 2526 so don't quit. */
2628 } 2551 }
2629 2552
2630 return val; 2553 return val;
2631 } 2554 }
2632 2555
2633 DEFUN ("put", Fput, Sput, 3, 3, 0 /* 2556 DEFUN ("put", Fput, 3, 3, 0, /*
2634 Store OBJECT's PROPNAME property with value VALUE. 2557 Store OBJECT's PROPNAME property with value VALUE.
2635 It can be retrieved with `(get OBJECT PROPNAME)'. OBJECT can be a 2558 It can be retrieved with `(get OBJECT PROPNAME)'. OBJECT can be a
2636 symbol, face, extent, or string. 2559 symbol, face, extent, or string.
2637 2560
2638 For a string, no properties currently have predefined meanings. 2561 For a string, no properties currently have predefined meanings.
2639 For the predefined properties for extents, see `set-extent-property'. 2562 For the predefined properties for extents, see `set-extent-property'.
2640 For the predefined properties for faces, see `set-face-property'. 2563 For the predefined properties for faces, see `set-face-property'.
2641 2564
2642 See also `get', `remprop', and `object-plist'. 2565 See also `get', `remprop', and `object-plist'.
2643 */ ) 2566 */
2644 (object, propname, value) 2567 (object, propname, value))
2645 Lisp_Object object;
2646 Lisp_Object propname;
2647 Lisp_Object value;
2648 { 2568 {
2649 CHECK_SYMBOL (propname); 2569 CHECK_SYMBOL (propname);
2650 CHECK_IMPURE (object); 2570 CHECK_IMPURE (object);
2651 2571
2652 if (SYMBOLP (object)) 2572 if (SYMBOLP (object))
2678 pure_put (Lisp_Object sym, Lisp_Object prop, Lisp_Object val) 2598 pure_put (Lisp_Object sym, Lisp_Object prop, Lisp_Object val)
2679 { 2599 {
2680 Fput (sym, prop, Fpurecopy (val)); 2600 Fput (sym, prop, Fpurecopy (val));
2681 } 2601 }
2682 2602
2683 DEFUN ("remprop", Fremprop, Sremprop, 2, 2, 0 /* 2603 DEFUN ("remprop", Fremprop, 2, 2, 0, /*
2684 Remove from OBJECT's property list the property PROPNAME and its 2604 Remove from OBJECT's property list the property PROPNAME and its
2685 value. OBJECT can be a symbol, face, extent, or string. Returns 2605 value. OBJECT can be a symbol, face, extent, or string. Returns
2686 non-nil if the property list was actually changed (i.e. if PROPNAME 2606 non-nil if the property list was actually changed (i.e. if PROPNAME
2687 was present in the property list). See also `get', `put', and 2607 was present in the property list). See also `get', `put', and
2688 `object-plist'. 2608 `object-plist'.
2689 */ ) 2609 */
2690 (object, propname) 2610 (object, propname))
2691 Lisp_Object object, propname;
2692 { 2611 {
2693 int retval = 0; 2612 int retval = 0;
2694 2613
2695 CHECK_SYMBOL (propname); 2614 CHECK_SYMBOL (propname);
2696 CHECK_IMPURE (object); 2615 CHECK_IMPURE (object);
2720 } 2639 }
2721 2640
2722 return retval ? Qt : Qnil; 2641 return retval ? Qt : Qnil;
2723 } 2642 }
2724 2643
2725 DEFUN ("object-plist", Fobject_plist, Sobject_plist, 1, 1, 0 /* 2644 DEFUN ("object-plist", Fobject_plist, 1, 1, 0, /*
2726 Return a property list of OBJECT's props. 2645 Return a property list of OBJECT's props.
2727 For a symbol this is equivalent to `symbol-plist'. 2646 For a symbol this is equivalent to `symbol-plist'.
2728 Do not modify the property list directly; this may or may not have 2647 Do not modify the property list directly; this may or may not have
2729 the desired effects. (In particular, for a property with a special 2648 the desired effects. (In particular, for a property with a special
2730 interpretation, this will probably have no effect at all.) 2649 interpretation, this will probably have no effect at all.)
2731 */ ) 2650 */
2732 (object) 2651 (object))
2733 Lisp_Object object;
2734 { 2652 {
2735 if (SYMBOLP (object)) 2653 if (SYMBOLP (object))
2736 return Fsymbol_plist (object); 2654 return Fsymbol_plist (object);
2737 else if (STRINGP (object)) 2655 else if (STRINGP (object))
2738 return string_plist (XSTRING (object)); 2656 return string_plist (XSTRING (object));
2815 } 2733 }
2816 2734
2817 return (0); 2735 return (0);
2818 } 2736 }
2819 2737
2820 DEFUN ("equal", Fequal, Sequal, 2, 2, 0 /* 2738 DEFUN ("equal", Fequal, 2, 2, 0, /*
2821 T if two Lisp objects have similar structure and contents. 2739 T if two Lisp objects have similar structure and contents.
2822 They must have the same data type. 2740 They must have the same data type.
2823 Conses are compared by comparing the cars and the cdrs. 2741 Conses are compared by comparing the cars and the cdrs.
2824 Vectors and strings are compared element by element. 2742 Vectors and strings are compared element by element.
2825 Numbers are compared by value. Symbols must match exactly. 2743 Numbers are compared by value. Symbols must match exactly.
2826 */ ) 2744 */
2827 (o1, o2) 2745 (o1, o2))
2828 Lisp_Object o1, o2;
2829 { 2746 {
2830 return ((internal_equal (o1, o2, 0)) ? Qt : Qnil); 2747 return ((internal_equal (o1, o2, 0)) ? Qt : Qnil);
2831 } 2748 }
2832 2749
2833 2750
2834 DEFUN ("fillarray", Ffillarray, Sfillarray, 2, 2, 0 /* 2751 DEFUN ("fillarray", Ffillarray, 2, 2, 0, /*
2835 Store each element of ARRAY with ITEM. 2752 Store each element of ARRAY with ITEM.
2836 ARRAY is a vector, bit vector, or string. 2753 ARRAY is a vector, bit vector, or string.
2837 */ ) 2754 */
2838 (array, item) 2755 (array, item))
2839 Lisp_Object array, item;
2840 { 2756 {
2841 retry: 2757 retry:
2842 if (STRINGP (array)) 2758 if (STRINGP (array))
2843 { 2759 {
2844 Charcount size; 2760 Charcount size;
2892 args[0] = s1; 2808 args[0] = s1;
2893 args[1] = s2; 2809 args[1] = s2;
2894 return Fnconc (2, args); 2810 return Fnconc (2, args);
2895 } 2811 }
2896 2812
2897 DEFUN ("nconc", Fnconc, Snconc, 0, MANY, 0 /* 2813 DEFUN ("nconc", Fnconc, 0, MANY, 0, /*
2898 Concatenate any number of lists by altering them. 2814 Concatenate any number of lists by altering them.
2899 Only the last argument is not altered, and need not be a list. 2815 Only the last argument is not altered, and need not be a list.
2900 */ ) 2816 */
2901 (nargs, args) 2817 (int nargs, Lisp_Object *args))
2902 int nargs;
2903 Lisp_Object *args;
2904 { 2818 {
2905 int argnum; 2819 int argnum;
2906 Lisp_Object tail, tem, val; 2820 Lisp_Object tail, tem, val;
2907 struct gcpro gcpro1; 2821 struct gcpro gcpro1;
2908 2822
3022 } 2936 }
3023 2937
3024 UNGCPRO; 2938 UNGCPRO;
3025 } 2939 }
3026 2940
3027 DEFUN ("mapconcat", Fmapconcat, Smapconcat, 3, 3, 0 /* 2941 DEFUN ("mapconcat", Fmapconcat, 3, 3, 0, /*
3028 Apply FN to each element of SEQ, and concat the results as strings. 2942 Apply FN to each element of SEQ, and concat the results as strings.
3029 In between each pair of results, stick in SEP. 2943 In between each pair of results, stick in SEP.
3030 Thus, \" \" as SEP results in spaces between the values returned by FN. 2944 Thus, \" \" as SEP results in spaces between the values returned by FN.
3031 */ ) 2945 */
3032 (fn, seq, sep) 2946 (fn, seq, sep))
3033 Lisp_Object fn, seq, sep;
3034 { 2947 {
3035 int len = XINT (Flength (seq)); 2948 int len = XINT (Flength (seq));
3036 int nargs; 2949 int nargs;
3037 Lisp_Object *args; 2950 Lisp_Object *args;
3038 int i; 2951 int i;
3054 args[i] = sep; 2967 args[i] = sep;
3055 2968
3056 return Fconcat (nargs, args); 2969 return Fconcat (nargs, args);
3057 } 2970 }
3058 2971
3059 DEFUN ("mapcar", Fmapcar, Smapcar, 2, 2, 0 /* 2972 DEFUN ("mapcar", Fmapcar, 2, 2, 0, /*
3060 Apply FUNCTION to each element of SEQUENCE, and make a list of the results. 2973 Apply FUNCTION to each element of SEQUENCE, and make a list of the results.
3061 The result is a list just as long as SEQUENCE. 2974 The result is a list just as long as SEQUENCE.
3062 SEQUENCE may be a list, a vector, a bit vector, or a string. 2975 SEQUENCE may be a list, a vector, a bit vector, or a string.
3063 */ ) 2976 */
3064 (fn, seq) 2977 (fn, seq))
3065 Lisp_Object fn, seq;
3066 { 2978 {
3067 int len = XINT (Flength (seq)); 2979 int len = XINT (Flength (seq));
3068 Lisp_Object *args = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); 2980 Lisp_Object *args = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
3069 2981
3070 mapcar1 (len, args, fn, seq); 2982 mapcar1 (len, args, fn, seq);
3071 2983
3072 return Flist (len, args); 2984 return Flist (len, args);
3073 } 2985 }
3074 2986
3075 DEFUN ("mapc-internal", Fmapc_internal, Smapc_internal, 2, 2, 0 /* 2987 DEFUN ("mapc-internal", Fmapc_internal, 2, 2, 0, /*
3076 Apply FUNCTION to each element of SEQUENCE. 2988 Apply FUNCTION to each element of SEQUENCE.
3077 SEQUENCE may be a list, a vector, a bit vector, or a string. 2989 SEQUENCE may be a list, a vector, a bit vector, or a string.
3078 This function is like `mapcar' but does not accumulate the results, 2990 This function is like `mapcar' but does not accumulate the results,
3079 which is more efficient if you do not use the results. 2991 which is more efficient if you do not use the results.
3080 */ ) 2992 */
3081 (fn, seq) 2993 (fn, seq))
3082 Lisp_Object fn, seq;
3083 { 2994 {
3084 mapcar1 (XINT (Flength (seq)), 0, fn, seq); 2995 mapcar1 (XINT (Flength (seq)), 0, fn, seq);
3085 2996
3086 return Qnil; 2997 return Qnil;
3087 } 2998 }
3088 2999
3089 3000
3090 /* #### this function doesn't belong in this file! */ 3001 /* #### this function doesn't belong in this file! */
3091 3002
3092 DEFUN ("load-average", Fload_average, Sload_average, 0, 0, 0 /* 3003 DEFUN ("load-average", Fload_average, 0, 0, 0, /*
3093 Return list of 1 minute, 5 minute and 15 minute load averages. 3004 Return list of 1 minute, 5 minute and 15 minute load averages.
3094 Each of the three load averages is multiplied by 100, 3005 Each of the three load averages is multiplied by 100,
3095 then converted to integer. 3006 then converted to integer.
3096 3007
3097 If the 5-minute or 15-minute load averages are not available, return a 3008 If the 5-minute or 15-minute load averages are not available, return a
3098 shortened list, containing only those averages which are available. 3009 shortened list, containing only those averages which are available.
3099 3010
3100 On most systems, this won't work unless the emacs executable is installed 3011 On most systems, this won't work unless the emacs executable is installed
3101 as setgid kmem (assuming that /dev/kmem is in the group kmem). 3012 as setgid kmem (assuming that /dev/kmem is in the group kmem).
3102 */ ) 3013 */
3103 () 3014 ())
3104 { 3015 {
3105 double load_ave[10]; /* hey, just in case */ 3016 double load_ave[10]; /* hey, just in case */
3106 int loads = getloadavg (load_ave, 3); 3017 int loads = getloadavg (load_ave, 3);
3107 Lisp_Object ret; 3018 Lisp_Object ret;
3108 3019
3119 } 3030 }
3120 3031
3121 3032
3122 Lisp_Object Vfeatures; 3033 Lisp_Object Vfeatures;
3123 3034
3124 DEFUN ("featurep", Ffeaturep, Sfeaturep, 1, 1, 0 /* 3035 DEFUN ("featurep", Ffeaturep, 1, 1, 0, /*
3125 Return t if FEATURE is present in this Emacs. 3036 Return t if FEATURE is present in this Emacs.
3126 Use this to conditionalize execution of lisp code based on the 3037 Use this to conditionalize execution of lisp code based on the
3127 presence or absence of emacs or environment extensions. 3038 presence or absence of emacs or environment extensions.
3128 Use `provide' to declare that a feature is available. 3039 Use `provide' to declare that a feature is available.
3129 This function looks at the value of the variable `features'. 3040 This function looks at the value of the variable `features'.
3130 */ ) 3041 */
3131 (feature) 3042 (feature))
3132 Lisp_Object feature;
3133 { 3043 {
3134 CHECK_SYMBOL (feature); 3044 CHECK_SYMBOL (feature);
3135 return NILP (Fmemq (feature, Vfeatures)) ? Qnil : Qt; 3045 return NILP (Fmemq (feature, Vfeatures)) ? Qnil : Qt;
3136 } 3046 }
3137 3047
3138 DEFUN ("provide", Fprovide, Sprovide, 1, 1, 0 /* 3048 DEFUN ("provide", Fprovide, 1, 1, 0, /*
3139 Announce that FEATURE is a feature of the current Emacs. 3049 Announce that FEATURE is a feature of the current Emacs.
3140 This function updates the value of the variable `features'. 3050 This function updates the value of the variable `features'.
3141 */ ) 3051 */
3142 (feature) 3052 (feature))
3143 Lisp_Object feature;
3144 { 3053 {
3145 Lisp_Object tem; 3054 Lisp_Object tem;
3146 CHECK_SYMBOL (feature); 3055 CHECK_SYMBOL (feature);
3147 if (!NILP (Vautoload_queue)) 3056 if (!NILP (Vautoload_queue))
3148 Vautoload_queue = Fcons (Fcons (Vfeatures, Qnil), Vautoload_queue); 3057 Vautoload_queue = Fcons (Fcons (Vfeatures, Qnil), Vautoload_queue);
3151 Vfeatures = Fcons (feature, Vfeatures); 3060 Vfeatures = Fcons (feature, Vfeatures);
3152 LOADHIST_ATTACH (Fcons (Qprovide, feature)); 3061 LOADHIST_ATTACH (Fcons (Qprovide, feature));
3153 return feature; 3062 return feature;
3154 } 3063 }
3155 3064
3156 DEFUN ("require", Frequire, Srequire, 1, 2, 0 /* 3065 DEFUN ("require", Frequire, 1, 2, 0, /*
3157 If feature FEATURE is not loaded, load it from FILENAME. 3066 If feature FEATURE is not loaded, load it from FILENAME.
3158 If FEATURE is not a member of the list `features', then the feature 3067 If FEATURE is not a member of the list `features', then the feature
3159 is not loaded; so load the file FILENAME. 3068 is not loaded; so load the file FILENAME.
3160 If FILENAME is omitted, the printname of FEATURE is used as the file name. 3069 If FILENAME is omitted, the printname of FEATURE is used as the file name.
3161 */ ) 3070 */
3162 (feature, file_name) 3071 (feature, file_name))
3163 Lisp_Object feature, file_name;
3164 { 3072 {
3165 Lisp_Object tem; 3073 Lisp_Object tem;
3166 CHECK_SYMBOL (feature); 3074 CHECK_SYMBOL (feature);
3167 tem = Fmemq (feature, Vfeatures); 3075 tem = Fmemq (feature, Vfeatures);
3168 LOADHIST_ATTACH (Fcons (Qrequire, feature)); 3076 LOADHIST_ATTACH (Fcons (Qrequire, feature));
3198 { 3106 {
3199 defsymbol (&Qstring_lessp, "string-lessp"); 3107 defsymbol (&Qstring_lessp, "string-lessp");
3200 defsymbol (&Qidentity, "identity"); 3108 defsymbol (&Qidentity, "identity");
3201 defsymbol (&Qyes_or_no_p, "yes-or-no-p"); 3109 defsymbol (&Qyes_or_no_p, "yes-or-no-p");
3202 3110
3203 defsubr (&Sidentity); 3111 DEFSUBR (Fidentity);
3204 defsubr (&Srandom); 3112 DEFSUBR (Frandom);
3205 defsubr (&Slength); 3113 DEFSUBR (Flength);
3206 defsubr (&Ssafe_length); 3114 DEFSUBR (Fsafe_length);
3207 defsubr (&Sstring_equal); 3115 DEFSUBR (Fstring_equal);
3208 defsubr (&Sstring_lessp); 3116 DEFSUBR (Fstring_lessp);
3209 defsubr (&Sstring_modified_tick); 3117 DEFSUBR (Fstring_modified_tick);
3210 defsubr (&Sappend); 3118 DEFSUBR (Fappend);
3211 defsubr (&Sconcat); 3119 DEFSUBR (Fconcat);
3212 defsubr (&Svconcat); 3120 DEFSUBR (Fvconcat);
3213 defsubr (&Sbvconcat); 3121 DEFSUBR (Fbvconcat);
3214 defsubr (&Scopy_sequence); 3122 DEFSUBR (Fcopy_sequence);
3215 defsubr (&Scopy_alist); 3123 DEFSUBR (Fcopy_alist);
3216 defsubr (&Scopy_tree); 3124 DEFSUBR (Fcopy_tree);
3217 defsubr (&Ssubstring); 3125 DEFSUBR (Fsubstring);
3218 defsubr (&Ssubseq); 3126 DEFSUBR (Fsubseq);
3219 defsubr (&Snthcdr); 3127 DEFSUBR (Fnthcdr);
3220 defsubr (&Snth); 3128 DEFSUBR (Fnth);
3221 defsubr (&Selt); 3129 DEFSUBR (Felt);
3222 defsubr (&Smember); 3130 DEFSUBR (Fmember);
3223 defsubr (&Smemq); 3131 DEFSUBR (Fmemq);
3224 defsubr (&Sassoc); 3132 DEFSUBR (Fassoc);
3225 defsubr (&Sassq); 3133 DEFSUBR (Fassq);
3226 defsubr (&Srassoc); 3134 DEFSUBR (Frassoc);
3227 defsubr (&Srassq); 3135 DEFSUBR (Frassq);
3228 defsubr (&Sdelete); 3136 DEFSUBR (Fdelete);
3229 defsubr (&Sdelq); 3137 DEFSUBR (Fdelq);
3230 defsubr (&Sremassoc); 3138 DEFSUBR (Fremassoc);
3231 defsubr (&Sremassq); 3139 DEFSUBR (Fremassq);
3232 defsubr (&Sremrassoc); 3140 DEFSUBR (Fremrassoc);
3233 defsubr (&Sremrassq); 3141 DEFSUBR (Fremrassq);
3234 defsubr (&Snreverse); 3142 DEFSUBR (Fnreverse);
3235 defsubr (&Sreverse); 3143 DEFSUBR (Freverse);
3236 defsubr (&Ssort); 3144 DEFSUBR (Fsort);
3237 defsubr (&Splists_eq); 3145 DEFSUBR (Fplists_eq);
3238 defsubr (&Splists_equal); 3146 DEFSUBR (Fplists_equal);
3239 defsubr (&Slax_plists_eq); 3147 DEFSUBR (Flax_plists_eq);
3240 defsubr (&Slax_plists_equal); 3148 DEFSUBR (Flax_plists_equal);
3241 defsubr (&Splist_get); 3149 DEFSUBR (Fplist_get);
3242 defsubr (&Splist_put); 3150 DEFSUBR (Fplist_put);
3243 defsubr (&Splist_remprop); 3151 DEFSUBR (Fplist_remprop);
3244 defsubr (&Splist_member); 3152 DEFSUBR (Fplist_member);
3245 defsubr (&Scheck_valid_plist); 3153 DEFSUBR (Fcheck_valid_plist);
3246 defsubr (&Svalid_plist_p); 3154 DEFSUBR (Fvalid_plist_p);
3247 defsubr (&Scanonicalize_plist); 3155 DEFSUBR (Fcanonicalize_plist);
3248 defsubr (&Slax_plist_get); 3156 DEFSUBR (Flax_plist_get);
3249 defsubr (&Slax_plist_put); 3157 DEFSUBR (Flax_plist_put);
3250 defsubr (&Slax_plist_remprop); 3158 DEFSUBR (Flax_plist_remprop);
3251 defsubr (&Slax_plist_member); 3159 DEFSUBR (Flax_plist_member);
3252 defsubr (&Scanonicalize_lax_plist); 3160 DEFSUBR (Fcanonicalize_lax_plist);
3253 defsubr (&Sdestructive_alist_to_plist); 3161 DEFSUBR (Fdestructive_alist_to_plist);
3254 defsubr (&Sget); 3162 DEFSUBR (Fget);
3255 defsubr (&Sput); 3163 DEFSUBR (Fput);
3256 defsubr (&Sremprop); 3164 DEFSUBR (Fremprop);
3257 defsubr (&Sobject_plist); 3165 DEFSUBR (Fobject_plist);
3258 defsubr (&Sequal); 3166 DEFSUBR (Fequal);
3259 defsubr (&Sfillarray); 3167 DEFSUBR (Ffillarray);
3260 defsubr (&Snconc); 3168 DEFSUBR (Fnconc);
3261 defsubr (&Smapcar); 3169 DEFSUBR (Fmapcar);
3262 defsubr (&Smapc_internal); 3170 DEFSUBR (Fmapc_internal);
3263 defsubr (&Smapconcat); 3171 DEFSUBR (Fmapconcat);
3264 defsubr (&Sload_average); 3172 DEFSUBR (Fload_average);
3265 defsubr (&Sfeaturep); 3173 DEFSUBR (Ffeaturep);
3266 defsubr (&Srequire); 3174 DEFSUBR (Frequire);
3267 defsubr (&Sprovide); 3175 DEFSUBR (Fprovide);
3268 } 3176 }
3269 3177
3270 void 3178 void
3271 init_provide_once (void) 3179 init_provide_once (void)
3272 { 3180 {