Mercurial > emacs
comparison src/charset.c @ 40103:6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
author | Pavel Janík <Pavel@Janik.cz> |
---|---|
date | Sat, 20 Oct 2001 20:54:39 +0000 |
parents | 5f60884970a8 |
children | 78a7615cd863 |
comparison
equal
deleted
inserted
replaced
40102:d001bdd0593d | 40103:6b389fb978bc |
---|---|
629 | 629 |
630 return make_number (charset < to ? charset : 0); | 630 return make_number (charset < to ? charset : 0); |
631 } | 631 } |
632 | 632 |
633 DEFUN ("define-charset", Fdefine_charset, Sdefine_charset, 3, 3, 0, | 633 DEFUN ("define-charset", Fdefine_charset, Sdefine_charset, 3, 3, 0, |
634 "Define CHARSET-ID as the identification number of CHARSET with INFO-VECTOR.\n\ | 634 doc: /* Define CHARSET-ID as the identification number of CHARSET with INFO-VECTOR. |
635 If CHARSET-ID is nil, it is decided automatically, which means CHARSET is\n\ | 635 If CHARSET-ID is nil, it is decided automatically, which means CHARSET is |
636 treated as a private charset.\n\ | 636 treated as a private charset. |
637 INFO-VECTOR is a vector of the format:\n\ | 637 INFO-VECTOR is a vector of the format: |
638 [DIMENSION CHARS WIDTH DIRECTION ISO-FINAL-CHAR ISO-GRAPHIC-PLANE\n\ | 638 [DIMENSION CHARS WIDTH DIRECTION ISO-FINAL-CHAR ISO-GRAPHIC-PLANE |
639 SHORT-NAME LONG-NAME DESCRIPTION]\n\ | 639 SHORT-NAME LONG-NAME DESCRIPTION] |
640 The meanings of each elements is as follows:\n\ | 640 The meanings of each elements is as follows: |
641 DIMENSION (integer) is the number of bytes to represent a character: 1 or 2.\n\ | 641 DIMENSION (integer) is the number of bytes to represent a character: 1 or 2. |
642 CHARS (integer) is the number of characters in a dimension: 94 or 96.\n\ | 642 CHARS (integer) is the number of characters in a dimension: 94 or 96. |
643 WIDTH (integer) is the number of columns a character in the charset\n\ | 643 WIDTH (integer) is the number of columns a character in the charset |
644 occupies on the screen: one of 0, 1, and 2.\n\ | 644 occupies on the screen: one of 0, 1, and 2. |
645 \n\ | 645 |
646 DIRECTION (integer) is the rendering direction of characters in the\n\ | 646 DIRECTION (integer) is the rendering direction of characters in the |
647 charset when rendering. If 0, render from left to right, else\n\ | 647 charset when rendering. If 0, render from left to right, else |
648 render from right to left.\n\ | 648 render from right to left. |
649 \n\ | 649 |
650 ISO-FINAL-CHAR (character) is the final character of the\n\ | 650 ISO-FINAL-CHAR (character) is the final character of the |
651 corresponding ISO 2022 charset.\n\ | 651 corresponding ISO 2022 charset. |
652 It may be -1 if the charset is internal use only.\n\ | 652 It may be -1 if the charset is internal use only. |
653 \n\ | 653 |
654 ISO-GRAPHIC-PLANE (integer) is the graphic plane to be invoked\n\ | 654 ISO-GRAPHIC-PLANE (integer) is the graphic plane to be invoked |
655 while encoding to variants of ISO 2022 coding system, one of the\n\ | 655 while encoding to variants of ISO 2022 coding system, one of the |
656 following: 0/graphic-plane-left(GL), 1/graphic-plane-right(GR).\n\ | 656 following: 0/graphic-plane-left(GL), 1/graphic-plane-right(GR). |
657 It may be -1 if the charset is internal use only.\n\ | 657 It may be -1 if the charset is internal use only. |
658 \n\ | 658 |
659 SHORT-NAME (string) is the short name to refer to the charset.\n\ | 659 SHORT-NAME (string) is the short name to refer to the charset. |
660 \n\ | 660 |
661 LONG-NAME (string) is the long name to refer to the charset.\n\ | 661 LONG-NAME (string) is the long name to refer to the charset. |
662 \n\ | 662 |
663 DESCRIPTION (string) is the description string of the charset.") | 663 DESCRIPTION (string) is the description string of the charset. */) |
664 (charset_id, charset_symbol, info_vector) | 664 (charset_id, charset_symbol, info_vector) |
665 Lisp_Object charset_id, charset_symbol, info_vector; | 665 Lisp_Object charset_id, charset_symbol, info_vector; |
666 { | 666 { |
667 Lisp_Object *vec; | 667 Lisp_Object *vec; |
668 | 668 |
669 if (!NILP (charset_id)) | 669 if (!NILP (charset_id)) |
711 return Qnil; | 711 return Qnil; |
712 } | 712 } |
713 | 713 |
714 DEFUN ("generic-character-list", Fgeneric_character_list, | 714 DEFUN ("generic-character-list", Fgeneric_character_list, |
715 Sgeneric_character_list, 0, 0, 0, | 715 Sgeneric_character_list, 0, 0, 0, |
716 "Return a list of all possible generic characters.\n\ | 716 doc: /* Return a list of all possible generic characters. |
717 It includes a generic character for a charset not yet defined.") | 717 It includes a generic character for a charset not yet defined. */) |
718 () | 718 () |
719 { | 719 { |
720 return Vgeneric_character_list; | 720 return Vgeneric_character_list; |
721 } | 721 } |
722 | 722 |
723 DEFUN ("get-unused-iso-final-char", Fget_unused_iso_final_char, | 723 DEFUN ("get-unused-iso-final-char", Fget_unused_iso_final_char, |
724 Sget_unused_iso_final_char, 2, 2, 0, | 724 Sget_unused_iso_final_char, 2, 2, 0, |
725 "Return an unsed ISO's final char for a charset of DIMENISION and CHARS.\n\ | 725 doc: /* Return an unsed ISO's final char for a charset of DIMENISION and CHARS. |
726 DIMENSION is the number of bytes to represent a character: 1 or 2.\n\ | 726 DIMENSION is the number of bytes to represent a character: 1 or 2. |
727 CHARS is the number of characters in a dimension: 94 or 96.\n\ | 727 CHARS is the number of characters in a dimension: 94 or 96. |
728 \n\ | 728 |
729 This final char is for private use, thus the range is `0' (48) .. `?' (63).\n\ | 729 This final char is for private use, thus the range is `0' (48) .. `?' (63). |
730 If there's no unused final char for the specified kind of charset,\n\ | 730 If there's no unused final char for the specified kind of charset, |
731 return nil.") | 731 return nil. */) |
732 (dimension, chars) | 732 (dimension, chars) |
733 Lisp_Object dimension, chars; | 733 Lisp_Object dimension, chars; |
734 { | 734 { |
735 int final_char; | 735 int final_char; |
736 | 736 |
737 CHECK_NUMBER (dimension, 0); | 737 CHECK_NUMBER (dimension, 0); |
750 return (final_char <= '?' ? make_number (final_char) : Qnil); | 750 return (final_char <= '?' ? make_number (final_char) : Qnil); |
751 } | 751 } |
752 | 752 |
753 DEFUN ("declare-equiv-charset", Fdeclare_equiv_charset, Sdeclare_equiv_charset, | 753 DEFUN ("declare-equiv-charset", Fdeclare_equiv_charset, Sdeclare_equiv_charset, |
754 4, 4, 0, | 754 4, 4, 0, |
755 "Declare a charset of DIMENSION, CHARS, FINAL-CHAR is the same as CHARSET.\n\ | 755 doc: /* Declare a charset of DIMENSION, CHARS, FINAL-CHAR is the same as CHARSET. |
756 CHARSET should be defined by `defined-charset' in advance.") | 756 CHARSET should be defined by `defined-charset' in advance. */) |
757 (dimension, chars, final_char, charset_symbol) | 757 (dimension, chars, final_char, charset_symbol) |
758 Lisp_Object dimension, chars, final_char, charset_symbol; | 758 Lisp_Object dimension, chars, final_char, charset_symbol; |
759 { | 759 { |
760 int charset; | 760 int charset; |
761 | 761 |
762 CHECK_NUMBER (dimension, 0); | 762 CHECK_NUMBER (dimension, 0); |
858 } | 858 } |
859 } | 859 } |
860 | 860 |
861 DEFUN ("find-charset-region", Ffind_charset_region, Sfind_charset_region, | 861 DEFUN ("find-charset-region", Ffind_charset_region, Sfind_charset_region, |
862 2, 3, 0, | 862 2, 3, 0, |
863 "Return a list of charsets in the region between BEG and END.\n\ | 863 doc: /* Return a list of charsets in the region between BEG and END. |
864 BEG and END are buffer positions.\n\ | 864 BEG and END are buffer positions. |
865 Optional arg TABLE if non-nil is a translation table to look up.\n\ | 865 Optional arg TABLE if non-nil is a translation table to look up. |
866 \n\ | 866 |
867 If the region contains invalid multibyte characters,\n\ | 867 If the region contains invalid multibyte characters, |
868 `unknown' is included in the returned list.\n\ | 868 `unknown' is included in the returned list. |
869 \n\ | 869 |
870 If the current buffer is unibyte, the returned list may contain\n\ | 870 If the current buffer is unibyte, the returned list may contain |
871 only `ascii', `eight-bit-control', and `eight-bit-graphic'.") | 871 only `ascii', `eight-bit-control', and `eight-bit-graphic'. */) |
872 (beg, end, table) | 872 (beg, end, table) |
873 Lisp_Object beg, end, table; | 873 Lisp_Object beg, end, table; |
874 { | 874 { |
875 int charsets[MAX_CHARSET + 1]; | 875 int charsets[MAX_CHARSET + 1]; |
876 int from, from_byte, to, stop, stop_byte, i; | 876 int from, from_byte, to, stop, stop_byte, i; |
877 Lisp_Object val; | 877 Lisp_Object val; |
915 return val; | 915 return val; |
916 } | 916 } |
917 | 917 |
918 DEFUN ("find-charset-string", Ffind_charset_string, Sfind_charset_string, | 918 DEFUN ("find-charset-string", Ffind_charset_string, Sfind_charset_string, |
919 1, 2, 0, | 919 1, 2, 0, |
920 "Return a list of charsets in STR.\n\ | 920 doc: /* Return a list of charsets in STR. |
921 Optional arg TABLE if non-nil is a translation table to look up.\n\ | 921 Optional arg TABLE if non-nil is a translation table to look up. |
922 \n\ | 922 |
923 If the string contains invalid multibyte characters,\n\ | 923 If the string contains invalid multibyte characters, |
924 `unknown' is included in the returned list.\n\ | 924 `unknown' is included in the returned list. |
925 \n\ | 925 |
926 If STR is unibyte, the returned list may contain\n\ | 926 If STR is unibyte, the returned list may contain |
927 only `ascii', `eight-bit-control', and `eight-bit-graphic'.") | 927 only `ascii', `eight-bit-control', and `eight-bit-graphic'. */) |
928 (str, table) | 928 (str, table) |
929 Lisp_Object str, table; | 929 Lisp_Object str, table; |
930 { | 930 { |
931 int charsets[MAX_CHARSET + 1]; | 931 int charsets[MAX_CHARSET + 1]; |
932 int i; | 932 int i; |
933 Lisp_Object val; | 933 Lisp_Object val; |
949 return val; | 949 return val; |
950 } | 950 } |
951 | 951 |
952 | 952 |
953 DEFUN ("make-char-internal", Fmake_char_internal, Smake_char_internal, 1, 3, 0, | 953 DEFUN ("make-char-internal", Fmake_char_internal, Smake_char_internal, 1, 3, 0, |
954 "") | 954 doc: /* Return a character made from arguments. |
955 (charset, code1, code2) | 955 Internal use only. */) |
956 (charset, code1, code2) | |
956 Lisp_Object charset, code1, code2; | 957 Lisp_Object charset, code1, code2; |
957 { | 958 { |
958 int charset_id, c1, c2; | 959 int charset_id, c1, c2; |
959 | 960 |
960 CHECK_NUMBER (charset, 0); | 961 CHECK_NUMBER (charset, 0); |
1014 invalid_code_posints: | 1015 invalid_code_posints: |
1015 error ("Invalid code points for charset ID %d: %d %d", charset_id, c1, c2); | 1016 error ("Invalid code points for charset ID %d: %d %d", charset_id, c1, c2); |
1016 } | 1017 } |
1017 | 1018 |
1018 DEFUN ("split-char", Fsplit_char, Ssplit_char, 1, 1, 0, | 1019 DEFUN ("split-char", Fsplit_char, Ssplit_char, 1, 1, 0, |
1019 "Return list of charset and one or two position-codes of CHAR.\n\ | 1020 doc: /* Return list of charset and one or two position-codes of CHAR. |
1020 If CHAR is invalid as a character code,\n\ | 1021 If CHAR is invalid as a character code, |
1021 return a list of symbol `unknown' and CHAR.") | 1022 return a list of symbol `unknown' and CHAR. */) |
1022 (ch) | 1023 (ch) |
1023 Lisp_Object ch; | 1024 Lisp_Object ch; |
1024 { | 1025 { |
1025 int c, charset, c1, c2; | 1026 int c, charset, c1, c2; |
1026 | 1027 |
1027 CHECK_NUMBER (ch, 0); | 1028 CHECK_NUMBER (ch, 0); |
1034 Fcons (make_number (c1), Fcons (make_number (c2), Qnil))) | 1035 Fcons (make_number (c1), Fcons (make_number (c2), Qnil))) |
1035 : Fcons (CHARSET_SYMBOL (charset), Fcons (make_number (c1), Qnil))); | 1036 : Fcons (CHARSET_SYMBOL (charset), Fcons (make_number (c1), Qnil))); |
1036 } | 1037 } |
1037 | 1038 |
1038 DEFUN ("char-charset", Fchar_charset, Schar_charset, 1, 1, 0, | 1039 DEFUN ("char-charset", Fchar_charset, Schar_charset, 1, 1, 0, |
1039 "Return charset of CHAR.") | 1040 doc: /* Return charset of CHAR. */) |
1040 (ch) | 1041 (ch) |
1041 Lisp_Object ch; | 1042 Lisp_Object ch; |
1042 { | 1043 { |
1043 CHECK_NUMBER (ch, 0); | 1044 CHECK_NUMBER (ch, 0); |
1044 | 1045 |
1045 return CHARSET_SYMBOL (CHAR_CHARSET (XINT (ch))); | 1046 return CHARSET_SYMBOL (CHAR_CHARSET (XINT (ch))); |
1046 } | 1047 } |
1047 | 1048 |
1048 DEFUN ("charset-after", Fcharset_after, Scharset_after, 0, 1, 0, | 1049 DEFUN ("charset-after", Fcharset_after, Scharset_after, 0, 1, 0, |
1049 "Return charset of a character in the current buffer at position POS.\n\ | 1050 doc: /* Return charset of a character in the current buffer at position POS. |
1050 If POS is nil, it defauls to the current point.\n\ | 1051 If POS is nil, it defauls to the current point. |
1051 If POS is out of range, the value is nil.") | 1052 If POS is out of range, the value is nil. */) |
1052 (pos) | 1053 (pos) |
1053 Lisp_Object pos; | 1054 Lisp_Object pos; |
1054 { | 1055 { |
1055 Lisp_Object ch; | 1056 Lisp_Object ch; |
1056 int charset; | 1057 int charset; |
1057 | 1058 |
1061 charset = CHAR_CHARSET (XINT (ch)); | 1062 charset = CHAR_CHARSET (XINT (ch)); |
1062 return CHARSET_SYMBOL (charset); | 1063 return CHARSET_SYMBOL (charset); |
1063 } | 1064 } |
1064 | 1065 |
1065 DEFUN ("iso-charset", Fiso_charset, Siso_charset, 3, 3, 0, | 1066 DEFUN ("iso-charset", Fiso_charset, Siso_charset, 3, 3, 0, |
1066 "Return charset of ISO's specification DIMENSION, CHARS, and FINAL-CHAR.\n\ | 1067 doc: /* Return charset of ISO's specification DIMENSION, CHARS, and FINAL-CHAR. |
1067 \n\ | 1068 |
1068 ISO 2022's designation sequence (escape sequence) distinguishes charsets\n\ | 1069 ISO 2022's designation sequence (escape sequence) distinguishes charsets |
1069 by their DIMENSION, CHARS, and FINAL-CHAR,\n\ | 1070 by their DIMENSION, CHARS, and FINAL-CHAR, |
1070 where as Emacs distinguishes them by charset symbol.\n\ | 1071 where as Emacs distinguishes them by charset symbol. |
1071 See the documentation of the function `charset-info' for the meanings of\n\ | 1072 See the documentation of the function `charset-info' for the meanings of |
1072 DIMENSION, CHARS, and FINAL-CHAR.") | 1073 DIMENSION, CHARS, and FINAL-CHAR. */) |
1073 (dimension, chars, final_char) | 1074 (dimension, chars, final_char) |
1074 Lisp_Object dimension, chars, final_char; | 1075 Lisp_Object dimension, chars, final_char; |
1075 { | 1076 { |
1076 int charset; | 1077 int charset; |
1077 | 1078 |
1078 CHECK_NUMBER (dimension, 0); | 1079 CHECK_NUMBER (dimension, 0); |
1113 return (CHARSET_DEFINED_P (charset) | 1114 return (CHARSET_DEFINED_P (charset) |
1114 && CHAR_COMPONENTS_VALID_P (charset, c1, c2)); | 1115 && CHAR_COMPONENTS_VALID_P (charset, c1, c2)); |
1115 } | 1116 } |
1116 | 1117 |
1117 DEFUN ("char-valid-p", Fchar_valid_p, Schar_valid_p, 1, 2, 0, | 1118 DEFUN ("char-valid-p", Fchar_valid_p, Schar_valid_p, 1, 2, 0, |
1118 "Return t if OBJECT is a valid normal character.\n\ | 1119 doc: /* Return t if OBJECT is a valid normal character. |
1119 If optional arg GENERICP is non-nil, also return t if OBJECT is\n\ | 1120 If optional arg GENERICP is non-nil, also return t if OBJECT is |
1120 a valid generic character.") | 1121 a valid generic character. */) |
1121 (object, genericp) | 1122 (object, genericp) |
1122 Lisp_Object object, genericp; | 1123 Lisp_Object object, genericp; |
1123 { | 1124 { |
1124 if (! NATNUMP (object)) | 1125 if (! NATNUMP (object)) |
1125 return Qnil; | 1126 return Qnil; |
1126 return (CHAR_VALID_P (XFASTINT (object), !NILP (genericp)) ? Qt : Qnil); | 1127 return (CHAR_VALID_P (XFASTINT (object), !NILP (genericp)) ? Qt : Qnil); |
1127 } | 1128 } |
1128 | 1129 |
1129 DEFUN ("unibyte-char-to-multibyte", Funibyte_char_to_multibyte, | 1130 DEFUN ("unibyte-char-to-multibyte", Funibyte_char_to_multibyte, |
1130 Sunibyte_char_to_multibyte, 1, 1, 0, | 1131 Sunibyte_char_to_multibyte, 1, 1, 0, |
1131 "Convert the unibyte character CH to multibyte character.\n\ | 1132 doc: /* Convert the unibyte character CH to multibyte character. |
1132 The conversion is done based on `nonascii-translation-table' (which see)\n\ | 1133 The conversion is done based on `nonascii-translation-table' (which see) |
1133 or `nonascii-insert-offset' (which see).") | 1134 or `nonascii-insert-offset' (which see). */) |
1134 (ch) | 1135 (ch) |
1135 Lisp_Object ch; | 1136 Lisp_Object ch; |
1136 { | 1137 { |
1137 int c; | 1138 int c; |
1138 | 1139 |
1139 CHECK_NUMBER (ch, 0); | 1140 CHECK_NUMBER (ch, 0); |
1146 return make_number (c); | 1147 return make_number (c); |
1147 } | 1148 } |
1148 | 1149 |
1149 DEFUN ("multibyte-char-to-unibyte", Fmultibyte_char_to_unibyte, | 1150 DEFUN ("multibyte-char-to-unibyte", Fmultibyte_char_to_unibyte, |
1150 Smultibyte_char_to_unibyte, 1, 1, 0, | 1151 Smultibyte_char_to_unibyte, 1, 1, 0, |
1151 "Convert the multibyte character CH to unibyte character.\n\ | 1152 doc: /* Convert the multibyte character CH to unibyte character. |
1152 The conversion is done based on `nonascii-translation-table' (which see)\n\ | 1153 The conversion is done based on `nonascii-translation-table' (which see) |
1153 or `nonascii-insert-offset' (which see).") | 1154 or `nonascii-insert-offset' (which see). */) |
1154 (ch) | 1155 (ch) |
1155 Lisp_Object ch; | 1156 Lisp_Object ch; |
1156 { | 1157 { |
1157 int c; | 1158 int c; |
1158 | 1159 |
1159 CHECK_NUMBER (ch, 0); | 1160 CHECK_NUMBER (ch, 0); |
1165 error ("Can't convert to unibyte character: %d", XINT (ch)); | 1166 error ("Can't convert to unibyte character: %d", XINT (ch)); |
1166 return make_number (c); | 1167 return make_number (c); |
1167 } | 1168 } |
1168 | 1169 |
1169 DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0, | 1170 DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0, |
1170 "Return 1 regardless of the argument CHAR.\n\ | 1171 doc: /* Return 1 regardless of the argument CHAR. |
1171 This is now an obsolete function. We keep it just for backward compatibility.") | 1172 This is now an obsolete function. We keep it just for backward compatibility. */) |
1172 (ch) | 1173 (ch) |
1173 Lisp_Object ch; | 1174 Lisp_Object ch; |
1174 { | 1175 { |
1175 CHECK_NUMBER (ch, 0); | 1176 CHECK_NUMBER (ch, 0); |
1176 return make_number (1); | 1177 return make_number (1); |
1177 } | 1178 } |
1210 && BASE_LEADING_CODE_P (c)) \ | 1211 && BASE_LEADING_CODE_P (c)) \ |
1211 ? WIDTH_BY_CHAR_HEAD (c) \ | 1212 ? WIDTH_BY_CHAR_HEAD (c) \ |
1212 : 4)))) | 1213 : 4)))) |
1213 | 1214 |
1214 DEFUN ("char-width", Fchar_width, Schar_width, 1, 1, 0, | 1215 DEFUN ("char-width", Fchar_width, Schar_width, 1, 1, 0, |
1215 "Return width of CHAR when displayed in the current buffer.\n\ | 1216 doc: /* Return width of CHAR when displayed in the current buffer. |
1216 The width is measured by how many columns it occupies on the screen.\n\ | 1217 The width is measured by how many columns it occupies on the screen. |
1217 Tab is taken to occupy `tab-width' columns.") | 1218 Tab is taken to occupy `tab-width' columns. */) |
1218 (ch) | 1219 (ch) |
1219 Lisp_Object ch; | 1220 Lisp_Object ch; |
1220 { | 1221 { |
1221 Lisp_Object val, disp; | 1222 Lisp_Object val, disp; |
1222 int c; | 1223 int c; |
1223 struct Lisp_Char_Table *dp = buffer_display_table (); | 1224 struct Lisp_Char_Table *dp = buffer_display_table (); |
1224 | 1225 |
1387 | 1388 |
1388 return width; | 1389 return width; |
1389 } | 1390 } |
1390 | 1391 |
1391 DEFUN ("string-width", Fstring_width, Sstring_width, 1, 1, 0, | 1392 DEFUN ("string-width", Fstring_width, Sstring_width, 1, 1, 0, |
1392 "Return width of STRING when displayed in the current buffer.\n\ | 1393 doc: /* Return width of STRING when displayed in the current buffer. |
1393 Width is measured by how many columns it occupies on the screen.\n\ | 1394 Width is measured by how many columns it occupies on the screen. |
1394 When calculating width of a multibyte character in STRING,\n\ | 1395 When calculating width of a multibyte character in STRING, |
1395 only the base leading-code is considered; the validity of\n\ | 1396 only the base leading-code is considered; the validity of |
1396 the following bytes is not checked. Tabs in STRING are always\n\ | 1397 the following bytes is not checked. Tabs in STRING are always |
1397 taken to occupy `tab-width' columns.") | 1398 taken to occupy `tab-width' columns. */) |
1398 (str) | 1399 (str) |
1399 Lisp_Object str; | 1400 Lisp_Object str; |
1400 { | 1401 { |
1401 Lisp_Object val; | 1402 Lisp_Object val; |
1402 | 1403 |
1403 CHECK_STRING (str, 0); | 1404 CHECK_STRING (str, 0); |
1404 XSETFASTINT (val, lisp_string_width (str, -1, NULL, NULL)); | 1405 XSETFASTINT (val, lisp_string_width (str, -1, NULL, NULL)); |
1405 return val; | 1406 return val; |
1406 } | 1407 } |
1407 | 1408 |
1408 DEFUN ("char-direction", Fchar_direction, Schar_direction, 1, 1, 0, | 1409 DEFUN ("char-direction", Fchar_direction, Schar_direction, 1, 1, 0, |
1409 "Return the direction of CHAR.\n\ | 1410 doc: /* Return the direction of CHAR. |
1410 The returned value is 0 for left-to-right and 1 for right-to-left.") | 1411 The returned value is 0 for left-to-right and 1 for right-to-left. */) |
1411 (ch) | 1412 (ch) |
1412 Lisp_Object ch; | 1413 Lisp_Object ch; |
1413 { | 1414 { |
1414 int charset; | 1415 int charset; |
1415 | 1416 |
1416 CHECK_NUMBER (ch, 0); | 1417 CHECK_NUMBER (ch, 0); |
1419 invalid_character (XINT (ch)); | 1420 invalid_character (XINT (ch)); |
1420 return CHARSET_TABLE_INFO (charset, CHARSET_DIRECTION_IDX); | 1421 return CHARSET_TABLE_INFO (charset, CHARSET_DIRECTION_IDX); |
1421 } | 1422 } |
1422 | 1423 |
1423 DEFUN ("chars-in-region", Fchars_in_region, Schars_in_region, 2, 2, 0, | 1424 DEFUN ("chars-in-region", Fchars_in_region, Schars_in_region, 2, 2, 0, |
1424 "Return number of characters between BEG and END.") | 1425 doc: /* Return number of characters between BEG and END. */) |
1425 (beg, end) | 1426 (beg, end) |
1426 Lisp_Object beg, end; | 1427 Lisp_Object beg, end; |
1427 { | 1428 { |
1428 int from, to; | 1429 int from, to; |
1429 | 1430 |
1430 CHECK_NUMBER_COERCE_MARKER (beg, 0); | 1431 CHECK_NUMBER_COERCE_MARKER (beg, 0); |
1626 return (to - str); | 1627 return (to - str); |
1627 } | 1628 } |
1628 | 1629 |
1629 | 1630 |
1630 DEFUN ("string", Fstring, Sstring, 1, MANY, 0, | 1631 DEFUN ("string", Fstring, Sstring, 1, MANY, 0, |
1631 "Concatenate all the argument characters and make the result a string.") | 1632 doc: /* Concatenate all the argument characters and make the result a string. */) |
1632 (n, args) | 1633 (n, args) |
1633 int n; | 1634 int n; |
1634 Lisp_Object *args; | 1635 Lisp_Object *args; |
1635 { | 1636 { |
1636 int i; | 1637 int i; |
1637 unsigned char *buf = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH * n); | 1638 unsigned char *buf = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH * n); |
1672 | 1673 |
1673 return (XINT (XVECTOR (val)->contents[0])); | 1674 return (XINT (XVECTOR (val)->contents[0])); |
1674 } | 1675 } |
1675 | 1676 |
1676 DEFUN ("setup-special-charsets", Fsetup_special_charsets, | 1677 DEFUN ("setup-special-charsets", Fsetup_special_charsets, |
1677 Ssetup_special_charsets, 0, 0, 0, "Internal use only.") | 1678 Ssetup_special_charsets, 0, 0, 0, doc: /* Internal use only. */) |
1678 () | 1679 () |
1679 { | 1680 { |
1680 charset_latin_iso8859_1 = charset_id_internal ("latin-iso8859-1"); | 1681 charset_latin_iso8859_1 = charset_id_internal ("latin-iso8859-1"); |
1681 charset_jisx0208_1978 = charset_id_internal ("japanese-jisx0208-1978"); | 1682 charset_jisx0208_1978 = charset_id_internal ("japanese-jisx0208-1978"); |
1682 charset_jisx0208 = charset_id_internal ("japanese-jisx0208"); | 1683 charset_jisx0208 = charset_id_internal ("japanese-jisx0208"); |
1683 charset_katakana_jisx0201 = charset_id_internal ("katakana-jisx0201"); | 1684 charset_katakana_jisx0201 = charset_id_internal ("katakana-jisx0201"); |
1838 defsubr (&Schars_in_region); | 1839 defsubr (&Schars_in_region); |
1839 defsubr (&Sstring); | 1840 defsubr (&Sstring); |
1840 defsubr (&Ssetup_special_charsets); | 1841 defsubr (&Ssetup_special_charsets); |
1841 | 1842 |
1842 DEFVAR_LISP ("charset-list", &Vcharset_list, | 1843 DEFVAR_LISP ("charset-list", &Vcharset_list, |
1843 "List of charsets ever defined."); | 1844 doc: /* List of charsets ever defined. */); |
1844 Vcharset_list = Fcons (Qascii, Fcons (Qeight_bit_control, | 1845 Vcharset_list = Fcons (Qascii, Fcons (Qeight_bit_control, |
1845 Fcons (Qeight_bit_graphic, Qnil))); | 1846 Fcons (Qeight_bit_graphic, Qnil))); |
1846 | 1847 |
1847 DEFVAR_LISP ("translation-table-vector", &Vtranslation_table_vector, | 1848 DEFVAR_LISP ("translation-table-vector", &Vtranslation_table_vector, |
1848 "Vector of cons cell of a symbol and translation table ever defined.\n\ | 1849 doc: /* Vector of cons cell of a symbol and translation table ever defined. |
1849 An ID of a translation table is an index of this vector."); | 1850 An ID of a translation table is an index of this vector. */); |
1850 Vtranslation_table_vector = Fmake_vector (make_number (16), Qnil); | 1851 Vtranslation_table_vector = Fmake_vector (make_number (16), Qnil); |
1851 | 1852 |
1852 DEFVAR_INT ("leading-code-private-11", &leading_code_private_11, | 1853 DEFVAR_INT ("leading-code-private-11", &leading_code_private_11, |
1853 "Leading-code of private TYPE9N charset of column-width 1."); | 1854 doc: /* Leading-code of private TYPE9N charset of column-width 1. */); |
1854 leading_code_private_11 = LEADING_CODE_PRIVATE_11; | 1855 leading_code_private_11 = LEADING_CODE_PRIVATE_11; |
1855 | 1856 |
1856 DEFVAR_INT ("leading-code-private-12", &leading_code_private_12, | 1857 DEFVAR_INT ("leading-code-private-12", &leading_code_private_12, |
1857 "Leading-code of private TYPE9N charset of column-width 2."); | 1858 doc: /* Leading-code of private TYPE9N charset of column-width 2. */); |
1858 leading_code_private_12 = LEADING_CODE_PRIVATE_12; | 1859 leading_code_private_12 = LEADING_CODE_PRIVATE_12; |
1859 | 1860 |
1860 DEFVAR_INT ("leading-code-private-21", &leading_code_private_21, | 1861 DEFVAR_INT ("leading-code-private-21", &leading_code_private_21, |
1861 "Leading-code of private TYPE9Nx9N charset of column-width 1."); | 1862 doc: /* Leading-code of private TYPE9Nx9N charset of column-width 1. */); |
1862 leading_code_private_21 = LEADING_CODE_PRIVATE_21; | 1863 leading_code_private_21 = LEADING_CODE_PRIVATE_21; |
1863 | 1864 |
1864 DEFVAR_INT ("leading-code-private-22", &leading_code_private_22, | 1865 DEFVAR_INT ("leading-code-private-22", &leading_code_private_22, |
1865 "Leading-code of private TYPE9Nx9N charset of column-width 2."); | 1866 doc: /* Leading-code of private TYPE9Nx9N charset of column-width 2. */); |
1866 leading_code_private_22 = LEADING_CODE_PRIVATE_22; | 1867 leading_code_private_22 = LEADING_CODE_PRIVATE_22; |
1867 | 1868 |
1868 DEFVAR_INT ("nonascii-insert-offset", &nonascii_insert_offset, | 1869 DEFVAR_INT ("nonascii-insert-offset", &nonascii_insert_offset, |
1869 "Offset for converting non-ASCII unibyte codes 0240...0377 to multibyte.\n\ | 1870 doc: /* Offset for converting non-ASCII unibyte codes 0240...0377 to multibyte. |
1870 This is used for converting unibyte text to multibyte,\n\ | 1871 This is used for converting unibyte text to multibyte, |
1871 and for inserting character codes specified by number.\n\n\ | 1872 and for inserting character codes specified by number. |
1872 This serves to convert a Latin-1 or similar 8-bit character code\n\ | 1873 |
1873 to the corresponding Emacs multibyte character code.\n\ | 1874 This serves to convert a Latin-1 or similar 8-bit character code |
1874 Typically the value should be (- (make-char CHARSET 0) 128),\n\ | 1875 to the corresponding Emacs multibyte character code. |
1875 for your choice of character set.\n\ | 1876 Typically the value should be (- (make-char CHARSET 0) 128), |
1876 If `nonascii-translation-table' is non-nil, it overrides this variable."); | 1877 for your choice of character set. |
1878 If `nonascii-translation-table' is non-nil, it overrides this variable. */); | |
1877 nonascii_insert_offset = 0; | 1879 nonascii_insert_offset = 0; |
1878 | 1880 |
1879 DEFVAR_LISP ("nonascii-translation-table", &Vnonascii_translation_table, | 1881 DEFVAR_LISP ("nonascii-translation-table", &Vnonascii_translation_table, |
1880 "Translation table to convert non-ASCII unibyte codes to multibyte.\n\ | 1882 doc: /* Translation table to convert non-ASCII unibyte codes to multibyte. |
1881 This is used for converting unibyte text to multibyte,\n\ | 1883 This is used for converting unibyte text to multibyte, |
1882 and for inserting character codes specified by number.\n\n\ | 1884 and for inserting character codes specified by number. |
1883 Conversion is performed only when multibyte characters are enabled,\n\ | 1885 |
1884 and it serves to convert a Latin-1 or similar 8-bit character code\n\ | 1886 Conversion is performed only when multibyte characters are enabled, |
1885 to the corresponding Emacs character code.\n\n\ | 1887 and it serves to convert a Latin-1 or similar 8-bit character code |
1886 If this is nil, `nonascii-insert-offset' is used instead.\n\ | 1888 to the corresponding Emacs character code. |
1887 See also the docstring of `make-translation-table'."); | 1889 |
1890 If this is nil, `nonascii-insert-offset' is used instead. | |
1891 See also the docstring of `make-translation-table'. */); | |
1888 Vnonascii_translation_table = Qnil; | 1892 Vnonascii_translation_table = Qnil; |
1889 | 1893 |
1890 DEFVAR_LISP ("auto-fill-chars", &Vauto_fill_chars, | 1894 DEFVAR_LISP ("auto-fill-chars", &Vauto_fill_chars, |
1891 "A char-table for characters which invoke auto-filling.\n\ | 1895 doc: /* A char-table for characters which invoke auto-filling. |
1892 Such characters have value t in this table."); | 1896 Such characters have value t in this table. */); |
1893 Vauto_fill_chars = Fmake_char_table (Qauto_fill_chars, Qnil); | 1897 Vauto_fill_chars = Fmake_char_table (Qauto_fill_chars, Qnil); |
1894 CHAR_TABLE_SET (Vauto_fill_chars, make_number (' '), Qt); | 1898 CHAR_TABLE_SET (Vauto_fill_chars, make_number (' '), Qt); |
1895 CHAR_TABLE_SET (Vauto_fill_chars, make_number ('\n'), Qt); | 1899 CHAR_TABLE_SET (Vauto_fill_chars, make_number ('\n'), Qt); |
1896 } | 1900 } |
1897 | 1901 |