1999-05-03 09:29:11 +02:00
|
|
|
/* winduni.h -- header file for unicode support for windres program.
|
2009-09-02 09:25:43 +02:00
|
|
|
Copyright 1997, 1998, 2002, 2005, 2007
|
2007-05-23 10:48:29 +02:00
|
|
|
Free Software Foundation, Inc.
|
1999-05-03 09:29:11 +02:00
|
|
|
Written by Ian Lance Taylor, Cygnus Support.
|
2007-05-23 10:48:29 +02:00
|
|
|
Rewritten by Kai Tietz, Onevision.
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
This file is part of GNU Binutils.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-07-05 18:54:46 +02:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
1999-05-03 09:29:11 +02:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2005-05-08 16:17:41 +02:00
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
|
|
|
02110-1301, USA. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2002-05-25 14:51:38 +02:00
|
|
|
#include "ansidecl.h"
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2007-05-23 10:48:29 +02:00
|
|
|
#ifndef WINDUNI_H
|
|
|
|
#define WINDUNI_H
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
/* This header file declares the types and functions we use for
|
|
|
|
unicode support in windres. Our unicode support is very limited at
|
|
|
|
present.
|
|
|
|
|
|
|
|
We don't put this stuff in windres.h so that winduni.c doesn't have
|
|
|
|
to include windres.h. winduni.c needs to includes windows.h, and
|
|
|
|
that would conflict with the definitions of Windows macros we
|
|
|
|
already have in windres.h. */
|
|
|
|
|
2007-05-23 10:48:29 +02:00
|
|
|
/* Use bfd_size_type to ensure a sufficient number of bits. */
|
|
|
|
#ifndef DEFINED_RC_UINT_TYPE
|
|
|
|
#define DEFINED_RC_UINT_TYPE
|
|
|
|
typedef bfd_size_type rc_uint_type;
|
|
|
|
#endif
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
/* We use this type to hold a unicode character. */
|
|
|
|
|
|
|
|
typedef unsigned short unichar;
|
|
|
|
|
|
|
|
/* Escape character translations. */
|
|
|
|
|
2007-05-23 10:48:29 +02:00
|
|
|
#define ESCAPE_A 007
|
|
|
|
#define ESCAPE_B 010
|
|
|
|
#define ESCAPE_F 014
|
|
|
|
#define ESCAPE_N 012
|
|
|
|
#define ESCAPE_R 015
|
|
|
|
#define ESCAPE_T 011
|
|
|
|
#define ESCAPE_V 013
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
/* Convert an ASCII string to a unicode string. */
|
2007-05-23 10:48:29 +02:00
|
|
|
extern void unicode_from_ascii (rc_uint_type *, unichar **, const char *);
|
|
|
|
|
|
|
|
/* Convert an unicode string to an ASCII string. */
|
|
|
|
extern void ascii_from_unicode (rc_uint_type *, const unichar *, char **);
|
|
|
|
|
|
|
|
/* Duplicate a unicode string by using res_alloc. */
|
|
|
|
extern unichar *unichar_dup (const unichar *);
|
|
|
|
|
|
|
|
/* Duplicate a unicode string by using res_alloc and make it uppercase. */
|
|
|
|
extern unichar *unichar_dup_uppercase (const unichar *);
|
|
|
|
|
|
|
|
/* The count of unichar elements. */
|
|
|
|
extern rc_uint_type unichar_len (const unichar *);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
/* Print a unicode string to a file. */
|
2007-05-23 10:48:29 +02:00
|
|
|
extern void unicode_print (FILE *, const unichar *, rc_uint_type);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2007-05-23 10:48:29 +02:00
|
|
|
/* Print a ascii string to a file. */
|
|
|
|
extern void ascii_print (FILE *, const char *, rc_uint_type);
|
|
|
|
|
|
|
|
/* Print a quoted unicode string to a file. */
|
|
|
|
extern void unicode_print_quoted (FILE *, const unichar *, rc_uint_type);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
* Makefile.am: Add LIBICONV to windres.
* acinclude.m4: Added missing "lib-*.m4" and "lt*.m4" files.
* configure.in: Add AC_CHECK_HEADER for iconv.h and use AM_ICONV.
* config.in: Add ICONV defines.
* aclocal: Regenerate.
* confugure: Regenerate.
* winduni.c: (local_iconv_map codepages, wind_language_t, languages, unicode_is$
(ascii_from_unicode): Use codepage_from_unicode.
(ascii_from_unicode): Use unicode_from_codepage.
Use for cygwin windows API for unicode transformation.
* winduni.h: (CP_ACP, CP_UTF7, CP_UTF8, CP_OEM, CP_UTF16): New macros.
(wind_language_t, local_iconv_map): New types.
(wind_find_language_by_id, wind_find_language_by_codepage,
(unicode_is_valid_codepage, wind_find_codepage_info, unicode_from_codepage, c$
2007-06-05 15:10:30 +02:00
|
|
|
#ifndef CP_UTF8
|
|
|
|
#define CP_UTF7 65000 /* UTF-7 translation. */
|
|
|
|
#define CP_UTF8 65001 /* UTF-8 translation. */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CP_UTF16
|
|
|
|
#define CP_UTF16 65002 /* UTF-16 translation. */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CP_ACP
|
|
|
|
#define CP_ACP 0 /* Default to ANSI code page. */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CP_OEM
|
|
|
|
#define CP_OEM 1 /* Default OEM code page. */
|
|
|
|
#endif
|
|
|
|
|
2007-06-18 17:30:33 +02:00
|
|
|
/* Specifies the default codepage to be used for unicode
|
|
|
|
transformations. By default this is CP_ACP. */
|
|
|
|
extern rc_uint_type wind_default_codepage;
|
|
|
|
|
|
|
|
/* Specifies the currently used codepage for unicode
|
|
|
|
transformations. By default this is CP_ACP. */
|
|
|
|
extern rc_uint_type wind_current_codepage;
|
|
|
|
|
* Makefile.am: Add LIBICONV to windres.
* acinclude.m4: Added missing "lib-*.m4" and "lt*.m4" files.
* configure.in: Add AC_CHECK_HEADER for iconv.h and use AM_ICONV.
* config.in: Add ICONV defines.
* aclocal: Regenerate.
* confugure: Regenerate.
* winduni.c: (local_iconv_map codepages, wind_language_t, languages, unicode_is$
(ascii_from_unicode): Use codepage_from_unicode.
(ascii_from_unicode): Use unicode_from_codepage.
Use for cygwin windows API for unicode transformation.
* winduni.h: (CP_ACP, CP_UTF7, CP_UTF8, CP_OEM, CP_UTF16): New macros.
(wind_language_t, local_iconv_map): New types.
(wind_find_language_by_id, wind_find_language_by_codepage,
(unicode_is_valid_codepage, wind_find_codepage_info, unicode_from_codepage, c$
2007-06-05 15:10:30 +02:00
|
|
|
typedef struct wind_language_t
|
|
|
|
{
|
|
|
|
unsigned id;
|
|
|
|
unsigned doscp;
|
|
|
|
unsigned wincp;
|
|
|
|
const char *name;
|
|
|
|
const char *country;
|
|
|
|
} wind_language_t;
|
|
|
|
|
|
|
|
extern const wind_language_t *wind_find_language_by_id (unsigned);
|
|
|
|
extern int unicode_is_valid_codepage (rc_uint_type);
|
|
|
|
|
|
|
|
typedef struct local_iconv_map
|
|
|
|
{
|
|
|
|
rc_uint_type codepage;
|
|
|
|
const char * iconv_name;
|
|
|
|
} local_iconv_map;
|
|
|
|
|
|
|
|
extern const local_iconv_map *wind_find_codepage_info (unsigned);
|
|
|
|
|
|
|
|
/* Convert an Codepage string to a unicode string. */
|
|
|
|
extern void unicode_from_codepage (rc_uint_type *, unichar **, const char *, rc_uint_type);
|
|
|
|
|
|
|
|
/* Convert an unicode string to an codepage string. */
|
|
|
|
extern void codepage_from_unicode (rc_uint_type *, const unichar *, char **, rc_uint_type);
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
/* Windres support routine called by unicode_from_ascii. This is both
|
|
|
|
here and in windres.h. It should probably be in a separate header
|
|
|
|
file, but it hardly seems worth it for one function. */
|
|
|
|
|
2007-05-23 10:48:29 +02:00
|
|
|
extern void * res_alloc (rc_uint_type);
|
|
|
|
|
|
|
|
#endif
|