132 |
|
|
133 |
retry: |
retry: |
134 |
if (STRINGP (sequence)) |
if (STRINGP (sequence)) |
135 |
XSETFASTINT (val, XSTRING (sequence)->size); |
XSETFASTINT (val, SCHARS (sequence)); |
136 |
else if (VECTORP (sequence)) |
else if (VECTORP (sequence)) |
137 |
XSETFASTINT (val, XVECTOR (sequence)->size); |
XSETFASTINT (val, XVECTOR (sequence)->size); |
138 |
else if (CHAR_TABLE_P (sequence)) |
else if (CHAR_TABLE_P (sequence)) |
208 |
Lisp_Object string; |
Lisp_Object string; |
209 |
{ |
{ |
210 |
CHECK_STRING (string); |
CHECK_STRING (string); |
211 |
return make_number (STRING_BYTES (XSTRING (string))); |
return make_number (SBYTES (string)); |
212 |
} |
} |
213 |
|
|
214 |
DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0, |
DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0, |
225 |
CHECK_STRING (s1); |
CHECK_STRING (s1); |
226 |
CHECK_STRING (s2); |
CHECK_STRING (s2); |
227 |
|
|
228 |
if (XSTRING (s1)->size != XSTRING (s2)->size |
if (SCHARS (s1) != SCHARS (s2) |
229 |
|| STRING_BYTES (XSTRING (s1)) != STRING_BYTES (XSTRING (s2)) |
|| SBYTES (s1) != SBYTES (s2) |
230 |
|| bcmp (XSTRING (s1)->data, XSTRING (s2)->data, STRING_BYTES (XSTRING (s1)))) |
|| bcmp (SDATA (s1), SDATA (s2), SBYTES (s1))) |
231 |
return Qnil; |
return Qnil; |
232 |
return Qt; |
return Qt; |
233 |
} |
} |
272 |
i1_byte = string_char_to_byte (str1, i1); |
i1_byte = string_char_to_byte (str1, i1); |
273 |
i2_byte = string_char_to_byte (str2, i2); |
i2_byte = string_char_to_byte (str2, i2); |
274 |
|
|
275 |
end1_char = XSTRING (str1)->size; |
end1_char = SCHARS (str1); |
276 |
if (! NILP (end1) && end1_char > XINT (end1)) |
if (! NILP (end1) && end1_char > XINT (end1)) |
277 |
end1_char = XINT (end1); |
end1_char = XINT (end1); |
278 |
|
|
279 |
end2_char = XSTRING (str2)->size; |
end2_char = SCHARS (str2); |
280 |
if (! NILP (end2) && end2_char > XINT (end2)) |
if (! NILP (end2) && end2_char > XINT (end2)) |
281 |
end2_char = XINT (end2); |
end2_char = XINT (end2); |
282 |
|
|
290 |
FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c1, str1, i1, i1_byte); |
FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c1, str1, i1, i1_byte); |
291 |
else |
else |
292 |
{ |
{ |
293 |
c1 = XSTRING (str1)->data[i1++]; |
c1 = SREF (str1, i1++); |
294 |
c1 = unibyte_char_to_multibyte (c1); |
c1 = unibyte_char_to_multibyte (c1); |
295 |
} |
} |
296 |
|
|
298 |
FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c2, str2, i2, i2_byte); |
FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c2, str2, i2, i2_byte); |
299 |
else |
else |
300 |
{ |
{ |
301 |
c2 = XSTRING (str2)->data[i2++]; |
c2 = SREF (str2, i2++); |
302 |
c2 = unibyte_char_to_multibyte (c2); |
c2 = unibyte_char_to_multibyte (c2); |
303 |
} |
} |
304 |
|
|
354 |
|
|
355 |
i1 = i1_byte = i2 = i2_byte = 0; |
i1 = i1_byte = i2 = i2_byte = 0; |
356 |
|
|
357 |
end = XSTRING (s1)->size; |
end = SCHARS (s1); |
358 |
if (end > XSTRING (s2)->size) |
if (end > SCHARS (s2)) |
359 |
end = XSTRING (s2)->size; |
end = SCHARS (s2); |
360 |
|
|
361 |
while (i1 < end) |
while (i1 < end) |
362 |
{ |
{ |
370 |
if (c1 != c2) |
if (c1 != c2) |
371 |
return c1 < c2 ? Qt : Qnil; |
return c1 < c2 ? Qt : Qnil; |
372 |
} |
} |
373 |
return i1 < XSTRING (s2)->size ? Qt : Qnil; |
return i1 < SCHARS (s2) ? Qt : Qnil; |
374 |
} |
} |
375 |
|
|
376 |
static Lisp_Object concat (); |
static Lisp_Object concat (); |
641 |
if (STRING_MULTIBYTE (this)) |
if (STRING_MULTIBYTE (this)) |
642 |
{ |
{ |
643 |
some_multibyte = 1; |
some_multibyte = 1; |
644 |
result_len_byte += STRING_BYTES (XSTRING (this)); |
result_len_byte += SBYTES (this); |
645 |
} |
} |
646 |
else |
else |
647 |
result_len_byte += count_size_as_multibyte (XSTRING (this)->data, |
result_len_byte += count_size_as_multibyte (SDATA (this), |
648 |
XSTRING (this)->size); |
SCHARS (this)); |
649 |
} |
} |
650 |
} |
} |
651 |
|
|
695 |
if (STRINGP (this) && STRINGP (val) |
if (STRINGP (this) && STRINGP (val) |
696 |
&& STRING_MULTIBYTE (this) == some_multibyte) |
&& STRING_MULTIBYTE (this) == some_multibyte) |
697 |
{ |
{ |
698 |
int thislen_byte = STRING_BYTES (XSTRING (this)); |
int thislen_byte = SBYTES (this); |
699 |
int combined; |
int combined; |
700 |
|
|
701 |
bcopy (XSTRING (this)->data, XSTRING (val)->data + toindex_byte, |
bcopy (SDATA (this), SDATA (val) + toindex_byte, |
702 |
STRING_BYTES (XSTRING (this))); |
SBYTES (this)); |
703 |
combined = (some_multibyte && toindex_byte > 0 |
combined = (some_multibyte && toindex_byte > 0 |
704 |
? count_combining (XSTRING (val)->data, |
? count_combining (SDATA (val), |
705 |
toindex_byte + thislen_byte, |
toindex_byte + thislen_byte, |
706 |
toindex_byte) |
toindex_byte) |
707 |
: 0); |
: 0); |
708 |
if (! NULL_INTERVAL_P (XSTRING (this)->intervals)) |
if (! NULL_INTERVAL_P (STRING_INTERVALS (this))) |
709 |
{ |
{ |
710 |
textprops[num_textprops].argnum = argnum; |
textprops[num_textprops].argnum = argnum; |
711 |
/* We ignore text properties on characters being combined. */ |
/* We ignore text properties on characters being combined. */ |
714 |
} |
} |
715 |
toindex_byte += thislen_byte; |
toindex_byte += thislen_byte; |
716 |
toindex += thisleni - combined; |
toindex += thisleni - combined; |
717 |
XSTRING (val)->size -= combined; |
SCHARS (val) -= combined; |
718 |
} |
} |
719 |
/* Copy a single-byte string to a multibyte string. */ |
/* Copy a single-byte string to a multibyte string. */ |
720 |
else if (STRINGP (this) && STRINGP (val)) |
else if (STRINGP (this) && STRINGP (val)) |
721 |
{ |
{ |
722 |
if (! NULL_INTERVAL_P (XSTRING (this)->intervals)) |
if (! NULL_INTERVAL_P (STRING_INTERVALS (this))) |
723 |
{ |
{ |
724 |
textprops[num_textprops].argnum = argnum; |
textprops[num_textprops].argnum = argnum; |
725 |
textprops[num_textprops].from = 0; |
textprops[num_textprops].from = 0; |
726 |
textprops[num_textprops++].to = toindex; |
textprops[num_textprops++].to = toindex; |
727 |
} |
} |
728 |
toindex_byte += copy_text (XSTRING (this)->data, |
toindex_byte += copy_text (SDATA (this), |
729 |
XSTRING (val)->data + toindex_byte, |
SDATA (val) + toindex_byte, |
730 |
XSTRING (this)->size, 0, 1); |
SCHARS (this), 0, 1); |
731 |
toindex += thisleni; |
toindex += thisleni; |
732 |
} |
} |
733 |
else |
else |
755 |
} |
} |
756 |
else |
else |
757 |
{ |
{ |
758 |
XSETFASTINT (elt, XSTRING (this)->data[thisindex++]); |
XSETFASTINT (elt, SREF (this, thisindex++)); |
759 |
if (some_multibyte |
if (some_multibyte |
760 |
&& (XINT (elt) >= 0240 |
&& (XINT (elt) >= 0240 |
761 |
|| (XINT (elt) >= 0200 |
|| (XINT (elt) >= 0200 |
797 |
if (some_multibyte) |
if (some_multibyte) |
798 |
toindex_byte |
toindex_byte |
799 |
+= CHAR_STRING (XINT (elt), |
+= CHAR_STRING (XINT (elt), |
800 |
XSTRING (val)->data + toindex_byte); |
SDATA (val) + toindex_byte); |
801 |
else |
else |
802 |
XSTRING (val)->data[toindex_byte++] = XINT (elt); |
SREF (val, toindex_byte++) = XINT (elt); |
803 |
if (some_multibyte |
if (some_multibyte |
804 |
&& toindex_byte > 0 |
&& toindex_byte > 0 |
805 |
&& count_combining (XSTRING (val)->data, |
&& count_combining (SDATA (val), |
806 |
toindex_byte, toindex_byte - 1)) |
toindex_byte, toindex_byte - 1)) |
807 |
XSTRING (val)->size--; |
SCHARS (val)--; |
808 |
else |
else |
809 |
toindex++; |
toindex++; |
810 |
} |
} |
815 |
int c = XINT (elt); |
int c = XINT (elt); |
816 |
/* P exists as a variable |
/* P exists as a variable |
817 |
to avoid a bug on the Masscomp C compiler. */ |
to avoid a bug on the Masscomp C compiler. */ |
818 |
unsigned char *p = & XSTRING (val)->data[toindex_byte]; |
unsigned char *p = & SREF (val, toindex_byte); |
819 |
|
|
820 |
toindex_byte += CHAR_STRING (c, p); |
toindex_byte += CHAR_STRING (c, p); |
821 |
toindex++; |
toindex++; |
836 |
this = args[textprops[argnum].argnum]; |
this = args[textprops[argnum].argnum]; |
837 |
props = text_property_list (this, |
props = text_property_list (this, |
838 |
make_number (0), |
make_number (0), |
839 |
make_number (XSTRING (this)->size), |
make_number (SCHARS (this)), |
840 |
Qnil); |
Qnil); |
841 |
/* If successive arguments have properites, be sure that the |
/* If successive arguments have properites, be sure that the |
842 |
value of `composition' property be the copy. */ |
value of `composition' property be the copy. */ |
844 |
make_composition_value_copy (props); |
make_composition_value_copy (props); |
845 |
add_text_properties_from_list (val, props, |
add_text_properties_from_list (val, props, |
846 |
make_number (textprops[argnum].to)); |
make_number (textprops[argnum].to)); |
847 |
last_to_end = textprops[argnum].to + XSTRING (this)->size; |
last_to_end = textprops[argnum].to + SCHARS (this); |
848 |
} |
} |
849 |
} |
} |
850 |
return val; |
return val; |
875 |
return char_index; |
return char_index; |
876 |
|
|
877 |
best_below = best_below_byte = 0; |
best_below = best_below_byte = 0; |
878 |
best_above = XSTRING (string)->size; |
best_above = SCHARS (string); |
879 |
best_above_byte = STRING_BYTES (XSTRING (string)); |
best_above_byte = SBYTES (string); |
880 |
|
|
881 |
if (EQ (string, string_char_byte_cache_string)) |
if (EQ (string, string_char_byte_cache_string)) |
882 |
{ |
{ |
907 |
{ |
{ |
908 |
while (best_above > char_index) |
while (best_above > char_index) |
909 |
{ |
{ |
910 |
unsigned char *pend = XSTRING (string)->data + best_above_byte; |
unsigned char *pend = SDATA (string) + best_above_byte; |
911 |
unsigned char *pbeg = pend - best_above_byte; |
unsigned char *pbeg = pend - best_above_byte; |
912 |
unsigned char *p = pend - 1; |
unsigned char *p = pend - 1; |
913 |
int bytes; |
int bytes; |
948 |
return byte_index; |
return byte_index; |
949 |
|
|
950 |
best_below = best_below_byte = 0; |
best_below = best_below_byte = 0; |
951 |
best_above = XSTRING (string)->size; |
best_above = SCHARS (string); |
952 |
best_above_byte = STRING_BYTES (XSTRING (string)); |
best_above_byte = SBYTES (string); |
953 |
|
|
954 |
if (EQ (string, string_char_byte_cache_string)) |
if (EQ (string, string_char_byte_cache_string)) |
955 |
{ |
{ |
980 |
{ |
{ |
981 |
while (best_above_byte > byte_index) |
while (best_above_byte > byte_index) |
982 |
{ |
{ |
983 |
unsigned char *pend = XSTRING (string)->data + best_above_byte; |
unsigned char *pend = SDATA (string) + best_above_byte; |
984 |
unsigned char *pbeg = pend - best_above_byte; |
unsigned char *pbeg = pend - best_above_byte; |
985 |
unsigned char *p = pend - 1; |
unsigned char *p = pend - 1; |
986 |
int bytes; |
int bytes; |
1020 |
if (STRING_MULTIBYTE (string)) |
if (STRING_MULTIBYTE (string)) |
1021 |
return string; |
return string; |
1022 |
|
|
1023 |
nbytes = count_size_as_multibyte (XSTRING (string)->data, |
nbytes = count_size_as_multibyte (SDATA (string), |
1024 |
XSTRING (string)->size); |
SCHARS (string)); |
1025 |
/* If all the chars are ASCII, they won't need any more bytes |
/* If all the chars are ASCII, they won't need any more bytes |
1026 |
once converted. In that case, we can return STRING itself. */ |
once converted. In that case, we can return STRING itself. */ |
1027 |
if (nbytes == STRING_BYTES (XSTRING (string))) |
if (nbytes == SBYTES (string)) |
1028 |
return string; |
return string; |
1029 |
|
|
1030 |
buf = (unsigned char *) alloca (nbytes); |
buf = (unsigned char *) alloca (nbytes); |
1031 |
copy_text (XSTRING (string)->data, buf, STRING_BYTES (XSTRING (string)), |
copy_text (SDATA (string), buf, SBYTES (string), |
1032 |
0, 1); |
0, 1); |
1033 |
|
|
1034 |
return make_multibyte_string (buf, XSTRING (string)->size, nbytes); |
return make_multibyte_string (buf, SCHARS (string), nbytes); |
1035 |
} |
} |
1036 |
|
|
1037 |
/* Convert STRING to a single-byte string. */ |
/* Convert STRING to a single-byte string. */ |
1045 |
if (! STRING_MULTIBYTE (string)) |
if (! STRING_MULTIBYTE (string)) |
1046 |
return string; |
return string; |
1047 |
|
|
1048 |
buf = (unsigned char *) alloca (XSTRING (string)->size); |
buf = (unsigned char *) alloca (SCHARS (string)); |
1049 |
|
|
1050 |
copy_text (XSTRING (string)->data, buf, STRING_BYTES (XSTRING (string)), |
copy_text (SDATA (string), buf, SBYTES (string), |
1051 |
1, 0); |
1, 0); |
1052 |
|
|
1053 |
return make_unibyte_string (buf, XSTRING (string)->size); |
return make_unibyte_string (buf, SCHARS (string)); |
1054 |
} |
} |
1055 |
|
|
1056 |
DEFUN ("string-make-multibyte", Fstring_make_multibyte, Sstring_make_multibyte, |
DEFUN ("string-make-multibyte", Fstring_make_multibyte, Sstring_make_multibyte, |
1096 |
|
|
1097 |
if (STRING_MULTIBYTE (string)) |
if (STRING_MULTIBYTE (string)) |
1098 |
{ |
{ |
1099 |
int bytes = STRING_BYTES (XSTRING (string)); |
int bytes = SBYTES (string); |
1100 |
unsigned char *str = (unsigned char *) xmalloc (bytes); |
unsigned char *str = (unsigned char *) xmalloc (bytes); |
1101 |
|
|
1102 |
bcopy (XSTRING (string)->data, str, bytes); |
bcopy (SDATA (string), str, bytes); |
1103 |
bytes = str_as_unibyte (str, bytes); |
bytes = str_as_unibyte (str, bytes); |
1104 |
string = make_unibyte_string (str, bytes); |
string = make_unibyte_string (str, bytes); |
1105 |
xfree (str); |
xfree (str); |
1125 |
Lisp_Object new_string; |
Lisp_Object new_string; |
1126 |
int nchars, nbytes; |
int nchars, nbytes; |
1127 |
|
|
1128 |
parse_str_as_multibyte (XSTRING (string)->data, |
parse_str_as_multibyte (SDATA (string), |
1129 |
STRING_BYTES (XSTRING (string)), |
SBYTES (string), |
1130 |
&nchars, &nbytes); |
&nchars, &nbytes); |
1131 |
new_string = make_uninit_multibyte_string (nchars, nbytes); |
new_string = make_uninit_multibyte_string (nchars, nbytes); |
1132 |
bcopy (XSTRING (string)->data, XSTRING (new_string)->data, |
bcopy (SDATA (string), SDATA (new_string), |
1133 |
STRING_BYTES (XSTRING (string))); |
SBYTES (string)); |
1134 |
if (nbytes != STRING_BYTES (XSTRING (string))) |
if (nbytes != SBYTES (string)) |
1135 |
str_as_multibyte (XSTRING (new_string)->data, nbytes, |
str_as_multibyte (SDATA (new_string), nbytes, |
1136 |
STRING_BYTES (XSTRING (string)), NULL); |
SBYTES (string), NULL); |
1137 |
string = new_string; |
string = new_string; |
1138 |
XSTRING (string)->intervals = NULL_INTERVAL; |
STRING_INTERVALS (string) = NULL_INTERVAL; |
1139 |
} |
} |
1140 |
return string; |
return string; |
1141 |
} |
} |
1190 |
|
|
1191 |
if (STRINGP (string)) |
if (STRINGP (string)) |
1192 |
{ |
{ |
1193 |
size = XSTRING (string)->size; |
size = SCHARS (string); |
1194 |
size_byte = STRING_BYTES (XSTRING (string)); |
size_byte = SBYTES (string); |
1195 |
} |
} |
1196 |
else |
else |
1197 |
size = XVECTOR (string)->size; |
size = XVECTOR (string)->size; |
1225 |
|
|
1226 |
if (STRINGP (string)) |
if (STRINGP (string)) |
1227 |
{ |
{ |
1228 |
res = make_specified_string (XSTRING (string)->data + from_byte, |
res = make_specified_string (SDATA (string) + from_byte, |
1229 |
to_char - from_char, to_byte - from_byte, |
to_char - from_char, to_byte - from_byte, |
1230 |
STRING_MULTIBYTE (string)); |
STRING_MULTIBYTE (string)); |
1231 |
copy_text_properties (make_number (from_char), make_number (to_char), |
copy_text_properties (make_number (from_char), make_number (to_char), |
1257 |
|
|
1258 |
CHECK_STRING (string); |
CHECK_STRING (string); |
1259 |
|
|
1260 |
size = XSTRING (string)->size; |
size = SCHARS (string); |
1261 |
size_byte = STRING_BYTES (XSTRING (string)); |
size_byte = SBYTES (string); |
1262 |
|
|
1263 |
if (NILP (from)) |
if (NILP (from)) |
1264 |
from_char = from_byte = 0; |
from_char = from_byte = 0; |
1292 |
args_out_of_range_3 (string, make_number (from_char), |
args_out_of_range_3 (string, make_number (from_char), |
1293 |
make_number (to_char)); |
make_number (to_char)); |
1294 |
|
|
1295 |
return make_specified_string (XSTRING (string)->data + from_byte, |
return make_specified_string (SDATA (string) + from_byte, |
1296 |
to_char - from_char, to_byte - from_byte, |
to_char - from_char, to_byte - from_byte, |
1297 |
STRING_MULTIBYTE (string)); |
STRING_MULTIBYTE (string)); |
1298 |
} |
} |
1314 |
|
|
1315 |
if (STRINGP (string)) |
if (STRINGP (string)) |
1316 |
{ |
{ |
1317 |
size = XSTRING (string)->size; |
size = SCHARS (string); |
1318 |
size_byte = STRING_BYTES (XSTRING (string)); |
size_byte = SBYTES (string); |
1319 |
} |
} |
1320 |
else |
else |
1321 |
size = XVECTOR (string)->size; |
size = XVECTOR (string)->size; |
1325 |
|
|
1326 |
if (STRINGP (string)) |
if (STRINGP (string)) |
1327 |
{ |
{ |
1328 |
res = make_specified_string (XSTRING (string)->data + from_byte, |
res = make_specified_string (SDATA (string) + from_byte, |
1329 |
to - from, to_byte - from_byte, |
to - from, to_byte - from_byte, |
1330 |
STRING_MULTIBYTE (string)); |
STRING_MULTIBYTE (string)); |
1331 |
copy_text_properties (make_number (from), make_number (to), |
copy_text_properties (make_number (from), make_number (to), |
1693 |
int c; |
int c; |
1694 |
|
|
1695 |
for (i = nchars = nbytes = ibyte = 0; |
for (i = nchars = nbytes = ibyte = 0; |
1696 |
i < XSTRING (seq)->size; |
i < SCHARS (seq); |
1697 |
++i, ibyte += cbytes) |
++i, ibyte += cbytes) |
1698 |
{ |
{ |
1699 |
if (STRING_MULTIBYTE (seq)) |
if (STRING_MULTIBYTE (seq)) |
1700 |
{ |
{ |
1701 |
c = STRING_CHAR (&XSTRING (seq)->data[ibyte], |
c = STRING_CHAR (&SREF (seq, ibyte), |
1702 |
STRING_BYTES (XSTRING (seq)) - ibyte); |
SBYTES (seq) - ibyte); |
1703 |
cbytes = CHAR_BYTES (c); |
cbytes = CHAR_BYTES (c); |
1704 |
} |
} |
1705 |
else |
else |
1706 |
{ |
{ |
1707 |
c = XSTRING (seq)->data[i]; |
c = SREF (seq, i); |
1708 |
cbytes = 1; |
cbytes = 1; |
1709 |
} |
} |
1710 |
|
|
1715 |
} |
} |
1716 |
} |
} |
1717 |
|
|
1718 |
if (nchars != XSTRING (seq)->size) |
if (nchars != SCHARS (seq)) |
1719 |
{ |
{ |
1720 |
Lisp_Object tem; |
Lisp_Object tem; |
1721 |
|
|
1722 |
tem = make_uninit_multibyte_string (nchars, nbytes); |
tem = make_uninit_multibyte_string (nchars, nbytes); |
1723 |
if (!STRING_MULTIBYTE (seq)) |
if (!STRING_MULTIBYTE (seq)) |
1724 |
SET_STRING_BYTES (XSTRING (tem), -1); |
STRING_SET_UNIBYTE (tem); |
1725 |
|
|
1726 |
for (i = nchars = nbytes = ibyte = 0; |
for (i = nchars = nbytes = ibyte = 0; |
1727 |
i < XSTRING (seq)->size; |
i < SCHARS (seq); |
1728 |
++i, ibyte += cbytes) |
++i, ibyte += cbytes) |
1729 |
{ |
{ |
1730 |
if (STRING_MULTIBYTE (seq)) |
if (STRING_MULTIBYTE (seq)) |
1731 |
{ |
{ |
1732 |
c = STRING_CHAR (&XSTRING (seq)->data[ibyte], |
c = STRING_CHAR (&SREF (seq, ibyte), |
1733 |
STRING_BYTES (XSTRING (seq)) - ibyte); |
SBYTES (seq) - ibyte); |
1734 |
cbytes = CHAR_BYTES (c); |
cbytes = CHAR_BYTES (c); |
1735 |
} |
} |
1736 |
else |
else |
1737 |
{ |
{ |
1738 |
c = XSTRING (seq)->data[i]; |
c = SREF (seq, i); |
1739 |
cbytes = 1; |
cbytes = 1; |
1740 |
} |
} |
1741 |
|
|
1742 |
if (!INTEGERP (elt) || c != XINT (elt)) |
if (!INTEGERP (elt) || c != XINT (elt)) |
1743 |
{ |
{ |
1744 |
unsigned char *from = &XSTRING (seq)->data[ibyte]; |
unsigned char *from = &SREF (seq, ibyte); |
1745 |
unsigned char *to = &XSTRING (tem)->data[nbytes]; |
unsigned char *to = &SREF (tem, nbytes); |
1746 |
EMACS_INT n; |
EMACS_INT n; |
1747 |
|
|
1748 |
++nchars; |
++nchars; |
2176 |
break; |
break; |
2177 |
|
|
2178 |
case Lisp_String: |
case Lisp_String: |
2179 |
if (XSTRING (o1)->size != XSTRING (o2)->size) |
if (SCHARS (o1) != SCHARS (o2)) |
2180 |
return 0; |
return 0; |
2181 |
if (STRING_BYTES (XSTRING (o1)) != STRING_BYTES (XSTRING (o2))) |
if (SBYTES (o1) != SBYTES (o2)) |
2182 |
return 0; |
return 0; |
2183 |
if (bcmp (XSTRING (o1)->data, XSTRING (o2)->data, |
if (bcmp (SDATA (o1), SDATA (o2), |
2184 |
STRING_BYTES (XSTRING (o1)))) |
SBYTES (o1))) |
2185 |
return 0; |
return 0; |
2186 |
return 1; |
return 1; |
2187 |
|
|
2221 |
} |
} |
2222 |
else if (STRINGP (array)) |
else if (STRINGP (array)) |
2223 |
{ |
{ |
2224 |
register unsigned char *p = XSTRING (array)->data; |
register unsigned char *p = SDATA (array); |
2225 |
CHECK_NUMBER (item); |
CHECK_NUMBER (item); |
2226 |
charval = XINT (item); |
charval = XINT (item); |
2227 |
size = XSTRING (array)->size; |
size = SCHARS (array); |
2228 |
if (STRING_MULTIBYTE (array)) |
if (STRING_MULTIBYTE (array)) |
2229 |
{ |
{ |
2230 |
unsigned char str[MAX_MULTIBYTE_LENGTH]; |
unsigned char str[MAX_MULTIBYTE_LENGTH]; |
2231 |
int len = CHAR_STRING (charval, str); |
int len = CHAR_STRING (charval, str); |
2232 |
int size_byte = STRING_BYTES (XSTRING (array)); |
int size_byte = SBYTES (array); |
2233 |
unsigned char *p1 = p, *endp = p + size_byte; |
unsigned char *p1 = p, *endp = p + size_byte; |
2234 |
int i; |
int i; |
2235 |
|
|
3113 |
ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, |
ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, |
3114 |
Qyes_or_no_p_history, Qnil, |
Qyes_or_no_p_history, Qnil, |
3115 |
Qnil)); |
Qnil)); |
3116 |
if (XSTRING (ans)->size == 3 && !strcmp (XSTRING (ans)->data, "yes")) |
if (SCHARS (ans) == 3 && !strcmp (SDATA (ans), "yes")) |
3117 |
{ |
{ |
3118 |
UNGCPRO; |
UNGCPRO; |
3119 |
return Qt; |
return Qt; |
3120 |
} |
} |
3121 |
if (XSTRING (ans)->size == 2 && !strcmp (XSTRING (ans)->data, "no")) |
if (SCHARS (ans) == 2 && !strcmp (SDATA (ans), "no")) |
3122 |
{ |
{ |
3123 |
UNGCPRO; |
UNGCPRO; |
3124 |
return Qnil; |
return Qnil; |
3257 |
of what files are preloaded and when. */ |
of what files are preloaded and when. */ |
3258 |
if (! NILP (Vpurify_flag)) |
if (! NILP (Vpurify_flag)) |
3259 |
error ("(require %s) while preparing to dump", |
error ("(require %s) while preparing to dump", |
3260 |
XSTRING (SYMBOL_NAME (feature))->data); |
SDATA (SYMBOL_NAME (feature))); |
3261 |
|
|
3262 |
/* A certain amount of recursive `require' is legitimate, |
/* A certain amount of recursive `require' is legitimate, |
3263 |
but if we require the same feature recursively 3 times, |
but if we require the same feature recursively 3 times, |
3271 |
} |
} |
3272 |
if (nesting > 2) |
if (nesting > 2) |
3273 |
error ("Recursive `require' for feature `%s'", |
error ("Recursive `require' for feature `%s'", |
3274 |
XSTRING (SYMBOL_NAME (feature))->data); |
SDATA (SYMBOL_NAME (feature))); |
3275 |
|
|
3276 |
/* Update the list for any nested `require's that occur. */ |
/* Update the list for any nested `require's that occur. */ |
3277 |
record_unwind_protect (require_unwind, require_nesting_list); |
record_unwind_protect (require_unwind, require_nesting_list); |
3294 |
tem = Fmemq (feature, Vfeatures); |
tem = Fmemq (feature, Vfeatures); |
3295 |
if (NILP (tem)) |
if (NILP (tem)) |
3296 |
error ("Required feature `%s' was not provided", |
error ("Required feature `%s' was not provided", |
3297 |
XSTRING (SYMBOL_NAME (feature))->data); |
SDATA (SYMBOL_NAME (feature))); |
3298 |
|
|
3299 |
/* Once loading finishes, don't undo it. */ |
/* Once loading finishes, don't undo it. */ |
3300 |
Vautoload_queue = Qt; |
Vautoload_queue = Qt; |
3557 |
/* We need to allocate enough room for encoding the text. |
/* We need to allocate enough room for encoding the text. |
3558 |
We need 33 1/3% more space, plus a newline every 76 |
We need 33 1/3% more space, plus a newline every 76 |
3559 |
characters, and then we round up. */ |
characters, and then we round up. */ |
3560 |
length = STRING_BYTES (XSTRING (string)); |
length = SBYTES (string); |
3561 |
allength = length + length/3 + 1; |
allength = length + length/3 + 1; |
3562 |
allength += allength / MIME_LINE_LENGTH + 1 + 6; |
allength += allength / MIME_LINE_LENGTH + 1 + 6; |
3563 |
|
|
3567 |
else |
else |
3568 |
encoded = (char *) xmalloc (allength); |
encoded = (char *) xmalloc (allength); |
3569 |
|
|
3570 |
encoded_length = base64_encode_1 (XSTRING (string)->data, |
encoded_length = base64_encode_1 (SDATA (string), |
3571 |
encoded, length, NILP (no_line_break), |
encoded, length, NILP (no_line_break), |
3572 |
STRING_MULTIBYTE (string)); |
STRING_MULTIBYTE (string)); |
3573 |
if (encoded_length > allength) |
if (encoded_length > allength) |
3760 |
|
|
3761 |
CHECK_STRING (string); |
CHECK_STRING (string); |
3762 |
|
|
3763 |
length = STRING_BYTES (XSTRING (string)); |
length = SBYTES (string); |
3764 |
/* We need to allocate enough room for decoding the text. */ |
/* We need to allocate enough room for decoding the text. */ |
3765 |
if (length <= MAX_ALLOCA) |
if (length <= MAX_ALLOCA) |
3766 |
decoded = (char *) alloca (length); |
decoded = (char *) alloca (length); |
3768 |
decoded = (char *) xmalloc (length); |
decoded = (char *) xmalloc (length); |
3769 |
|
|
3770 |
/* The decoded result should be unibyte. */ |
/* The decoded result should be unibyte. */ |
3771 |
decoded_length = base64_decode_1 (XSTRING (string)->data, decoded, length, |
decoded_length = base64_decode_1 (SDATA (string), decoded, length, |
3772 |
0, NULL); |
0, NULL); |
3773 |
if (decoded_length > length) |
if (decoded_length > length) |
3774 |
abort (); |
abort (); |
4772 |
break; |
break; |
4773 |
|
|
4774 |
case Lisp_Symbol: |
case Lisp_Symbol: |
4775 |
hash = sxhash_string (XSTRING (SYMBOL_NAME (obj))->data, |
hash = sxhash_string (SDATA (SYMBOL_NAME (obj)), |
4776 |
XSTRING (SYMBOL_NAME (obj))->size); |
SCHARS (SYMBOL_NAME (obj))); |
4777 |
break; |
break; |
4778 |
|
|
4779 |
case Lisp_Misc: |
case Lisp_Misc: |
4781 |
break; |
break; |
4782 |
|
|
4783 |
case Lisp_String: |
case Lisp_String: |
4784 |
hash = sxhash_string (XSTRING (obj)->data, XSTRING (obj)->size); |
hash = sxhash_string (SDATA (obj), SCHARS (obj)); |
4785 |
break; |
break; |
4786 |
|
|
4787 |
/* This can be everything from a vector to an overlay. */ |
/* This can be everything from a vector to an overlay. */ |
5206 |
if (STRING_MULTIBYTE (object)) |
if (STRING_MULTIBYTE (object)) |
5207 |
object = code_convert_string1 (object, coding_system, Qnil, 1); |
object = code_convert_string1 (object, coding_system, Qnil, 1); |
5208 |
|
|
5209 |
size = XSTRING (object)->size; |
size = SCHARS (object); |
5210 |
size_byte = STRING_BYTES (XSTRING (object)); |
size_byte = SBYTES (object); |
5211 |
|
|
5212 |
if (!NILP (start)) |
if (!NILP (start)) |
5213 |
{ |
{ |
5339 |
object = code_convert_string1 (object, coding_system, Qnil, 1); |
object = code_convert_string1 (object, coding_system, Qnil, 1); |
5340 |
} |
} |
5341 |
|
|
5342 |
md5_buffer (XSTRING (object)->data + start_byte, |
md5_buffer (SDATA (object) + start_byte, |
5343 |
STRING_BYTES(XSTRING (object)) - (size_byte - end_byte), |
SBYTES (object) - (size_byte - end_byte), |
5344 |
digest); |
digest); |
5345 |
|
|
5346 |
for (i = 0; i < 16; i++) |
for (i = 0; i < 16; i++) |