X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/38d50547c2a8195bed0aaeafbbc4c0f277d4e416..25a48bd06bd5979d201cddde99e2dec1eb54c184:/src/charset.c diff --git a/src/charset.c b/src/charset.c index 8051b11330..229f2c2cda 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1,8 +1,7 @@ /* Basic character set support. - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2001-2011 Free Software Foundation, Inc. Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 + 2005, 2006, 2007, 2008, 2009, 2010, 2011 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H14PRO021 @@ -28,7 +27,6 @@ along with GNU Emacs. If not, see . */ #include #include -#include #include #include #include @@ -55,10 +53,6 @@ along with GNU Emacs. If not, see . */ */ -/* List of all charsets. This variable is used only from Emacs - Lisp. */ -Lisp_Object Vcharset_list; - /* Hash table that contains attributes of each charset. Keys are charset symbols, and values are vectors of charset attributes. */ Lisp_Object Vcharset_hash_table; @@ -115,19 +109,12 @@ Lisp_Object Viso_2022_charset_list; /* List of emacs-mule charsets. */ Lisp_Object Vemacs_mule_charset_list; -struct charset *emacs_mule_charset[256]; +int emacs_mule_charset[256]; /* Mapping table from ISO2022's charset (specified by DIMENSION, CHARS, and FINAL-CHAR) to Emacs' charset. */ int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL]; -Lisp_Object Vcharset_map_path; - -/* If nonzero, don't load charset maps. */ -int inhibit_load_charset_map; - -Lisp_Object Vcurrent_iso639_language; - #define CODE_POINT_TO_INDEX(charset, code) \ ((charset)->code_linear_p \ ? (code) - (charset)->min_code \ @@ -305,7 +292,7 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries, else { if (! temp_charset_work) - temp_charset_work = malloc (sizeof (*temp_charset_work)); + temp_charset_work = xmalloc (sizeof (*temp_charset_work)); if (control_flag == 1) { memset (temp_charset_work->table.decoder, -1, @@ -678,7 +665,7 @@ map_charset_for_dump (void (*c_function) (Lisp_Object, Lisp_Object), Lisp_Object c = temp_charset_work->min_char; stop = (temp_charset_work->max_char < 0x20000 ? temp_charset_work->max_char : 0xFFFF); - + while (1) { int index = GET_TEMP_CHARSET_WORK_ENCODER (c); @@ -1211,7 +1198,7 @@ usage: (define-charset-internal ...) */) if (charset.emacs_mule_id >= 0) { - emacs_mule_charset[charset.emacs_mule_id] = CHARSET_FROM_ID (id); + emacs_mule_charset[charset.emacs_mule_id] = id; if (charset.emacs_mule_id < 0xA0) emacs_mule_bytes[charset.emacs_mule_id] = charset.dimension + 1; else @@ -1266,12 +1253,13 @@ usage: (define-charset-internal ...) */) static int define_charset_internal (Lisp_Object name, int dimension, - const unsigned char *code_space, + const char *code_space_chars, unsigned min_code, unsigned max_code, int iso_final, int iso_revision, int emacs_mule_id, int ascii_compatible, int supplementary, int code_offset) { + const unsigned char *code_space = (const unsigned char *) code_space_chars; Lisp_Object args[charset_arg_max]; Lisp_Object plist[14]; Lisp_Object val; @@ -1840,7 +1828,7 @@ encode_char (struct charset *charset, int c) else { code = GET_TEMP_CHARSET_WORK_ENCODER (c); - code = INDEX_TO_CODE_POINT (charset, code); + code = INDEX_TO_CODE_POINT (charset, code); } } else /* method == CHARSET_METHOD_OFFSET */ @@ -2307,7 +2295,7 @@ init_charset (void) { Lisp_Object tempdir; tempdir = Fexpand_file_name (build_string ("charsets"), Vdata_directory); - if (access ((char *) SDATA (tempdir), 0) < 0) + if (access (SSDATA (tempdir), 0) < 0) { dir_warning ("Error: charsets directory (%s) does not exist.\n\ Emacs will not function correctly without the character map files.\n\ @@ -2331,7 +2319,7 @@ init_charset_once (void) iso_charset_table[i][j][k] = -1; for (i = 0; i < 256; i++) - emacs_mule_charset[i] = NULL; + emacs_mule_charset[i] = -1; charset_jisx0201_roman = -1; charset_jisx0208_1978 = -1; @@ -2365,8 +2353,8 @@ syms_of_charset (void) Vemacs_mule_charset_list = Qnil; /* Don't staticpro them here. It's done in syms_of_fns. */ - QCtest = intern (":test"); - Qeq = intern ("eq"); + QCtest = intern_c_string (":test"); + Qeq = intern_c_string ("eq"); staticpro (&Vcharset_hash_table); { @@ -2405,19 +2393,19 @@ syms_of_charset (void) defsubr (&Scharset_id_internal); defsubr (&Ssort_charsets); - DEFVAR_LISP ("charset-map-path", &Vcharset_map_path, + DEFVAR_LISP ("charset-map-path", Vcharset_map_path, doc: /* *List of directories to search for charset map files. */); Vcharset_map_path = Qnil; - DEFVAR_BOOL ("inhibit-load-charset-map", &inhibit_load_charset_map, + DEFVAR_BOOL ("inhibit-load-charset-map", inhibit_load_charset_map, doc: /* Inhibit loading of charset maps. Used when dumping Emacs. */); inhibit_load_charset_map = 0; - DEFVAR_LISP ("charset-list", &Vcharset_list, + DEFVAR_LISP ("charset-list", Vcharset_list, doc: /* List of all charsets ever defined. */); Vcharset_list = Qnil; - DEFVAR_LISP ("current-iso639-language", &Vcurrent_iso639_language, + DEFVAR_LISP ("current-iso639-language", Vcurrent_iso639_language, doc: /* ISO639 language mnemonic symbol for the current language environment. If the current language environment is for multiple languages (e.g. "Latin-1"), the value may be a list of mnemonics. */); @@ -2443,6 +2431,3 @@ the value may be a list of mnemonics. */); } #endif /* emacs */ - -/* arch-tag: 66a89b8d-4c28-47d3-9ca1-56f78440d69f - (do not change this comment) */