/* Basic character set support.
- Copyright (C) 2001-2011 Free Software Foundation, Inc.
+ Copyright (C) 2001-2012 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
/* 1 iff the following table is used for encoder. */
short for_encoder;
- /* When the following table is used for encoding, mininum and
- maxinum character of the current charset. */
+ /* When the following table is used for encoding, minimum and
+ maximum character of the current charset. */
int min_char, max_char;
- /* A Unicode character correspoinding to the code indice 0 (i.e. the
+ /* A Unicode character corresponding to the code index 0 (i.e. the
minimum code-point) of the current charset, or -1 if the code
- indice 0 is not a Unicode character. This is checked when
+ index 0 is not a Unicode character. This is checked when
table.encoder[CHAR] is zero. */
int zero_index_char;
return c;
CHECK_CHARSET_GET_CHARSET (val, charset);
+#ifdef REL_ALLOC
+ /* The call to load_charset below can allocate memory, which screws
+ callers of this function through STRING_CHAR_* macros that hold C
+ pointers to buffer text, if REL_ALLOC is used. */
+ r_alloc_inhibit_buffer_relocation (1);
+#endif
load_charset (charset, 1);
if (! inhibit_load_charset_map)
{
if (unified > 0)
c = unified;
}
+#ifdef REL_ALLOC
+ r_alloc_inhibit_buffer_relocation (0);
+#endif
return c;
}
-/* Return a character correponding to the code-point CODE of
+/* Return a character corresponding to the code-point CODE of
CHARSET. */
int
}
else /* method == CHARSET_METHOD_OFFSET */
{
- code = c - CHARSET_CODE_OFFSET (charset);
- code = INDEX_TO_CODE_POINT (charset, code);
+ unsigned code_index = c - CHARSET_CODE_OFFSET (charset);
+
+ code = INDEX_TO_CODE_POINT (charset, code_index);
}
return code;
DEFUN ("charset-after", Fcharset_after, Scharset_after, 0, 1, 0,
doc: /*
Return charset of a character in the current buffer at position POS.
-If POS is nil, it defauls to the current point.
+If POS is nil, it defaults to the current point.
If POS is out of range, the value is nil. */)
(Lisp_Object pos)
{
defsubr (&Ssort_charsets);
DEFVAR_LISP ("charset-map-path", Vcharset_map_path,
- doc: /* *List of directories to search for charset map files. */);
+ doc: /* List of directories to search for charset map files. */);
Vcharset_map_path = Qnil;
DEFVAR_BOOL ("inhibit-load-charset-map", inhibit_load_charset_map,