44 |
#include "lisp.h" |
#include "lisp.h" |
45 |
#include "intervals.h" |
#include "intervals.h" |
46 |
#include "buffer.h" |
#include "buffer.h" |
47 |
#include "charset.h" |
#include "character.h" |
48 |
#include "coding.h" |
#include "coding.h" |
49 |
#include "frame.h" |
#include "frame.h" |
50 |
#include "window.h" |
#include "window.h" |
181 |
|
|
182 |
CHECK_NUMBER (character); |
CHECK_NUMBER (character); |
183 |
|
|
184 |
len = (SINGLE_BYTE_CHAR_P (XFASTINT (character)) |
len = CHAR_STRING (XFASTINT (character), str); |
|
? (*str = (unsigned char)(XFASTINT (character)), 1) |
|
|
: char_to_string (XFASTINT (character), str)); |
|
185 |
return make_string_from_bytes (str, 1, len); |
return make_string_from_bytes (str, 1, len); |
186 |
} |
} |
187 |
|
|
2014 |
len = CHAR_STRING (XFASTINT (val), str); |
len = CHAR_STRING (XFASTINT (val), str); |
2015 |
else |
else |
2016 |
{ |
{ |
2017 |
str[0] = (SINGLE_BYTE_CHAR_P (XINT (val)) |
str[0] = (ASCII_CHAR_P (XINT (val)) |
2018 |
? XINT (val) |
? XINT (val) |
2019 |
: multibyte_char_to_unibyte (XINT (val), Qnil)); |
: multibyte_char_to_unibyte (XINT (val), Qnil)); |
2020 |
len = 1; |
len = 1; |
2185 |
return Qnil; |
return Qnil; |
2186 |
} |
} |
2187 |
|
|
2188 |
|
DEFUN ("insert-byte", Finsert_byte, Sinsert_byte, 2, 3, 0, |
2189 |
|
doc: /* Insert COUNT (second arg) copies of BYTE (first arg). |
2190 |
|
Both arguments are required. |
2191 |
|
BYTE is a number of the range 0..255. |
2192 |
|
|
2193 |
|
If BYTE is 128..255 and the current buffer is multibyte, the |
2194 |
|
corresponding eight-bit character is inserted. |
2195 |
|
|
2196 |
|
Point, and before-insertion markers, are relocated as in the function `insert'. |
2197 |
|
The optional third arg INHERIT, if non-nil, says to inherit text properties |
2198 |
|
from adjoining text, if those properties are sticky. */) |
2199 |
|
(byte, count, inherit) |
2200 |
|
Lisp_Object byte, count, inherit; |
2201 |
|
{ |
2202 |
|
CHECK_NUMBER (byte); |
2203 |
|
if (XINT (byte) < 0 || XINT (byte) > 255) |
2204 |
|
args_out_of_range_3 (byte, make_number (0), make_number (255)); |
2205 |
|
if (XINT (byte) >= 128 |
2206 |
|
&& ! NILP (current_buffer->enable_multibyte_characters)) |
2207 |
|
XSETFASTINT (byte, BYTE8_TO_CHAR (XINT (byte))); |
2208 |
|
return Finsert_char (byte, count, inherit); |
2209 |
|
} |
2210 |
|
|
2211 |
|
|
2212 |
/* Making strings from buffer contents. */ |
/* Making strings from buffer contents. */ |
2213 |
|
|
3420 |
thissize = 30; |
thissize = 30; |
3421 |
if (*format == 'c') |
if (*format == 'c') |
3422 |
{ |
{ |
3423 |
if (! SINGLE_BYTE_CHAR_P (XINT (args[n])) |
if (! ASCII_CHAR_P (XINT (args[n])) |
3424 |
/* Note: No one can remeber why we have to treat |
/* Note: No one can remeber why we have to treat |
3425 |
the character 0 as a multibyte character here. |
the character 0 as a multibyte character here. |
3426 |
But, until it causes a real problem, let's |
But, until it causes a real problem, let's |
3805 |
/* Do these in separate statements, |
/* Do these in separate statements, |
3806 |
then compare the variables. |
then compare the variables. |
3807 |
because of the way DOWNCASE uses temp variables. */ |
because of the way DOWNCASE uses temp variables. */ |
3808 |
i1 = DOWNCASE (XFASTINT (c1)); |
i1 = XFASTINT (c1); |
3809 |
i2 = DOWNCASE (XFASTINT (c2)); |
if (NILP (current_buffer->enable_multibyte_characters) |
3810 |
|
&& ! ASCII_CHAR_P (i1)) |
3811 |
|
{ |
3812 |
|
MAKE_CHAR_MULTIBYTE (i1); |
3813 |
|
} |
3814 |
|
i2 = XFASTINT (c2); |
3815 |
|
if (NILP (current_buffer->enable_multibyte_characters) |
3816 |
|
&& ! ASCII_CHAR_P (i2)) |
3817 |
|
{ |
3818 |
|
MAKE_CHAR_MULTIBYTE (i2); |
3819 |
|
} |
3820 |
|
i1 = DOWNCASE (i1); |
3821 |
|
i2 = DOWNCASE (i2); |
3822 |
return (i1 == i2 ? Qt : Qnil); |
return (i1 == i2 ? Qt : Qnil); |
3823 |
} |
} |
3824 |
|
|
4304 |
defsubr (&Sinsert_and_inherit); |
defsubr (&Sinsert_and_inherit); |
4305 |
defsubr (&Sinsert_and_inherit_before_markers); |
defsubr (&Sinsert_and_inherit_before_markers); |
4306 |
defsubr (&Sinsert_char); |
defsubr (&Sinsert_char); |
4307 |
|
defsubr (&Sinsert_byte); |
4308 |
|
|
4309 |
defsubr (&Suser_login_name); |
defsubr (&Suser_login_name); |
4310 |
defsubr (&Suser_real_login_name); |
defsubr (&Suser_real_login_name); |