comparison src/fns.c @ 169:15872534500d r20-3b11

Import from CVS: tag r20-3b11
author cvs
date Mon, 13 Aug 2007 09:46:53 +0200
parents 85ec50267440
children 8eaf7971accc
comparison
equal deleted inserted replaced
168:9851d5c6556e 169:15872534500d
190 check_losing_bytecode (CONST char *function, Lisp_Object seq) 190 check_losing_bytecode (CONST char *function, Lisp_Object seq)
191 { 191 {
192 if (COMPILED_FUNCTIONP (seq)) 192 if (COMPILED_FUNCTIONP (seq))
193 error_with_frob 193 error_with_frob
194 (seq, 194 (seq,
195 "As of 19.14, `%s' no longer works with compiled-function objects", 195 "As of 20.3, `%s' no longer works with compiled-function objects",
196 function); 196 function);
197 } 197 }
198 198
199 DEFUN ("length", Flength, 1, 1, 0, /* 199 DEFUN ("length", Flength, 1, 1, 0, /*
200 Return the length of vector, bit vector, list or string SEQUENCE. 200 Return the length of vector, bit vector, list or string SEQUENCE.
512 doesn't handle (copy-sequence '(a b . c)) and it's easier to redo this 512 doesn't handle (copy-sequence '(a b . c)) and it's easier to redo this
513 than to fix concat() without worrying about breaking other things. 513 than to fix concat() without worrying about breaking other things.
514 */ 514 */
515 if (CONSP (arg)) 515 if (CONSP (arg))
516 { 516 {
517 Lisp_Object rest = arg; 517 Lisp_Object head = Fcons (XCAR (arg), XCDR (arg));
518 Lisp_Object head, tail; 518 Lisp_Object tail = head;
519 tail = Qnil; 519
520 while (CONSP (rest)) 520 for (arg = XCDR (arg); CONSP (arg); arg = XCDR (arg))
521 { 521 {
522 Lisp_Object new = Fcons (XCAR (rest), XCDR (rest)); 522 XCDR (tail) = Fcons (XCAR (arg), XCDR (arg));
523 if (NILP (tail)) 523 tail = XCDR (tail);
524 head = tail = new;
525 else
526 XCDR (tail) = new, tail = new;
527 rest = XCDR (rest);
528 QUIT; 524 QUIT;
529 } 525 }
530 if (!NILP (tail))
531 XCDR (tail) = rest;
532 return head; 526 return head;
533 } 527 }
534 else if (STRINGP (arg)) 528 if (STRINGP (arg)) return concat (1, &arg, c_string, 0);
535 return concat (1, &arg, c_string, 0); 529 if (VECTORP (arg)) return concat (1, &arg, c_vector, 0);
536 else if (VECTORP (arg)) 530 if (BIT_VECTORP (arg)) return concat (1, &arg, c_bit_vector, 0);
537 return concat (1, &arg, c_vector, 0); 531
538 else if (BIT_VECTORP (arg)) 532 check_losing_bytecode ("copy-sequence", arg);
539 return concat (1, &arg, c_bit_vector, 0); 533 arg = wrong_type_argument (Qsequencep, arg);
540 else 534 goto again;
541 {
542 check_losing_bytecode ("copy-sequence", arg);
543 arg = wrong_type_argument (Qsequencep, arg);
544 goto again;
545 }
546 } 535 }
547 536
548 struct merge_string_extents_struct 537 struct merge_string_extents_struct
549 { 538 {
550 Lisp_Object string; 539 Lisp_Object string;