/* Basic character set support.
- Copyright (C) 2001-2013 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)
- Registration Number H14PRO021
- Copyright (C) 2003, 2004
- National Institute of Advanced Industrial Science and Technology (AIST)
- Registration Number H13PRO009
+Copyright (C) 2001-2014 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)
+ Registration Number H14PRO021
+
+Copyright (C) 2003, 2004
+ National Institute of Advanced Industrial Science and Technology (AIST)
+ Registration Number H13PRO009
This file is part of GNU Emacs.
#include <config.h>
-#define CHARSET_INLINE EXTERN_INLINE
-
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
{
if (ascii_compatible_p)
{
- if (! ASCII_BYTE_P (from_c))
+ if (! ASCII_CHAR_P (from_c))
{
if (from_c < nonascii_min_char)
nonascii_min_char = from_c;
}
- else if (! ASCII_BYTE_P (to_c))
+ else if (! ASCII_CHAR_P (to_c))
{
nonascii_min_char = 0x80;
}
count = SPECPDL_INDEX ();
record_unwind_protect_nothing ();
specbind (Qfile_name_handler_alist, Qnil);
- fd = openp (Vcharset_map_path, mapfile, suffixes, NULL, Qnil);
+ fd = openp (Vcharset_map_path, mapfile, suffixes, NULL, Qnil, false);
fp = fd < 0 ? 0 : fdopen (fd, "r");
if (!fp)
{
if (! charset.code_linear_p)
{
- charset.code_space_mask = xzalloc (256);
+ charset.code_space_mask = xzalloc_atomic (256);
for (i = 0; i < 4; i++)
for (j = charset.code_space[i * 4]; j <= charset.code_space[i * 4 + 1];
j++)
if (!NILP (table))
c = translate_char (table, c);
- if (ASCII_BYTE_P (c))
+ if (ASCII_CHAR_P (c))
ASET (charsets, charset_ascii, Qt);
else
ASET (charsets, charset_eight_bit, Qt);
doc: /* Decode the pair of CHARSET and CODE-POINT into a character.
Return nil if CODE-POINT is not valid in CHARSET.
-CODE-POINT may be a cons (HIGHER-16-BIT-VALUE . LOWER-16-BIT-VALUE).
-
-Optional argument RESTRICTION specifies a way to map the pair of CCS
-and CODE-POINT to a character. Currently not supported and just ignored. */)
+CODE-POINT may be a cons (HIGHER-16-BIT-VALUE . LOWER-16-BIT-VALUE). */)
(Lisp_Object charset, Lisp_Object code_point, Lisp_Object restriction)
{
int c, id;
DEFUN ("encode-char", Fencode_char, Sencode_char, 2, 3, 0,
doc: /* Encode the character CH into a code-point of CHARSET.
-Return nil if CHARSET doesn't include CH.
-
-Optional argument RESTRICTION specifies a way to map CH to a
-code-point in CCS. Currently not supported and just ignored. */)
+Return nil if CHARSET doesn't include CH. */)
(Lisp_Object ch, Lisp_Object charset, Lisp_Object restriction)
{
int c, id;
DEFUN ("char-charset", Fchar_charset, Schar_charset, 1, 2, 0,
doc: /* Return the charset of highest priority that contains CH.
+ASCII characters are an exception: for them, this function always
+returns `ascii'.
If optional 2nd arg RESTRICTION is non-nil, it is a list of charsets
from which to find the charset. It may also be a coding system. In
that case, find the charset from what supported by that coding system. */)
obscure problem (eg bug#6401), so better abort. */
fprintf (stderr, "Error: charsets directory not found:\n\
%s\n\
-Emacs will not function correctly without the character map files.\n\
+Emacs will not function correctly without the character map files.\n%s\
Please check your installation!\n",
- SDATA (tempdir));
+ SDATA (tempdir),
+ egetenv("EMACSDATA") ? "The EMACSDATA environment \
+variable is set, maybe it has the wrong value?\n" : "");
exit (1);
}
}
charset_table = charset_table_init;
- charset_table_size = sizeof charset_table_init / sizeof *charset_table_init;
+ charset_table_size = ARRAYELTS (charset_table_init);
charset_table_used = 0;
defsubr (&Scharsetp);
Vcurrent_iso639_language = Qnil;
charset_ascii
- = define_charset_internal (Qascii, 1, "\x00\x7F\x00\x00\x00\x00",
+ = define_charset_internal (Qascii, 1, "\x00\x7F\0\0\0\0\0",
0, 127, 'B', -1, 0, 1, 0, 0);
charset_iso_8859_1
- = define_charset_internal (Qiso_8859_1, 1, "\x00\xFF\x00\x00\x00\x00",
+ = define_charset_internal (Qiso_8859_1, 1, "\x00\xFF\0\0\0\0\0",
0, 255, -1, -1, -1, 1, 0, 0);
charset_unicode
- = define_charset_internal (Qunicode, 3, "\x00\xFF\x00\xFF\x00\x10",
+ = define_charset_internal (Qunicode, 3, "\x00\xFF\x00\xFF\x00\x10\0",
0, MAX_UNICODE_CHAR, -1, 0, -1, 1, 0, 0);
charset_emacs
- = define_charset_internal (Qemacs, 3, "\x00\xFF\x00\xFF\x00\x3F",
+ = define_charset_internal (Qemacs, 3, "\x00\xFF\x00\xFF\x00\x3F\0",
0, MAX_5_BYTE_CHAR, -1, 0, -1, 1, 1, 0);
charset_eight_bit
- = define_charset_internal (Qeight_bit, 1, "\x80\xFF\x00\x00\x00\x00",
+ = define_charset_internal (Qeight_bit, 1, "\x80\xFF\0\0\0\0\0",
128, 255, -1, 0, -1, 0, 1,
MAX_5_BYTE_CHAR + 1);
charset_unibyte = charset_iso_8859_1;