mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
[Android] Add in a static libiconv library so non English games don't crash Dolphin Mobile.
This commit is contained in:
@@ -649,6 +649,15 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT ANDROID)
|
||||
check_lib(ICONV ICONV iconv.h)
|
||||
endif()
|
||||
if (NOT ICONV_FOUND)
|
||||
message("Using static iconv from Externals")
|
||||
include_directories(Externals/libiconv-1.14/include)
|
||||
add_subdirectory(Externals/libiconv-1.14)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID)
|
||||
find_library(CL OpenCL)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-weak_framework,OpenCL")
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ChangeLog merge=merge-changelog
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
include_directories(include)
|
||||
include_directories(libcharset/include)
|
||||
|
||||
set(SRCS lib/iconv.c
|
||||
lib/relocatable.c
|
||||
libcharset/lib/localcharset.c
|
||||
)
|
||||
|
||||
add_library(iconv STATIC ${SRCS})
|
||||
Vendored
+927
File diff suppressed because it is too large
Load Diff
+6
@@ -0,0 +1,6 @@
|
||||
|
||||
#if @HAVE_VISIBILITY@ && BUILDING_LIBICONV
|
||||
#define LIBICONV_DLL_EXPORTED __attribute__((__visibility__("default")))
|
||||
#else
|
||||
#define LIBICONV_DLL_EXPORTED
|
||||
#endif
|
||||
+248
@@ -0,0 +1,248 @@
|
||||
/* Copyright (C) 1999-2003, 2005-2006, 2008-2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU LIBICONV Library.
|
||||
|
||||
The GNU LIBICONV Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
The GNU LIBICONV Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* When installed, this file is called "iconv.h". */
|
||||
|
||||
#ifndef _LIBICONV_H
|
||||
#define _LIBICONV_H
|
||||
|
||||
#define _LIBICONV_VERSION 0x010E /* version number: (major<<8) + minor */
|
||||
|
||||
#if 1 && BUILDING_LIBICONV
|
||||
#define LIBICONV_DLL_EXPORTED __attribute__((__visibility__("default")))
|
||||
#else
|
||||
#define LIBICONV_DLL_EXPORTED
|
||||
#endif
|
||||
extern LIBICONV_DLL_EXPORTED int _libiconv_version; /* Likewise */
|
||||
|
||||
/* We would like to #include any system header file which could define
|
||||
iconv_t, 1. in order to eliminate the risk that the user gets compilation
|
||||
errors because some other system header file includes /usr/include/iconv.h
|
||||
which defines iconv_t or declares iconv after this file, 2. when compiling
|
||||
for LIBICONV_PLUG, we need the proper iconv_t type in order to produce
|
||||
binary compatible code.
|
||||
But gcc's #include_next is not portable. Thus, once libiconv's iconv.h
|
||||
has been installed in /usr/local/include, there is no way any more to
|
||||
include the original /usr/include/iconv.h. We simply have to get away
|
||||
without it.
|
||||
Ad 1. The risk that a system header file does
|
||||
#include "iconv.h" or #include_next "iconv.h"
|
||||
is small. They all do #include <iconv.h>.
|
||||
Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It
|
||||
has to be a scalar type because (iconv_t)(-1) is a possible return value
|
||||
from iconv_open().) */
|
||||
|
||||
/* Define iconv_t ourselves. */
|
||||
#undef iconv_t
|
||||
#define iconv_t libiconv_t
|
||||
typedef void* iconv_t;
|
||||
|
||||
/* Get size_t declaration.
|
||||
Get wchar_t declaration if it exists. */
|
||||
#include <stddef.h>
|
||||
|
||||
/* Get errno declaration and values. */
|
||||
#include <errno.h>
|
||||
/* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS,
|
||||
have EILSEQ in a different header. On these systems, define EILSEQ
|
||||
ourselves. */
|
||||
#ifndef EILSEQ
|
||||
#define EILSEQ
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Allocates descriptor for code conversion from encoding ‘fromcode’ to
|
||||
encoding ‘tocode’. */
|
||||
#ifndef LIBICONV_PLUG
|
||||
#define iconv_open libiconv_open
|
||||
#endif
|
||||
extern LIBICONV_DLL_EXPORTED iconv_t iconv_open (const char* tocode, const char* fromcode);
|
||||
|
||||
/* Converts, using conversion descriptor ‘cd’, at most ‘*inbytesleft’ bytes
|
||||
starting at ‘*inbuf’, writing at most ‘*outbytesleft’ bytes starting at
|
||||
‘*outbuf’.
|
||||
Decrements ‘*inbytesleft’ and increments ‘*inbuf’ by the same amount.
|
||||
Decrements ‘*outbytesleft’ and increments ‘*outbuf’ by the same amount. */
|
||||
#ifndef LIBICONV_PLUG
|
||||
#define iconv libiconv
|
||||
#endif
|
||||
extern LIBICONV_DLL_EXPORTED size_t iconv (iconv_t cd, char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
|
||||
|
||||
/* Frees resources allocated for conversion descriptor ‘cd’. */
|
||||
#ifndef LIBICONV_PLUG
|
||||
#define iconv_close libiconv_close
|
||||
#endif
|
||||
extern LIBICONV_DLL_EXPORTED int iconv_close (iconv_t cd);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef LIBICONV_PLUG
|
||||
|
||||
/* Nonstandard extensions. */
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
||||
<wchar.h>.
|
||||
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
||||
included before <wchar.h>. */
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#endif
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* A type that holds all memory needed by a conversion descriptor.
|
||||
A pointer to such an object can be used as an iconv_t. */
|
||||
typedef struct {
|
||||
void* dummy1[28];
|
||||
#if 1
|
||||
mbstate_t dummy2;
|
||||
#endif
|
||||
} iconv_allocation_t;
|
||||
|
||||
/* Allocates descriptor for code conversion from encoding ‘fromcode’ to
|
||||
encoding ‘tocode’ into preallocated memory. Returns an error indicator
|
||||
(0 or -1 with errno set). */
|
||||
#define iconv_open_into libiconv_open_into
|
||||
extern LIBICONV_DLL_EXPORTED int iconv_open_into (const char* tocode, const char* fromcode,
|
||||
iconv_allocation_t* resultp);
|
||||
|
||||
/* Control of attributes. */
|
||||
#define iconvctl libiconvctl
|
||||
extern LIBICONV_DLL_EXPORTED int iconvctl (iconv_t cd, int request, void* argument);
|
||||
|
||||
/* Hook performed after every successful conversion of a Unicode character. */
|
||||
typedef void (*iconv_unicode_char_hook) (unsigned int uc, void* data);
|
||||
/* Hook performed after every successful conversion of a wide character. */
|
||||
typedef void (*iconv_wide_char_hook) (wchar_t wc, void* data);
|
||||
/* Set of hooks. */
|
||||
struct iconv_hooks {
|
||||
iconv_unicode_char_hook uc_hook;
|
||||
iconv_wide_char_hook wc_hook;
|
||||
void* data;
|
||||
};
|
||||
|
||||
/* Fallback function. Invoked when a small number of bytes could not be
|
||||
converted to a Unicode character. This function should process all
|
||||
bytes from inbuf and may produce replacement Unicode characters by calling
|
||||
the write_replacement callback repeatedly. */
|
||||
typedef void (*iconv_unicode_mb_to_uc_fallback)
|
||||
(const char* inbuf, size_t inbufsize,
|
||||
void (*write_replacement) (const unsigned int *buf, size_t buflen,
|
||||
void* callback_arg),
|
||||
void* callback_arg,
|
||||
void* data);
|
||||
/* Fallback function. Invoked when a Unicode character could not be converted
|
||||
to the target encoding. This function should process the character and
|
||||
may produce replacement bytes (in the target encoding) by calling the
|
||||
write_replacement callback repeatedly. */
|
||||
typedef void (*iconv_unicode_uc_to_mb_fallback)
|
||||
(unsigned int code,
|
||||
void (*write_replacement) (const char *buf, size_t buflen,
|
||||
void* callback_arg),
|
||||
void* callback_arg,
|
||||
void* data);
|
||||
#if 1
|
||||
/* Fallback function. Invoked when a number of bytes could not be converted to
|
||||
a wide character. This function should process all bytes from inbuf and may
|
||||
produce replacement wide characters by calling the write_replacement
|
||||
callback repeatedly. */
|
||||
typedef void (*iconv_wchar_mb_to_wc_fallback)
|
||||
(const char* inbuf, size_t inbufsize,
|
||||
void (*write_replacement) (const wchar_t *buf, size_t buflen,
|
||||
void* callback_arg),
|
||||
void* callback_arg,
|
||||
void* data);
|
||||
/* Fallback function. Invoked when a wide character could not be converted to
|
||||
the target encoding. This function should process the character and may
|
||||
produce replacement bytes (in the target encoding) by calling the
|
||||
write_replacement callback repeatedly. */
|
||||
typedef void (*iconv_wchar_wc_to_mb_fallback)
|
||||
(wchar_t code,
|
||||
void (*write_replacement) (const char *buf, size_t buflen,
|
||||
void* callback_arg),
|
||||
void* callback_arg,
|
||||
void* data);
|
||||
#else
|
||||
/* If the wchar_t type does not exist, these two fallback functions are never
|
||||
invoked. Their argument list therefore does not matter. */
|
||||
typedef void (*iconv_wchar_mb_to_wc_fallback) ();
|
||||
typedef void (*iconv_wchar_wc_to_mb_fallback) ();
|
||||
#endif
|
||||
/* Set of fallbacks. */
|
||||
struct iconv_fallbacks {
|
||||
iconv_unicode_mb_to_uc_fallback mb_to_uc_fallback;
|
||||
iconv_unicode_uc_to_mb_fallback uc_to_mb_fallback;
|
||||
iconv_wchar_mb_to_wc_fallback mb_to_wc_fallback;
|
||||
iconv_wchar_wc_to_mb_fallback wc_to_mb_fallback;
|
||||
void* data;
|
||||
};
|
||||
|
||||
/* Requests for iconvctl. */
|
||||
#define ICONV_TRIVIALP 0 /* int *argument */
|
||||
#define ICONV_GET_TRANSLITERATE 1 /* int *argument */
|
||||
#define ICONV_SET_TRANSLITERATE 2 /* const int *argument */
|
||||
#define ICONV_GET_DISCARD_ILSEQ 3 /* int *argument */
|
||||
#define ICONV_SET_DISCARD_ILSEQ 4 /* const int *argument */
|
||||
#define ICONV_SET_HOOKS 5 /* const struct iconv_hooks *argument */
|
||||
#define ICONV_SET_FALLBACKS 6 /* const struct iconv_fallbacks *argument */
|
||||
|
||||
/* Listing of locale independent encodings. */
|
||||
#define iconvlist libiconvlist
|
||||
extern LIBICONV_DLL_EXPORTED void iconvlist (int (*do_one) (unsigned int namescount,
|
||||
const char * const * names,
|
||||
void* data),
|
||||
void* data);
|
||||
|
||||
/* Canonicalize an encoding name.
|
||||
The result is either a canonical encoding name, or name itself. */
|
||||
extern LIBICONV_DLL_EXPORTED const char * iconv_canonicalize (const char * name);
|
||||
|
||||
/* Support for relocatable packages. */
|
||||
|
||||
/* Sets the original and the current installation prefix of the package.
|
||||
Relocation simply replaces a pathname starting with the original prefix
|
||||
by the corresponding pathname with the current prefix instead. Both
|
||||
prefixes should be directory names without trailing slash (i.e. use ""
|
||||
instead of "/"). */
|
||||
extern LIBICONV_DLL_EXPORTED void libiconv_set_relocation_prefix (const char *orig_prefix,
|
||||
const char *curr_prefix);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _LIBICONV_H */
|
||||
+1719
File diff suppressed because it is too large
Load Diff
+40
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 1999-2003, 2008 Free Software Foundation, Inc.
|
||||
* This file is part of the GNU LIBICONV Library.
|
||||
*
|
||||
* The GNU LIBICONV Library is free software; you can redistribute it
|
||||
* and/or modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* The GNU LIBICONV Library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
||||
* If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef USE_AIX
|
||||
# if defined _AIX
|
||||
# include "aliases_aix_sysaix.h"
|
||||
# else
|
||||
# include "aliases_aix.h"
|
||||
# endif
|
||||
#endif
|
||||
#ifdef USE_OSF1
|
||||
# if defined __osf__
|
||||
# include "aliases_osf1_sysosf1.h"
|
||||
# else
|
||||
# include "aliases_osf1.h"
|
||||
# endif
|
||||
#endif
|
||||
#ifdef USE_DOS
|
||||
# include "aliases_dos.h"
|
||||
#endif
|
||||
#ifdef USE_EXTRA
|
||||
# include "aliases_extra.h"
|
||||
#endif
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
S(aix_0, "CP856", ei_cp856 )
|
||||
S(aix_1, "CP922", ei_cp922 )
|
||||
S(aix_2, "CP943", ei_cp943 )
|
||||
S(aix_3, "CP1046", ei_cp1046 )
|
||||
S(aix_4, "CP1124", ei_cp1124 )
|
||||
S(aix_5, "CP1129", ei_cp1129 )
|
||||
S(aix_6, "CP1161", ei_cp1161 )
|
||||
S(aix_7, "IBM1161", ei_cp1161 )
|
||||
S(aix_8, "IBM-1161", ei_cp1161 )
|
||||
S(aix_9, "CSIBM1161", ei_cp1161 )
|
||||
S(aix_10, "CP1162", ei_cp1162 )
|
||||
S(aix_11, "IBM1162", ei_cp1162 )
|
||||
S(aix_12, "IBM-1162", ei_cp1162 )
|
||||
S(aix_13, "CSIBM1162", ei_cp1162 )
|
||||
S(aix_14, "CP1163", ei_cp1163 )
|
||||
S(aix_15, "IBM1163", ei_cp1163 )
|
||||
S(aix_16, "IBM-1163", ei_cp1163 )
|
||||
S(aix_17, "CSIBM1163", ei_cp1163 )
|
||||
@@ -0,0 +1,24 @@
|
||||
S(aix_0, "CP856", ei_cp856 )
|
||||
S(aix_1, "IBM-856", ei_cp856 )
|
||||
S(aix_2, "CP922", ei_cp922 )
|
||||
S(aix_3, "IBM-922", ei_cp922 )
|
||||
S(aix_4, "CP943", ei_cp943 )
|
||||
S(aix_5, "IBM-943", ei_cp943 )
|
||||
S(aix_6, "CP1046", ei_cp1046 )
|
||||
S(aix_7, "IBM-1046", ei_cp1046 )
|
||||
S(aix_8, "CP1124", ei_cp1124 )
|
||||
S(aix_9, "IBM-1124", ei_cp1124 )
|
||||
S(aix_10, "CP1129", ei_cp1129 )
|
||||
S(aix_11, "IBM-1129", ei_cp1129 )
|
||||
S(aix_12, "CP1161", ei_cp1161 )
|
||||
S(aix_13, "IBM1161", ei_cp1161 )
|
||||
S(aix_14, "IBM-1161", ei_cp1161 )
|
||||
S(aix_15, "CSIBM1161", ei_cp1161 )
|
||||
S(aix_16, "CP1162", ei_cp1162 )
|
||||
S(aix_17, "IBM1162", ei_cp1162 )
|
||||
S(aix_18, "IBM-1162", ei_cp1162 )
|
||||
S(aix_19, "CSIBM1162", ei_cp1162 )
|
||||
S(aix_20, "CP1163", ei_cp1163 )
|
||||
S(aix_21, "IBM1163", ei_cp1163 )
|
||||
S(aix_22, "IBM-1163", ei_cp1163 )
|
||||
S(aix_23, "CSIBM1163", ei_cp1163 )
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
S(dos_0, "CP437", ei_cp437 )
|
||||
S(dos_1, "IBM437", ei_cp437 )
|
||||
S(dos_2, "437", ei_cp437 )
|
||||
S(dos_3, "CSPC8CODEPAGE437", ei_cp437 )
|
||||
S(dos_4, "CP737", ei_cp737 )
|
||||
S(dos_5, "CP775", ei_cp775 )
|
||||
S(dos_6, "IBM775", ei_cp775 )
|
||||
S(dos_7, "CSPC775BALTIC", ei_cp775 )
|
||||
S(dos_8, "CP852", ei_cp852 )
|
||||
S(dos_9, "IBM852", ei_cp852 )
|
||||
S(dos_10, "852", ei_cp852 )
|
||||
S(dos_11, "CSPCP852", ei_cp852 )
|
||||
S(dos_12, "CP853", ei_cp853 )
|
||||
S(dos_13, "CP855", ei_cp855 )
|
||||
S(dos_14, "IBM855", ei_cp855 )
|
||||
S(dos_15, "855", ei_cp855 )
|
||||
S(dos_16, "CSIBM855", ei_cp855 )
|
||||
S(dos_17, "CP857", ei_cp857 )
|
||||
S(dos_18, "IBM857", ei_cp857 )
|
||||
S(dos_19, "857", ei_cp857 )
|
||||
S(dos_20, "CSIBM857", ei_cp857 )
|
||||
S(dos_21, "CP858", ei_cp858 )
|
||||
S(dos_22, "CP860", ei_cp860 )
|
||||
S(dos_23, "IBM860", ei_cp860 )
|
||||
S(dos_24, "860", ei_cp860 )
|
||||
S(dos_25, "CSIBM860", ei_cp860 )
|
||||
S(dos_26, "CP861", ei_cp861 )
|
||||
S(dos_27, "IBM861", ei_cp861 )
|
||||
S(dos_28, "861", ei_cp861 )
|
||||
S(dos_29, "CP-IS", ei_cp861 )
|
||||
S(dos_30, "CSIBM861", ei_cp861 )
|
||||
S(dos_31, "CP863", ei_cp863 )
|
||||
S(dos_32, "IBM863", ei_cp863 )
|
||||
S(dos_33, "863", ei_cp863 )
|
||||
S(dos_34, "CSIBM863", ei_cp863 )
|
||||
S(dos_35, "CP864", ei_cp864 )
|
||||
S(dos_36, "IBM864", ei_cp864 )
|
||||
S(dos_37, "CSIBM864", ei_cp864 )
|
||||
S(dos_38, "CP865", ei_cp865 )
|
||||
S(dos_39, "IBM865", ei_cp865 )
|
||||
S(dos_40, "865", ei_cp865 )
|
||||
S(dos_41, "CSIBM865", ei_cp865 )
|
||||
S(dos_42, "CP869", ei_cp869 )
|
||||
S(dos_43, "IBM869", ei_cp869 )
|
||||
S(dos_44, "869", ei_cp869 )
|
||||
S(dos_45, "CP-GR", ei_cp869 )
|
||||
S(dos_46, "CSIBM869", ei_cp869 )
|
||||
S(dos_47, "CP1125", ei_cp1125 )
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
S(extra_0, "EUC-JISX0213", ei_euc_jisx0213 )
|
||||
S(extra_1, "EUC-JIS-2004", ei_euc_jisx0213 )
|
||||
S(extra_2, "SHIFT_JISX0213", ei_shift_jisx0213 )
|
||||
S(extra_3, "SHIFT_JIS-2004", ei_shift_jisx0213 )
|
||||
S(extra_4, "ISO-2022-JP-3", ei_iso2022_jp3 )
|
||||
S(extra_5, "ISO-2022-JP-2004", ei_iso2022_jp3 )
|
||||
S(extra_6, "BIG5-2003", ei_big5_2003 )
|
||||
S(extra_7, "TDS565", ei_tds565 )
|
||||
S(extra_8, "ISO-IR-230", ei_tds565 )
|
||||
S(extra_9, "ATARIST", ei_atarist )
|
||||
S(extra_10, "ATARI", ei_atarist )
|
||||
S(extra_11, "RISCOS-LATIN1", ei_riscos1 )
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
S(osf1_0, "DEC-KANJI", ei_dec_kanji )
|
||||
S(osf1_1, "DEC-HANYU", ei_dec_hanyu )
|
||||
@@ -0,0 +1,4 @@
|
||||
S(osf1_0, "DEC-KANJI", ei_dec_kanji )
|
||||
S(osf1_1, "DECKANJI", ei_dec_kanji )
|
||||
S(osf1_2, "DEC-HANYU", ei_dec_hanyu )
|
||||
S(osf1_3, "DECHANYU", ei_dec_hanyu )
|
||||
+1769
File diff suppressed because it is too large
Load Diff
+1773
File diff suppressed because it is too large
Load Diff
+1745
File diff suppressed because it is too large
Load Diff
+1756
File diff suppressed because it is too large
Load Diff
+116
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (C) 1999-2002 Free Software Foundation, Inc.
|
||||
* This file is part of the GNU LIBICONV Library.
|
||||
*
|
||||
* The GNU LIBICONV Library is free software; you can redistribute it
|
||||
* and/or modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* The GNU LIBICONV Library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
||||
* If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ARMSCII-8
|
||||
*/
|
||||
|
||||
static const unsigned short armscii_8_2uni[96] = {
|
||||
/* 0xa0 */
|
||||
0x00a0, 0xfffd, 0x0587, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab,
|
||||
0x2014, 0x002e, 0x055d, 0x002c, 0x002d, 0x058a, 0x2026, 0x055c,
|
||||
/* 0xb0 */
|
||||
0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563,
|
||||
0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567,
|
||||
/* 0xc0 */
|
||||
0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b,
|
||||
0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f,
|
||||
/* 0xd0 */
|
||||
0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573,
|
||||
0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577,
|
||||
/* 0xe0 */
|
||||
0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b,
|
||||
0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f,
|
||||
/* 0xf0 */
|
||||
0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583,
|
||||
0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x055a, 0xfffd,
|
||||
};
|
||||
|
||||
static int
|
||||
armscii_8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
|
||||
{
|
||||
unsigned char c = *s;
|
||||
if (c < 0xa0) {
|
||||
*pwc = (ucs4_t) c;
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
unsigned short wc = armscii_8_2uni[c-0xa0];
|
||||
if (wc != 0xfffd) {
|
||||
*pwc = (ucs4_t) wc;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return RET_ILSEQ;
|
||||
}
|
||||
|
||||
static const unsigned char armscii_8_page00[8] = {
|
||||
0xa5, 0xa4, 0x2a, 0x2b, 0xab, 0xac, 0xa9, 0x2f, /* 0x28-0x2f */
|
||||
};
|
||||
static const unsigned char armscii_8_page00_1[32] = {
|
||||
0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
|
||||
0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */
|
||||
0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
|
||||
};
|
||||
static const unsigned char armscii_8_page05[96] = {
|
||||
0x00, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, /* 0x30-0x37 */
|
||||
0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, /* 0x38-0x3f */
|
||||
0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, /* 0x40-0x47 */
|
||||
0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, /* 0x48-0x4f */
|
||||
0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0x00, /* 0x50-0x57 */
|
||||
0x00, 0x00, 0xfe, 0xb0, 0xaf, 0xaa, 0xb1, 0x00, /* 0x58-0x5f */
|
||||
0x00, 0xb3, 0xb5, 0xb7, 0xb9, 0xbb, 0xbd, 0xbf, /* 0x60-0x67 */
|
||||
0xc1, 0xc3, 0xc5, 0xc7, 0xc9, 0xcb, 0xcd, 0xcf, /* 0x68-0x6f */
|
||||
0xd1, 0xd3, 0xd5, 0xd7, 0xd9, 0xdb, 0xdd, 0xdf, /* 0x70-0x77 */
|
||||
0xe1, 0xe3, 0xe5, 0xe7, 0xe9, 0xeb, 0xed, 0xef, /* 0x78-0x7f */
|
||||
0xf1, 0xf3, 0xf5, 0xf7, 0xf9, 0xfb, 0xfd, 0xa2, /* 0x80-0x87 */
|
||||
0x00, 0xa3, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
|
||||
};
|
||||
static const unsigned char armscii_8_page20[24] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0x00, /* 0x20-0x27 */
|
||||
};
|
||||
|
||||
static int
|
||||
armscii_8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
|
||||
{
|
||||
unsigned char c = 0;
|
||||
if (wc < 0x0028) {
|
||||
*r = wc;
|
||||
return 1;
|
||||
}
|
||||
else if (wc >= 0x0028 && wc < 0x0030)
|
||||
c = armscii_8_page00[wc-0x0028];
|
||||
else if (wc >= 0x0030 && wc < 0x00a0)
|
||||
c = wc;
|
||||
else if (wc >= 0x00a0 && wc < 0x00c0)
|
||||
c = armscii_8_page00_1[wc-0x00a0];
|
||||
else if (wc >= 0x0530 && wc < 0x0590)
|
||||
c = armscii_8_page05[wc-0x0530];
|
||||
else if (wc >= 0x2010 && wc < 0x2028)
|
||||
c = armscii_8_page20[wc-0x2010];
|
||||
if (c != 0) {
|
||||
*r = c;
|
||||
return 1;
|
||||
}
|
||||
return RET_ILUNI;
|
||||
}
|
||||
Vendored
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 1999-2001 Free Software Foundation, Inc.
|
||||
* This file is part of the GNU LIBICONV Library.
|
||||
*
|
||||
* The GNU LIBICONV Library is free software; you can redistribute it
|
||||
* and/or modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* The GNU LIBICONV Library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
||||
* If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASCII
|
||||
*/
|
||||
|
||||
static int
|
||||
ascii_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
|
||||
{
|
||||
unsigned char c = *s;
|
||||
if (c < 0x80) {
|
||||
*pwc = (ucs4_t) c;
|
||||
return 1;
|
||||
}
|
||||
return RET_ILSEQ;
|
||||
}
|
||||
|
||||
static int
|
||||
ascii_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
|
||||
{
|
||||
if (wc < 0x0080) {
|
||||
*r = wc;
|
||||
return 1;
|
||||
}
|
||||
return RET_ILUNI;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user