diff options
| author | Richard M. Stallman | 1998-01-21 22:06:06 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-01-21 22:06:06 +0000 |
| commit | 35e623fb897f86d14e83675da0e60854439b7e4a (patch) | |
| tree | 9f3394c9687a6ca5eb99e8f0ff161aa20ff283ee /src | |
| parent | b29ff194276468603305b10bc7d662f0eb356603 (diff) | |
| download | emacs-35e623fb897f86d14e83675da0e60854439b7e4a.tar.gz emacs-35e623fb897f86d14e83675da0e60854439b7e4a.zip | |
(nonascii_insert_offset): Variable moved from cmds.c.
(syms_of_charset): Initialize variable.
(unibyte_char_to_multibyte): New function.
(DEFAULT_NONASCII_INSERT_OFFSET): New macro definition.
Diffstat (limited to 'src')
| -rw-r--r-- | src/charset.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/charset.c b/src/charset.c index 9142423d780..dc06837b88a 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Basic multilingual character support. | 1 | /* Basic multilingual character support. |
| 2 | Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN. | 2 | Copyright (C) 1995, 1997, 1998 Electrotechnical Laboratory, JAPAN. |
| 3 | Licensed to the Free Software Foundation. | 3 | Licensed to the Free Software Foundation. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| @@ -92,6 +92,9 @@ int n_cmpchars; | |||
| 92 | unsigned char *_fetch_multibyte_char_p; | 92 | unsigned char *_fetch_multibyte_char_p; |
| 93 | int _fetch_multibyte_char_len; | 93 | int _fetch_multibyte_char_len; |
| 94 | 94 | ||
| 95 | /* Offset to add to a non-ASCII value when inserting it. */ | ||
| 96 | int nonascii_insert_offset; | ||
| 97 | |||
| 95 | #define min(X, Y) ((X) < (Y) ? (X) : (Y)) | 98 | #define min(X, Y) ((X) < (Y) ? (X) : (Y)) |
| 96 | #define max(X, Y) ((X) > (Y) ? (X) : (Y)) | 99 | #define max(X, Y) ((X) > (Y) ? (X) : (Y)) |
| 97 | 100 | ||
| @@ -267,6 +270,26 @@ unify_char (table, c, charset, c1, c2) | |||
| 267 | return MAKE_CHAR (alt_charset, c1, c2); | 270 | return MAKE_CHAR (alt_charset, c1, c2); |
| 268 | } | 271 | } |
| 269 | 272 | ||
| 273 | #define DEFAULT_NONASCII_INSERT_OFFSET 0x800 | ||
| 274 | |||
| 275 | /* Convert the unibyte character C to multibyte | ||
| 276 | based on nonascii_insert_offset. Note that copy_text in insdel.c | ||
| 277 | has similar code. */ | ||
| 278 | |||
| 279 | int | ||
| 280 | unibyte_char_to_multibyte (c) | ||
| 281 | int c; | ||
| 282 | { | ||
| 283 | if (c >= 0200 && c < 0400) | ||
| 284 | { | ||
| 285 | if (nonascii_insert_offset > 0) | ||
| 286 | c += nonascii_insert_offset; | ||
| 287 | else | ||
| 288 | c += DEFAULT_NONASCII_INSERT_OFFSET; | ||
| 289 | } | ||
| 290 | return c; | ||
| 291 | } | ||
| 292 | |||
| 270 | /* Update the table Vcharset_table with the given arguments (see the | 293 | /* Update the table Vcharset_table with the given arguments (see the |
| 271 | document of `define-charset' for the meaning of each argument). | 294 | document of `define-charset' for the meaning of each argument). |
| 272 | Several other table contents are also updated. The caller should | 295 | Several other table contents are also updated. The caller should |
| @@ -1664,6 +1687,13 @@ syms_of_charset () | |||
| 1664 | DEFVAR_INT ("leading-code-private-22", &leading_code_private_22, | 1687 | DEFVAR_INT ("leading-code-private-22", &leading_code_private_22, |
| 1665 | "Leading-code of private TYPE9Nx9N charset of column-width 2."); | 1688 | "Leading-code of private TYPE9Nx9N charset of column-width 2."); |
| 1666 | leading_code_private_22 = LEADING_CODE_PRIVATE_22; | 1689 | leading_code_private_22 = LEADING_CODE_PRIVATE_22; |
| 1690 | |||
| 1691 | DEFVAR_INT ("nonascii-insert-offset", &nonascii_insert_offset, | ||
| 1692 | "Offset to add to a non-ascii code 0200...0377 when inserting it.\n\ | ||
| 1693 | This applies only when multibyte characters are enabled, and it serves\n\ | ||
| 1694 | to convert a Latin-1 or similar 8-bit character code to the corresponding\n\ | ||
| 1695 | Emacs character code."); | ||
| 1696 | nonascii_insert_offset = 0; | ||
| 1667 | } | 1697 | } |
| 1668 | 1698 | ||
| 1669 | #endif /* emacs */ | 1699 | #endif /* emacs */ |