From 35e623fb897f86d14e83675da0e60854439b7e4a Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 21 Jan 1998 22:06:06 +0000 Subject: [PATCH] (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. --- src/charset.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) 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 @@ /* Basic multilingual character support. - Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN. + Copyright (C) 1995, 1997, 1998 Electrotechnical Laboratory, JAPAN. Licensed to the Free Software Foundation. This file is part of GNU Emacs. @@ -92,6 +92,9 @@ int n_cmpchars; unsigned char *_fetch_multibyte_char_p; int _fetch_multibyte_char_len; +/* Offset to add to a non-ASCII value when inserting it. */ +int nonascii_insert_offset; + #define min(X, Y) ((X) < (Y) ? (X) : (Y)) #define max(X, Y) ((X) > (Y) ? (X) : (Y)) @@ -267,6 +270,26 @@ unify_char (table, c, charset, c1, c2) return MAKE_CHAR (alt_charset, c1, c2); } +#define DEFAULT_NONASCII_INSERT_OFFSET 0x800 + +/* Convert the unibyte character C to multibyte + based on nonascii_insert_offset. Note that copy_text in insdel.c + has similar code. */ + +int +unibyte_char_to_multibyte (c) + int c; +{ + if (c >= 0200 && c < 0400) + { + if (nonascii_insert_offset > 0) + c += nonascii_insert_offset; + else + c += DEFAULT_NONASCII_INSERT_OFFSET; + } + return c; +} + /* Update the table Vcharset_table with the given arguments (see the document of `define-charset' for the meaning of each argument). Several other table contents are also updated. The caller should @@ -1664,6 +1687,13 @@ syms_of_charset () DEFVAR_INT ("leading-code-private-22", &leading_code_private_22, "Leading-code of private TYPE9Nx9N charset of column-width 2."); leading_code_private_22 = LEADING_CODE_PRIVATE_22; + + DEFVAR_INT ("nonascii-insert-offset", &nonascii_insert_offset, + "Offset to add to a non-ascii code 0200...0377 when inserting it.\n\ +This applies only when multibyte characters are enabled, and it serves\n\ +to convert a Latin-1 or similar 8-bit character code to the corresponding\n\ +Emacs character code."); + nonascii_insert_offset = 0; } #endif /* emacs */ -- 2.39.2