Mercurial > hg > xemacs-beta
comparison src/fns.c @ 5128:7be849cb8828 ben-lisp-object
merge
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sun, 07 Mar 2010 02:09:59 -0600 |
parents | a9c41067dd88 99f8ebc082d9 |
children | 2e528066e2fc |
comparison
equal
deleted
inserted
replaced
5127:a9c41067dd88 | 5128:7be849cb8828 |
---|---|
944 } | 944 } |
945 } | 945 } |
946 return arg; | 946 return arg; |
947 } | 947 } |
948 | 948 |
949 DEFUN ("substring", Fsubstring, 2, 3, 0, /* | |
950 Return the substring of STRING starting at START and ending before END. | |
951 END may be nil or omitted; then the substring runs to the end of STRING. | |
952 If START or END is negative, it counts from the end. | |
953 Relevant parts of the string-extent-data are copied to the new string. | |
954 */ | |
955 (string, start, end)) | |
956 { | |
957 Charcount ccstart, ccend; | |
958 Bytecount bstart, blen; | |
959 Lisp_Object val; | |
960 | |
961 CHECK_STRING (string); | |
962 CHECK_INT (start); | |
963 get_string_range_char (string, start, end, &ccstart, &ccend, | |
964 GB_HISTORICAL_STRING_BEHAVIOR); | |
965 bstart = string_index_char_to_byte (string, ccstart); | |
966 blen = string_offset_char_to_byte_len (string, bstart, ccend - ccstart); | |
967 val = make_string (XSTRING_DATA (string) + bstart, blen); | |
968 /* Copy any applicable extent information into the new string. */ | |
969 copy_string_extents (val, string, 0, bstart, blen); | |
970 return val; | |
971 } | |
972 | |
973 DEFUN ("subseq", Fsubseq, 2, 3, 0, /* | 949 DEFUN ("subseq", Fsubseq, 2, 3, 0, /* |
974 Return the subsequence of SEQUENCE starting at START and ending before END. | 950 Return the subsequence of SEQUENCE starting at START and ending before END. |
975 END may be omitted; then the subsequence runs to the end of SEQUENCE. | 951 END may be omitted; then the subsequence runs to the end of SEQUENCE. |
976 If START or END is negative, it counts from the end. | 952 If START or END is negative, it counts from the end. |
977 The returned subsequence is always of the same type as SEQUENCE. | 953 The returned subsequence is always of the same type as SEQUENCE. |
980 */ | 956 */ |
981 (sequence, start, end)) | 957 (sequence, start, end)) |
982 { | 958 { |
983 EMACS_INT len, s, e; | 959 EMACS_INT len, s, e; |
984 | 960 |
961 if (STRINGP (sequence)) | |
962 { | |
963 Charcount ccstart, ccend; | |
964 Bytecount bstart, blen; | |
965 Lisp_Object val; | |
966 | |
967 CHECK_INT (start); | |
968 get_string_range_char (sequence, start, end, &ccstart, &ccend, | |
969 GB_HISTORICAL_STRING_BEHAVIOR); | |
970 bstart = string_index_char_to_byte (sequence, ccstart); | |
971 blen = string_offset_char_to_byte_len (sequence, bstart, ccend - ccstart); | |
972 val = make_string (XSTRING_DATA (sequence) + bstart, blen); | |
973 /* Copy any applicable extent information into the new string. */ | |
974 copy_string_extents (val, sequence, 0, bstart, blen); | |
975 return val; | |
976 } | |
977 | |
985 CHECK_SEQUENCE (sequence); | 978 CHECK_SEQUENCE (sequence); |
986 | |
987 if (STRINGP (sequence)) | |
988 return Fsubstring (sequence, start, end); | |
989 | 979 |
990 len = XINT (Flength (sequence)); | 980 len = XINT (Flength (sequence)); |
991 | 981 |
992 CHECK_INT (start); | 982 CHECK_INT (start); |
993 s = XINT (start); | 983 s = XINT (start); |
4793 DEFSUBR (Fbvconcat); | 4783 DEFSUBR (Fbvconcat); |
4794 DEFSUBR (Fcopy_list); | 4784 DEFSUBR (Fcopy_list); |
4795 DEFSUBR (Fcopy_sequence); | 4785 DEFSUBR (Fcopy_sequence); |
4796 DEFSUBR (Fcopy_alist); | 4786 DEFSUBR (Fcopy_alist); |
4797 DEFSUBR (Fcopy_tree); | 4787 DEFSUBR (Fcopy_tree); |
4798 DEFSUBR (Fsubstring); | |
4799 DEFSUBR (Fsubseq); | 4788 DEFSUBR (Fsubseq); |
4800 DEFSUBR (Fnthcdr); | 4789 DEFSUBR (Fnthcdr); |
4801 DEFSUBR (Fnth); | 4790 DEFSUBR (Fnth); |
4802 DEFSUBR (Felt); | 4791 DEFSUBR (Felt); |
4803 DEFSUBR (Flast); | 4792 DEFSUBR (Flast); |