comparison src/fns.c @ 276:6330739388db r21-0b36

Import from CVS: tag r21-0b36
author cvs
date Mon, 13 Aug 2007 10:30:37 +0200
parents ca9a9ec9c1c1
children 90d73dddcdc4
comparison
equal deleted inserted replaced
275:a68ae4439f57 276:6330739388db
882 TO may be nil or omitted; then the subsequence runs to the end of SEQ. 882 TO may be nil or omitted; then the subsequence runs to the end of SEQ.
883 If FROM or TO is negative, it counts from the end. 883 If FROM or TO is negative, it counts from the end.
884 The resulting subsequence is always the same type as the original 884 The resulting subsequence is always the same type as the original
885 sequence. 885 sequence.
886 If SEQ is a string, relevant parts of the string-extent-data are copied 886 If SEQ is a string, relevant parts of the string-extent-data are copied
887 in the new string. 887 to the new string.
888 */ 888 */
889 (seq, from, to)) 889 (seq, from, to))
890 { 890 {
891 int len, f, t; 891 int len, f, t;
892 892
898 check_losing_bytecode ("subseq", seq); 898 check_losing_bytecode ("subseq", seq);
899 seq = wrong_type_argument (Qsequencep, seq); 899 seq = wrong_type_argument (Qsequencep, seq);
900 } 900 }
901 901
902 len = XINT (Flength (seq)); 902 len = XINT (Flength (seq));
903
903 CHECK_INT (from); 904 CHECK_INT (from);
904 f = XINT (from); 905 f = XINT (from);
905 if (f < 0) 906 if (f < 0)
906 f = len + f; 907 f = len + f;
908
907 if (NILP (to)) 909 if (NILP (to))
908 t = len; 910 t = len;
909 else 911 else
910 { 912 {
911 CHECK_INT (to); 913 CHECK_INT (to);
927 for (i = f; i < t; i++) 929 for (i = f; i < t; i++)
928 out_elts[i - f] = in_elts[i]; 930 out_elts[i - f] = in_elts[i];
929 return result; 931 return result;
930 } 932 }
931 933
932 if (CONSP (seq)) 934 if (LISTP (seq))
933 { 935 {
934 Lisp_Object result = Qnil; 936 Lisp_Object result = Qnil;
935 int i; 937 int i;
936 938
937 seq = Fnthcdr (make_int (f), seq); 939 seq = Fnthcdr (make_int (f), seq);
3123 Lisp_Object val = args[argnum]; 3125 Lisp_Object val = args[argnum];
3124 if (CONSP (val)) 3126 if (CONSP (val))
3125 { 3127 {
3126 /* Found the first cons, which will be our return value. */ 3128 /* Found the first cons, which will be our return value. */
3127 Lisp_Object last = val; 3129 Lisp_Object last = val;
3128 3130
3129 for (argnum++; argnum < nargs; argnum++) 3131 for (argnum++; argnum < nargs; argnum++)
3130 { 3132 {
3131 Lisp_Object next = args[argnum]; 3133 Lisp_Object next = args[argnum];
3132 redo: 3134 redo:
3133 if (CONSP (next) || argnum == nargs -1) 3135 if (CONSP (next) || argnum == nargs -1)