URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/tags/gnu-src/newlib-1.18.0/newlib-1.18.0-or32-1.0rc2/newlib/libc/iconv/ces
- from Rev 207 to Rev 520
- ↔ Reverse comparison
Rev 207 → Rev 520
/Makefile.in
0,0 → 1,579
# Makefile.in generated by automake 1.11 from Makefile.am. |
# @configure_input@ |
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, |
# Inc. |
# This Makefile.in is free software; the Free Software Foundation |
# gives unlimited permission to copy and/or distribute it, |
# with or without modifications, as long as this notice is preserved. |
|
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without |
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
# PARTICULAR PURPOSE. |
|
@SET_MAKE@ |
|
|
VPATH = @srcdir@ |
pkgdatadir = $(datadir)/@PACKAGE@ |
pkgincludedir = $(includedir)/@PACKAGE@ |
pkglibdir = $(libdir)/@PACKAGE@ |
pkglibexecdir = $(libexecdir)/@PACKAGE@ |
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd |
install_sh_DATA = $(install_sh) -c -m 644 |
install_sh_PROGRAM = $(install_sh) -c |
install_sh_SCRIPT = $(install_sh) -c |
INSTALL_HEADER = $(INSTALL_DATA) |
transform = $(program_transform_name) |
NORMAL_INSTALL = : |
PRE_INSTALL = : |
POST_INSTALL = : |
NORMAL_UNINSTALL = : |
PRE_UNINSTALL = : |
POST_UNINSTALL = : |
build_triplet = @build@ |
host_triplet = @host@ |
DIST_COMMON = $(srcdir)/../../../Makefile.shared $(srcdir)/Makefile.in \ |
$(srcdir)/Makefile.am |
subdir = iconv/ces |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \ |
$(top_srcdir)/../../ltoptions.m4 \ |
$(top_srcdir)/../../ltsugar.m4 \ |
$(top_srcdir)/../../ltversion.m4 \ |
$(top_srcdir)/../../lt~obsolete.m4 \ |
$(top_srcdir)/../acinclude.m4 $(top_srcdir)/configure.in |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
$(ACLOCAL_M4) |
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs |
CONFIG_CLEAN_FILES = |
CONFIG_CLEAN_VPATH_FILES = |
LIBRARIES = $(noinst_LIBRARIES) |
ARFLAGS = cru |
lib_a_AR = $(AR) $(ARFLAGS) |
lib_a_LIBADD = |
am__objects_1 = lib_a-utf-8.$(OBJEXT) lib_a-utf-16.$(OBJEXT) \ |
lib_a-ucs-2.$(OBJEXT) lib_a-us-ascii.$(OBJEXT) \ |
lib_a-ucs-4.$(OBJEXT) lib_a-ucs-2-internal.$(OBJEXT) \ |
lib_a-ucs-4-internal.$(OBJEXT) lib_a-cesbi.$(OBJEXT) \ |
lib_a-table.$(OBJEXT) lib_a-table-pcs.$(OBJEXT) \ |
lib_a-euc.$(OBJEXT) |
@ELIX_LEVEL_1_TRUE@am__objects_2 = lib_a-utf-8.$(OBJEXT) \ |
@ELIX_LEVEL_1_TRUE@ lib_a-utf-16.$(OBJEXT) \ |
@ELIX_LEVEL_1_TRUE@ lib_a-ucs-2.$(OBJEXT) \ |
@ELIX_LEVEL_1_TRUE@ lib_a-us-ascii.$(OBJEXT) \ |
@ELIX_LEVEL_1_TRUE@ lib_a-ucs-4.$(OBJEXT) \ |
@ELIX_LEVEL_1_TRUE@ lib_a-ucs-2-internal.$(OBJEXT) \ |
@ELIX_LEVEL_1_TRUE@ lib_a-ucs-4-internal.$(OBJEXT) \ |
@ELIX_LEVEL_1_TRUE@ lib_a-cesbi.$(OBJEXT) lib_a-table.$(OBJEXT) \ |
@ELIX_LEVEL_1_TRUE@ lib_a-table-pcs.$(OBJEXT) \ |
@ELIX_LEVEL_1_TRUE@ lib_a-euc.$(OBJEXT) |
am_lib_a_OBJECTS = $(am__objects_1) $(am__objects_2) |
lib_a_OBJECTS = $(am_lib_a_OBJECTS) |
DEFAULT_INCLUDES = -I.@am__isrc@ |
depcomp = |
am__depfiles_maybe = |
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ |
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ |
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ |
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
CCLD = $(CC) |
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ |
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ |
$(LDFLAGS) -o $@ |
SOURCES = $(lib_a_SOURCES) |
DATA = $(noinst_DATA) |
ETAGS = etags |
CTAGS = ctags |
ACLOCAL = @ACLOCAL@ |
AMTAR = @AMTAR@ |
AR = @AR@ |
AS = @AS@ |
AUTOCONF = @AUTOCONF@ |
AUTOHEADER = @AUTOHEADER@ |
AUTOMAKE = @AUTOMAKE@ |
AWK = @AWK@ |
CC = @CC@ |
CCAS = @CCAS@ |
CCASFLAGS = @CCASFLAGS@ |
CCDEPMODE = @CCDEPMODE@ |
CFLAGS = @CFLAGS@ |
CPP = @CPP@ |
CPPFLAGS = @CPPFLAGS@ |
CRT0 = @CRT0@ |
CYGPATH_W = @CYGPATH_W@ |
DEFS = @DEFS@ |
DEPDIR = @DEPDIR@ |
DLLTOOL = @DLLTOOL@ |
DSYMUTIL = @DSYMUTIL@ |
DUMPBIN = @DUMPBIN@ |
ECHO_C = @ECHO_C@ |
ECHO_N = @ECHO_N@ |
ECHO_T = @ECHO_T@ |
EGREP = @EGREP@ |
EXEEXT = @EXEEXT@ |
FGREP = @FGREP@ |
GREP = @GREP@ |
INSTALL = @INSTALL@ |
INSTALL_DATA = @INSTALL_DATA@ |
INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
INSTALL_SCRIPT = @INSTALL_SCRIPT@ |
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ |
LD = @LD@ |
LDFLAGS = @LDFLAGS@ |
LIBC_EXTRA_DEF = @LIBC_EXTRA_DEF@ |
LIBC_EXTRA_LIB = @LIBC_EXTRA_LIB@ |
LIBC_MACHINE_LIB = @LIBC_MACHINE_LIB@ |
LIBC_POSIX_LIB = @LIBC_POSIX_LIB@ |
LIBC_SIGNAL_DEF = @LIBC_SIGNAL_DEF@ |
LIBC_SIGNAL_LIB = @LIBC_SIGNAL_LIB@ |
LIBC_STDIO64_DEF = @LIBC_STDIO64_DEF@ |
LIBC_STDIO64_LIB = @LIBC_STDIO64_LIB@ |
LIBC_STDIO_DEF = @LIBC_STDIO_DEF@ |
LIBC_STDIO_LIB = @LIBC_STDIO_LIB@ |
LIBC_SYSCALL_LIB = @LIBC_SYSCALL_LIB@ |
LIBC_SYS_LIB = @LIBC_SYS_LIB@ |
LIBC_UNIX_LIB = @LIBC_UNIX_LIB@ |
LIBOBJS = @LIBOBJS@ |
LIBS = @LIBS@ |
LIBTOOL = @LIBTOOL@ |
LIPO = @LIPO@ |
LN_S = @LN_S@ |
LTLIBOBJS = @LTLIBOBJS@ |
MAINT = @MAINT@ |
MAKEINFO = @MAKEINFO@ |
MKDIR_P = @MKDIR_P@ |
NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ |
NM = @NM@ |
NMEDIT = @NMEDIT@ |
OBJDUMP = @OBJDUMP@ |
OBJEXT = @OBJEXT@ |
OTOOL = @OTOOL@ |
OTOOL64 = @OTOOL64@ |
PACKAGE = @PACKAGE@ |
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ |
PACKAGE_NAME = @PACKAGE_NAME@ |
PACKAGE_STRING = @PACKAGE_STRING@ |
PACKAGE_TARNAME = @PACKAGE_TARNAME@ |
PACKAGE_VERSION = @PACKAGE_VERSION@ |
PATH_SEPARATOR = @PATH_SEPARATOR@ |
RANLIB = @RANLIB@ |
READELF = @READELF@ |
SED = @SED@ |
SET_MAKE = @SET_MAKE@ |
SHELL = @SHELL@ |
STRIP = @STRIP@ |
VERSION = @VERSION@ |
abs_builddir = @abs_builddir@ |
abs_srcdir = @abs_srcdir@ |
abs_top_builddir = @abs_top_builddir@ |
abs_top_srcdir = @abs_top_srcdir@ |
ac_ct_CC = @ac_ct_CC@ |
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ |
aext = @aext@ |
am__include = @am__include@ |
am__leading_dot = @am__leading_dot@ |
am__quote = @am__quote@ |
am__tar = @am__tar@ |
am__untar = @am__untar@ |
bindir = @bindir@ |
build = @build@ |
build_alias = @build_alias@ |
build_cpu = @build_cpu@ |
build_os = @build_os@ |
build_vendor = @build_vendor@ |
builddir = @builddir@ |
datadir = @datadir@ |
datarootdir = @datarootdir@ |
docdir = @docdir@ |
dvidir = @dvidir@ |
exec_prefix = @exec_prefix@ |
extra_dir = @extra_dir@ |
host = @host@ |
host_alias = @host_alias@ |
host_cpu = @host_cpu@ |
host_os = @host_os@ |
host_vendor = @host_vendor@ |
htmldir = @htmldir@ |
includedir = @includedir@ |
infodir = @infodir@ |
install_sh = @install_sh@ |
libdir = @libdir@ |
libexecdir = @libexecdir@ |
libm_machine_dir = @libm_machine_dir@ |
localedir = @localedir@ |
localstatedir = @localstatedir@ |
lpfx = @lpfx@ |
lt_ECHO = @lt_ECHO@ |
machine_dir = @machine_dir@ |
mandir = @mandir@ |
mkdir_p = @mkdir_p@ |
newlib_basedir = @newlib_basedir@ |
oext = @oext@ |
oldincludedir = @oldincludedir@ |
pdfdir = @pdfdir@ |
prefix = @prefix@ |
program_transform_name = @program_transform_name@ |
psdir = @psdir@ |
sbindir = @sbindir@ |
sharedstatedir = @sharedstatedir@ |
srcdir = @srcdir@ |
subdirs = @subdirs@ |
sys_dir = @sys_dir@ |
sysconfdir = @sysconfdir@ |
target_alias = @target_alias@ |
top_build_prefix = @top_build_prefix@ |
top_builddir = @top_builddir@ |
top_srcdir = @top_srcdir@ |
AUTOMAKE_OPTIONS = cygnus |
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) |
GENERAL_SOURCES = \ |
utf-8.c \ |
utf-16.c \ |
ucs-2.c \ |
us-ascii.c \ |
ucs-4.c \ |
ucs-2-internal.c \ |
ucs-4-internal.c \ |
cesbi.c \ |
table.c \ |
table-pcs.c \ |
euc.c |
|
@ELIX_LEVEL_1_FALSE@ELIX_SOURCES = |
@ELIX_LEVEL_1_TRUE@ELIX_SOURCES = \ |
@ELIX_LEVEL_1_TRUE@ utf-8.c \ |
@ELIX_LEVEL_1_TRUE@ utf-16.c \ |
@ELIX_LEVEL_1_TRUE@ ucs-2.c \ |
@ELIX_LEVEL_1_TRUE@ us-ascii.c \ |
@ELIX_LEVEL_1_TRUE@ ucs-4.c \ |
@ELIX_LEVEL_1_TRUE@ ucs-2-internal.c \ |
@ELIX_LEVEL_1_TRUE@ ucs-4-internal.c \ |
@ELIX_LEVEL_1_TRUE@ cesbi.c \ |
@ELIX_LEVEL_1_TRUE@ table.c \ |
@ELIX_LEVEL_1_TRUE@ table-pcs.c \ |
@ELIX_LEVEL_1_TRUE@ euc.c |
|
noinst_LIBRARIES = lib.a |
lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES) |
lib_a_CFLAGS = $(AM_CFLAGS) |
noinst_DATA = |
CHEWOUT_FILES = ces.def |
SUFFIXES = .def |
CHEW = ../../../doc/makedoc -f $(srcdir)/../../../doc/doc.str |
TARGETDOC = ../tmp.texi |
CLEANFILES = $(CHEWOUT_FILES) *.ref |
all: all-am |
|
.SUFFIXES: |
.SUFFIXES: .def .c .lo .o .obj |
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../../Makefile.shared $(am__configure_deps) |
@for dep in $?; do \ |
case '$(am__configure_deps)' in \ |
*$$dep*) \ |
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ |
&& { if test -f $@; then exit 0; else break; fi; }; \ |
exit 1;; \ |
esac; \ |
done; \ |
echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus iconv/ces/Makefile'; \ |
$(am__cd) $(top_srcdir) && \ |
$(AUTOMAKE) --cygnus iconv/ces/Makefile |
.PRECIOUS: Makefile |
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status |
@case '$?' in \ |
*config.status*) \ |
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ |
*) \ |
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ |
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ |
esac; |
|
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) |
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh |
|
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) |
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh |
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) |
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh |
$(am__aclocal_m4_deps): |
|
clean-noinstLIBRARIES: |
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) |
lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) |
-rm -f lib.a |
$(lib_a_AR) lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) |
$(RANLIB) lib.a |
|
mostlyclean-compile: |
-rm -f *.$(OBJEXT) |
|
distclean-compile: |
-rm -f *.tab.c |
|
.c.o: |
$(COMPILE) -c $< |
|
.c.obj: |
$(COMPILE) -c `$(CYGPATH_W) '$<'` |
|
.c.lo: |
$(LTCOMPILE) -c -o $@ $< |
|
lib_a-utf-8.o: utf-8.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-utf-8.o `test -f 'utf-8.c' || echo '$(srcdir)/'`utf-8.c |
|
lib_a-utf-8.obj: utf-8.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-utf-8.obj `if test -f 'utf-8.c'; then $(CYGPATH_W) 'utf-8.c'; else $(CYGPATH_W) '$(srcdir)/utf-8.c'; fi` |
|
lib_a-utf-16.o: utf-16.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-utf-16.o `test -f 'utf-16.c' || echo '$(srcdir)/'`utf-16.c |
|
lib_a-utf-16.obj: utf-16.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-utf-16.obj `if test -f 'utf-16.c'; then $(CYGPATH_W) 'utf-16.c'; else $(CYGPATH_W) '$(srcdir)/utf-16.c'; fi` |
|
lib_a-ucs-2.o: ucs-2.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ucs-2.o `test -f 'ucs-2.c' || echo '$(srcdir)/'`ucs-2.c |
|
lib_a-ucs-2.obj: ucs-2.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ucs-2.obj `if test -f 'ucs-2.c'; then $(CYGPATH_W) 'ucs-2.c'; else $(CYGPATH_W) '$(srcdir)/ucs-2.c'; fi` |
|
lib_a-us-ascii.o: us-ascii.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-us-ascii.o `test -f 'us-ascii.c' || echo '$(srcdir)/'`us-ascii.c |
|
lib_a-us-ascii.obj: us-ascii.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-us-ascii.obj `if test -f 'us-ascii.c'; then $(CYGPATH_W) 'us-ascii.c'; else $(CYGPATH_W) '$(srcdir)/us-ascii.c'; fi` |
|
lib_a-ucs-4.o: ucs-4.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ucs-4.o `test -f 'ucs-4.c' || echo '$(srcdir)/'`ucs-4.c |
|
lib_a-ucs-4.obj: ucs-4.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ucs-4.obj `if test -f 'ucs-4.c'; then $(CYGPATH_W) 'ucs-4.c'; else $(CYGPATH_W) '$(srcdir)/ucs-4.c'; fi` |
|
lib_a-ucs-2-internal.o: ucs-2-internal.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ucs-2-internal.o `test -f 'ucs-2-internal.c' || echo '$(srcdir)/'`ucs-2-internal.c |
|
lib_a-ucs-2-internal.obj: ucs-2-internal.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ucs-2-internal.obj `if test -f 'ucs-2-internal.c'; then $(CYGPATH_W) 'ucs-2-internal.c'; else $(CYGPATH_W) '$(srcdir)/ucs-2-internal.c'; fi` |
|
lib_a-ucs-4-internal.o: ucs-4-internal.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ucs-4-internal.o `test -f 'ucs-4-internal.c' || echo '$(srcdir)/'`ucs-4-internal.c |
|
lib_a-ucs-4-internal.obj: ucs-4-internal.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ucs-4-internal.obj `if test -f 'ucs-4-internal.c'; then $(CYGPATH_W) 'ucs-4-internal.c'; else $(CYGPATH_W) '$(srcdir)/ucs-4-internal.c'; fi` |
|
lib_a-cesbi.o: cesbi.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cesbi.o `test -f 'cesbi.c' || echo '$(srcdir)/'`cesbi.c |
|
lib_a-cesbi.obj: cesbi.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-cesbi.obj `if test -f 'cesbi.c'; then $(CYGPATH_W) 'cesbi.c'; else $(CYGPATH_W) '$(srcdir)/cesbi.c'; fi` |
|
lib_a-table.o: table.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-table.o `test -f 'table.c' || echo '$(srcdir)/'`table.c |
|
lib_a-table.obj: table.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-table.obj `if test -f 'table.c'; then $(CYGPATH_W) 'table.c'; else $(CYGPATH_W) '$(srcdir)/table.c'; fi` |
|
lib_a-table-pcs.o: table-pcs.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-table-pcs.o `test -f 'table-pcs.c' || echo '$(srcdir)/'`table-pcs.c |
|
lib_a-table-pcs.obj: table-pcs.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-table-pcs.obj `if test -f 'table-pcs.c'; then $(CYGPATH_W) 'table-pcs.c'; else $(CYGPATH_W) '$(srcdir)/table-pcs.c'; fi` |
|
lib_a-euc.o: euc.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-euc.o `test -f 'euc.c' || echo '$(srcdir)/'`euc.c |
|
lib_a-euc.obj: euc.c |
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-euc.obj `if test -f 'euc.c'; then $(CYGPATH_W) 'euc.c'; else $(CYGPATH_W) '$(srcdir)/euc.c'; fi` |
|
mostlyclean-libtool: |
-rm -f *.lo |
|
clean-libtool: |
-rm -rf .libs _libs |
|
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) |
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ |
unique=`for i in $$list; do \ |
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ |
done | \ |
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \ |
END { if (nonempty) { for (i in files) print i; }; }'`; \ |
mkid -fID $$unique |
tags: TAGS |
|
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ |
$(TAGS_FILES) $(LISP) |
set x; \ |
here=`pwd`; \ |
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ |
unique=`for i in $$list; do \ |
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ |
done | \ |
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \ |
END { if (nonempty) { for (i in files) print i; }; }'`; \ |
shift; \ |
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ |
test -n "$$unique" || unique=$$empty_fix; \ |
if test $$# -gt 0; then \ |
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ |
"$$@" $$unique; \ |
else \ |
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ |
$$unique; \ |
fi; \ |
fi |
ctags: CTAGS |
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ |
$(TAGS_FILES) $(LISP) |
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ |
unique=`for i in $$list; do \ |
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ |
done | \ |
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \ |
END { if (nonempty) { for (i in files) print i; }; }'`; \ |
test -z "$(CTAGS_ARGS)$$unique" \ |
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ |
$$unique |
|
GTAGS: |
here=`$(am__cd) $(top_builddir) && pwd` \ |
&& $(am__cd) $(top_srcdir) \ |
&& gtags -i $(GTAGS_ARGS) "$$here" |
|
distclean-tags: |
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags |
check-am: |
check: check-am |
all-am: Makefile $(LIBRARIES) $(DATA) |
installdirs: |
install: install-am |
install-exec: install-exec-am |
install-data: install-data-am |
uninstall: uninstall-am |
|
install-am: all-am |
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am |
|
installcheck: installcheck-am |
install-strip: |
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ |
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ |
`test -z '$(STRIP)' || \ |
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install |
mostlyclean-generic: |
|
clean-generic: |
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) |
|
distclean-generic: |
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) |
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) |
|
maintainer-clean-generic: |
@echo "This command is intended for maintainers to use" |
@echo "it deletes files that may require special tools to rebuild." |
clean: clean-am |
|
clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ |
mostlyclean-am |
|
distclean: distclean-am |
-rm -f Makefile |
distclean-am: clean-am distclean-compile distclean-generic \ |
distclean-tags |
|
dvi: dvi-am |
|
dvi-am: |
|
html: html-am |
|
html-am: |
|
info: info-am |
|
info-am: |
|
install-data-am: |
|
install-dvi: install-dvi-am |
|
install-dvi-am: |
|
install-exec-am: |
|
install-html: install-html-am |
|
install-html-am: |
|
install-info: install-info-am |
|
install-info-am: |
|
install-man: |
|
install-pdf: install-pdf-am |
|
install-pdf-am: |
|
install-ps: install-ps-am |
|
install-ps-am: |
|
installcheck-am: |
|
maintainer-clean: maintainer-clean-am |
-rm -f Makefile |
maintainer-clean-am: distclean-am maintainer-clean-generic |
|
mostlyclean: mostlyclean-am |
|
mostlyclean-am: mostlyclean-compile mostlyclean-generic \ |
mostlyclean-libtool |
|
pdf: pdf-am |
|
pdf-am: |
|
ps: ps-am |
|
ps-am: |
|
uninstall-am: |
|
.MAKE: install-am install-strip |
|
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ |
clean-libtool clean-noinstLIBRARIES ctags distclean \ |
distclean-compile distclean-generic distclean-libtool \ |
distclean-tags dvi dvi-am html html-am info info-am install \ |
install-am install-data install-data-am install-dvi \ |
install-dvi-am install-exec install-exec-am install-html \ |
install-html-am install-info install-info-am install-man \ |
install-pdf install-pdf-am install-ps install-ps-am \ |
install-strip installcheck installcheck-am installdirs \ |
maintainer-clean maintainer-clean-generic mostlyclean \ |
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ |
pdf pdf-am ps ps-am tags uninstall uninstall-am |
|
objectlist.awk.in: $(noinst_LTLIBRARIES) |
-rm -f objectlist.awk.in |
for i in `ls *.lo` ; \ |
do \ |
echo $$i `pwd`/$$i >> objectlist.awk.in ; \ |
done |
|
.c.def: |
$(CHEW) < $< > $*.def 2> $*.ref |
touch stmp-def |
|
doc: $(CHEWOUT_FILES) |
cat $(srcdir)/ces.tex >> $(TARGETDOC) |
|
# Tell versions [3.59,3.63) of GNU make to not export all variables. |
# Otherwise a system limit (for SysV at least) may be exceeded. |
.NOEXPORT: |
/ucs-2-internal.c
0,0 → 1,127
/* |
* Copyright (c) 2003-2004, Artem B. Bityuckiy |
* Copyright (c) 1999,2000, Konstantin Chuguev. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
*/ |
#include "cesbi.h" |
|
#if defined (ICONV_TO_UCS_CES_UCS_2_INTERNAL) \ |
|| defined (ICONV_FROM_UCS_CES_UCS_2_INTERNAL) |
|
#include <_ansi.h> |
#include <reent.h> |
#include <stdlib.h> |
#include <string.h> |
#include <sys/types.h> |
#include "../lib/local.h" |
#include "../lib/ucsconv.h" |
#include "../lib/endian.h" |
|
/* |
* Internal 2-byte representation of UCS-2 codes without restrictions and |
* without BOM support. |
*/ |
|
#if defined (ICONV_FROM_UCS_CES_UCS_2_INTERNAL) |
static size_t |
_DEFUN(ucs_2_internal_convert_from_ucs, (data, in, outbuf, outbytesleft), |
_VOID_PTR data _AND |
register ucs4_t in _AND |
unsigned char **outbuf _AND |
size_t *outbytesleft) |
{ |
if (in > 0x0000FFFF) |
return (size_t)ICONV_CES_INVALID_CHARACTER; |
|
if (*outbytesleft < sizeof (ucs2_t)) |
return (size_t)ICONV_CES_NOSPACE; |
|
*((ucs2_t *)(*outbuf)) = (ucs2_t)in; |
*outbuf += sizeof (ucs2_t); |
*outbytesleft -= sizeof (ucs2_t); |
|
return sizeof (ucs2_t); |
} |
#endif /* ICONV_FROM_UCS_CES_UCS_2_INTERNAL */ |
|
#if defined (ICONV_TO_UCS_CES_UCS_2_INTERNAL) |
static ucs4_t |
_DEFUN(ucs_2_internal_convert_to_ucs, (data, inbuf, inbytesleft), |
_VOID_PTR data _AND |
_CONST unsigned char **inbuf _AND |
size_t *inbytesleft) |
{ |
register ucs4_t res; |
|
if (*inbytesleft < sizeof (ucs2_t)) |
return (ucs4_t)ICONV_CES_BAD_SEQUENCE; |
|
res = (ucs4_t)*((ucs2_t *)(*inbuf)); |
|
if (res > 0x0000FFFF) |
return (ucs4_t)ICONV_CES_INVALID_CHARACTER; |
|
*inbuf += sizeof (ucs2_t); |
*inbytesleft -= sizeof (ucs2_t); |
|
return res; |
} |
#endif /* ICONV_TO_UCS_CES_UCS_2_INTERNAL */ |
|
static int |
_DEFUN(ucs_2_internal_get_mb_cur_max, (data), |
_VOID_PTR data) |
{ |
return 2; |
} |
|
#if defined (ICONV_TO_UCS_CES_UCS_2_INTERNAL) |
_CONST iconv_to_ucs_ces_handlers_t |
_iconv_to_ucs_ces_handlers_ucs_2_internal = |
{ |
NULL, |
NULL, |
ucs_2_internal_get_mb_cur_max, |
NULL, |
NULL, |
NULL, |
ucs_2_internal_convert_to_ucs |
}; |
#endif |
|
#if defined (ICONV_FROM_UCS_CES_UCS_2_INTERNAL) |
_CONST iconv_from_ucs_ces_handlers_t |
_iconv_from_ucs_ces_handlers_ucs_2_internal = |
{ |
NULL, |
NULL, |
ucs_2_internal_get_mb_cur_max, |
NULL, |
NULL, |
NULL, |
ucs_2_internal_convert_from_ucs |
}; |
#endif |
|
#endif /* ICONV_TO_UCS_CES_UCS_2_INTERNAL || ICONV_FROM_UCS_CES_UCS_2_INTERNAL */ |
|
ucs-2-internal.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: utf-8.c
===================================================================
--- utf-8.c (nonexistent)
+++ utf-8.c (revision 520)
@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 2003-2004, Artem B. Bityuckiy
+ * Copyright (c) 1999,2000, Konstantin Chuguev. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include "cesbi.h"
+
+#if defined (ICONV_TO_UCS_CES_UTF_8) \
+ || defined (ICONV_FROM_UCS_CES_UTF_8)
+
+#include <_ansi.h>
+#include
+#include
+#include "../lib/local.h"
+#include "../lib/ucsconv.h"
+
+#define UTF8_MB_CUR_MAX 6
+
+/*
+ * UTF-8 CES converter doesn't interpret BOM. Reject overlong sequences,
+ * U'FFFF, U'FFFE codes, UTF-16 surrogate codes and all codes > 0x7FFFFFFF.
+ */
+
+#if defined (ICONV_FROM_UCS_CES_UTF_8)
+static size_t
+_DEFUN(convert_from_ucs, (data, in, outbuf, outbytesleft),
+ _VOID_PTR data _AND
+ register ucs4_t in _AND
+ unsigned char **outbuf _AND
+ size_t *outbytesleft)
+{
+ register unsigned char *cp;
+ register size_t bytes;
+
+ if ((in >= 0x0000D800 && in <= 0x0000DFFF)
+ || in > 0x7FFFFFFF || in == 0x0000FFFF || in == 0x0000FFFE)
+ return (size_t)ICONV_CES_INVALID_CHARACTER;
+
+ if (in < 0x80)
+ bytes = 1;
+ else if (in < 0x800)
+ bytes = 2;
+ else if (in < 0x10000)
+ bytes = 3;
+ else if (in < 0x200000)
+ bytes = 4;
+ else if (in < 0x4000000)
+ bytes = 5;
+ else
+ bytes = 6;
+
+ if (*outbytesleft < bytes)
+ return (size_t)ICONV_CES_NOSPACE;
+
+ cp = *outbuf;
+
+ switch (bytes)
+ {
+ case 1:
+ *cp = (unsigned char)in;
+ break;
+
+ case 2:
+ *cp++ = (unsigned char)((in >> 6) | 0x000000C0);
+ *cp++ = (unsigned char)((in & 0x0000003F) | 0x00000080);
+ break;
+
+ case 3:
+ *cp++ = (unsigned char)((in >> 12) | 0x000000E0);
+ *cp++ = (unsigned char)(((in >> 6) & 0x0000003F) | 0x00000080);
+ *cp++ = (unsigned char)((in & 0x0000003F) | 0x00000080);
+ break;
+
+ case 4:
+ *cp++ = (unsigned char)((in >> 18) | 0x000000F0);
+ *cp++ = (unsigned char)(((in >> 12) & 0x0000003F) | 0x00000080);
+ *cp++ = (unsigned char)(((in >> 6) & 0x0000003F) | 0x00000080);
+ *cp++ = (unsigned char)((in & 0x0000003F) | 0x00000080);
+ break;
+
+ case 5:
+ *cp++ = (unsigned char)((in >> 24) | 0x000000F8);
+ *cp++ = (unsigned char)(((in >> 18) & 0x0000003F) | 0x00000080);
+ *cp++ = (unsigned char)(((in >> 12) & 0x0000003F) | 0x00000080);
+ *cp++ = (unsigned char)(((in >> 6) & 0x0000003F) | 0x00000080);
+ *cp++ = (unsigned char)((in & 0x0000003F) | 0x00000080);
+ break;
+
+ case 6:
+ *cp++ = (unsigned char)((in >> 30) | 0x000000FC);
+ *cp++ = (unsigned char)(((in >> 24) & 0x0000003F) | 0x00000080);
+ *cp++ = (unsigned char)(((in >> 18) & 0x0000003F) | 0x00000080);
+ *cp++ = (unsigned char)(((in >> 12) & 0x0000003F) | 0x00000080);
+ *cp++ = (unsigned char)(((in >> 6) & 0x0000003F) | 0x00000080);
+ *cp++ = (unsigned char)((in & 0x0000003F) | 0x00000080);
+ break;
+ }
+
+ *outbytesleft -= bytes;
+ *outbuf += bytes;
+
+ return bytes;
+}
+#endif /* ICONV_FROM_UCS_CES_UTF_8 */
+
+#if defined (ICONV_TO_UCS_CES_UTF_8)
+static ucs4_t
+_DEFUN(convert_to_ucs, (data, inbuf, inbytesleft),
+ _VOID_PTR data _AND
+ _CONST unsigned char **inbuf _AND
+ size_t *inbytesleft)
+{
+ register _CONST unsigned char *in = *inbuf;
+ register size_t bytes;
+ ucs4_t res;
+
+ if (in[0] >= 0xC0)
+ {
+ if (in[0] < 0xE0)
+ {
+ if (*inbytesleft < (bytes = 2))
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ if ( ((in[0] & ~0x1F) == 0xC0)
+ && ((in[1] & 0xC0) == 0x80))
+ res = ((ucs4_t)(in[0] & 0x1F) << 6)
+ | ((ucs4_t)(in[1] & 0x3F));
+ else
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ if (res < 0x00000080) /* Overlong sequence */
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+ }
+
+ else if (in[0] < 0xF0)
+ {
+ if (*inbytesleft < (bytes = 3))
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ if ( ((in[0] & ~0x0F) == 0xE0)
+ && ((in[1] & 0xC0) == 0x80)
+ && ((in[2] & 0xC0) == 0x80))
+ res = ((ucs4_t)(in[0] & 0x0F) << 12)
+ | ((ucs4_t)(in[1] & 0x3F) << 6)
+ | ((ucs4_t)(in[2] & 0x3F));
+ else
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ if (res < 0x00000800) /* Overlong sequence */
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+ }
+
+ else if (in[0] < 0xF8)
+ {
+ if (*inbytesleft < (bytes = 4))
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ if ( ((in[0] & ~0x07) == 0xF0)
+ && ((in[1] & 0xC0) == 0x80)
+ && ((in[2] & 0xC0) == 0x80)
+ && ((in[3] & 0xC0) == 0x80))
+ res = ((ucs4_t)(in[0] & 0x07) << 18)
+ | ((ucs4_t)(in[1] & 0x3F) << 12)
+ | ((ucs4_t)(in[2] & 0x3F) << 6)
+ | ((ucs4_t)(in[3] & 0x3F));
+ else
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ if (res < 0x00010000) /* Overlong sequence */
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+ }
+
+ else if (in[0] < 0xFC)
+ {
+ if (*inbytesleft < (bytes = 5))
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ if ( ((in[0] & ~0x03) == 0xF8)
+ && ((in[1] & 0xC0) == 0x80)
+ && ((in[2] & 0xC0) == 0x80)
+ && ((in[3] & 0xC0) == 0x80)
+ && ((in[4] & 0xC0) == 0x80))
+ res = ((ucs4_t)(in[0] & 0x03) << 24)
+ | ((ucs4_t)(in[1] & 0x3F) << 18)
+ | ((ucs4_t)(in[2] & 0x3F) << 12)
+ | ((ucs4_t)(in[3] & 0x3F) << 6)
+ | ((ucs4_t)(in[4] & 0x3F));
+ else
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ if (res < 0x00200000) /* Overlong sequence */
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+ }
+
+ else if (in[0] <= 0xFD)
+ {
+ if (*inbytesleft < (bytes = 6))
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ if ( ((in[0] & ~0x01) == 0xFC)
+ && ((in[1] & 0xC0) == 0x80)
+ && ((in[2] & 0xC0) == 0x80)
+ && ((in[3] & 0xC0) == 0x80)
+ && ((in[4] & 0xC0) == 0x80)
+ && ((in[5] & 0xC0) == 0x80))
+ res = ((ucs4_t)(in[0] & 0x1) << 30)
+ | ((ucs4_t)(in[1] & 0x3F) << 24)
+ | ((ucs4_t)(in[2] & 0x3F) << 18)
+ | ((ucs4_t)(in[3] & 0x3F) << 12)
+ | ((ucs4_t)(in[4] & 0x3F) << 6)
+ | ((ucs4_t)(in[5] & 0x3F));
+ else
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ if (res < 0x04000000) /* Overlong sequence */
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+ }
+
+ else
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+ }
+ else if (in[0] & 0x80)
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+ else
+ {
+ res = (ucs4_t)in[0];
+ bytes = 1;
+ }
+
+ if ( (res >= 0x0000D800 && res <= 0x0000DFFF)
+ || res > 0x7FFFFFFF || res == 0x0000FFFF || res == 0x0000FFFE)
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ *inbytesleft -= bytes;
+ *inbuf += bytes;
+
+ return res;
+}
+#endif /* ICONV_TO_UCS_CES_UTF_8 */
+
+static int
+_DEFUN(get_mb_cur_max, (data),
+ _VOID_PTR data)
+{
+ return UTF8_MB_CUR_MAX;
+}
+
+#if defined (ICONV_TO_UCS_CES_UTF_8)
+_CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_utf_8 =
+{
+ NULL,
+ NULL,
+ get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ convert_to_ucs
+};
+#endif
+
+#if defined (ICONV_FROM_UCS_CES_UTF_8)
+_CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_utf_8 =
+{
+ NULL,
+ NULL,
+ get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ convert_from_ucs
+};
+#endif
+
+#endif /* ICONV_TO_UCS_CES_UTF_8 || ICONV_FROM_UCS_CES_UTF_8 */
+
utf-8.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: ucs-4-internal.c
===================================================================
--- ucs-4-internal.c (nonexistent)
+++ ucs-4-internal.c (revision 520)
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2003-2004, Artem B. Bityuckiy
+ * Copyright (c) 1999,2000, Konstantin Chuguev. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include "cesbi.h"
+
+#if defined (ICONV_TO_UCS_CES_UCS_4_INTERNAL) \
+ || defined (ICONV_FROM_UCS_CES_UCS_4_INTERNAL)
+
+#include <_ansi.h>
+#include
+#include
+#include
+#include
+#include "../lib/local.h"
+#include "../lib/ucsconv.h"
+#include "../lib/endian.h"
+
+/*
+ * Internal 4-byte representation of UCS-2 codes without restrictions and
+ * without BOM support.
+ */
+
+#if defined (ICONV_FROM_UCS_CES_UCS_4_INTERNAL)
+static size_t
+_DEFUN(ucs_4_internal_convert_from_ucs, (data, in, outbuf, outbytesleft),
+ _VOID_PTR data _AND
+ register ucs4_t in _AND
+ unsigned char **outbuf _AND
+ size_t *outbytesleft)
+{
+ if (in > 0x7FFFFFFF)
+ return (size_t)ICONV_CES_INVALID_CHARACTER;
+
+ if (*outbytesleft < sizeof (ucs4_t))
+ return (size_t)ICONV_CES_NOSPACE;
+
+ *((ucs4_t *)(*outbuf)) = in;
+ *outbytesleft -= sizeof (ucs4_t);
+ *outbuf += sizeof (ucs4_t);
+
+ return sizeof (ucs4_t);
+}
+#endif /* ICONV_FROM_UCS_CES_UCS_4_INTERNAL */
+
+#if defined (ICONV_TO_UCS_CES_UCS_4_INTERNAL)
+static ucs4_t
+_DEFUN(ucs_4_internal_convert_to_ucs, (data, inbuf, inbytesleft),
+ _VOID_PTR data _AND
+ _CONST unsigned char **inbuf _AND
+ size_t *inbytesleft)
+{
+ register ucs4_t res;
+
+ if (*inbytesleft < sizeof (ucs4_t))
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ res = *((ucs4_t *)(*inbuf));
+
+ if (res > 0x7FFFFFFF)
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ *inbytesleft -= sizeof (ucs4_t);
+ *inbuf += sizeof (ucs4_t);
+
+ return res;
+}
+#endif /* ICONV_TO_UCS_CES_UCS_4_INTERNAL */
+
+static int
+_DEFUN(ucs_4_internal_get_mb_cur_max, (data),
+ _VOID_PTR data)
+{
+ return 2;
+}
+
+#if defined (ICONV_TO_UCS_CES_UCS_4_INTERNAL)
+_CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_ucs_4_internal =
+{
+ NULL,
+ NULL,
+ ucs_4_internal_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ ucs_4_internal_convert_to_ucs
+};
+#endif
+
+#if defined (ICONV_FROM_UCS_CES_UCS_4_INTERNAL)
+_CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_ucs_4_internal =
+{
+ NULL,
+ NULL,
+ ucs_4_internal_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ ucs_4_internal_convert_from_ucs
+};
+#endif
+
+#endif /* ICONV_TO_UCS_CES_UCS_4_INTERNAL || ICONV_FROM_UCS_CES_UCS_4_INTERNAL */
+
ucs-4-internal.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: table-pcs.c
===================================================================
--- table-pcs.c (nonexistent)
+++ table-pcs.c (revision 520)
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2003-2004, Artem B. Bityuckiy
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This CES converter is just an simple extension of table CES converter.
+ * This CES converter is used for 16 bit CCSes which include 7bit
+ * Portable Characters Set (PCS) (equivalent to ASCII) (example: BIG5).
+ */
+
+#include "cesbi.h"
+
+#if defined (ICONV_TO_UCS_CES_TABLE_PCS) \
+ || defined (ICONV_FROM_UCS_CES_TABLE_PCS)
+
+#include <_ansi.h>
+#include
+#include
+#include "../lib/local.h"
+#include "../lib/ucsconv.h"
+
+#if defined (ICONV_FROM_UCS_CES_TABLE_PCS)
+static size_t
+_DEFUN(table_pcs_convert_from_ucs, (data, in, outbuf, outbytesleft),
+ _VOID_PTR data _AND
+ ucs4_t in _AND
+ unsigned char **outbuf _AND
+ size_t *outbytesleft)
+{
+ if (*outbytesleft < 1)
+ return (size_t)ICONV_CES_NOSPACE;
+
+ if (in < 0x80)
+ {
+ **outbuf = (unsigned char)in;
+ *outbuf += 1;
+ *outbytesleft -= 1;
+ return 1;
+ }
+
+ return _iconv_from_ucs_ces_handlers_table.convert_from_ucs (
+ data,
+ in,
+ outbuf,
+ outbytesleft);
+}
+
+static _VOID_PTR
+_DEFUN(table_pcs_from_ucs_init, (rptr, encoding),
+ struct _reent *rptr _AND
+ _CONST char *encoding)
+{
+ return _iconv_from_ucs_ces_handlers_table.init (rptr, encoding);
+}
+
+static size_t
+_DEFUN(table_pcs_from_ucs_close, (rptr, data),
+ struct _reent *rptr _AND
+ _VOID_PTR data)
+{
+ return _iconv_from_ucs_ces_handlers_table.close (rptr, data);
+}
+
+static int
+_DEFUN(table_pcs_from_ucs_get_mb_cur_max, (data),
+ _VOID_PTR data)
+{
+ return _iconv_from_ucs_ces_handlers_table.get_mb_cur_max (data);
+}
+
+#endif /* ICONV_FROM_UCS_CES_TABLE_PCS */
+
+#if defined (ICONV_TO_UCS_CES_TABLE_PCS)
+static ucs4_t
+_DEFUN(table_pcs_convert_to_ucs, (data, inbuf, inbytesleft),
+ _VOID_PTR data _AND
+ _CONST unsigned char **inbuf _AND
+ size_t *inbytesleft)
+{
+ if (*inbytesleft < 1)
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ if (**inbuf < 0x80)
+ {
+ *inbytesleft -= 1;
+ *inbuf += 1;
+ return (ucs4_t)(*(*inbuf - 1));
+ }
+
+ return _iconv_to_ucs_ces_handlers_table.convert_to_ucs (
+ data,
+ inbuf,
+ inbytesleft);
+}
+
+static _VOID_PTR
+_DEFUN(table_pcs_to_ucs_init, (rptr, encoding),
+ struct _reent *rptr _AND
+ _CONST char *encoding)
+{
+ return _iconv_to_ucs_ces_handlers_table.init (rptr, encoding);
+}
+
+static size_t
+_DEFUN(table_pcs_to_ucs_close, (rptr, data),
+ struct _reent *rptr _AND
+ _VOID_PTR data)
+{
+ return _iconv_to_ucs_ces_handlers_table.close (rptr, data);
+}
+
+static int
+_DEFUN(table_pcs_to_ucs_get_mb_cur_max, (data),
+ _VOID_PTR data)
+{
+ return _iconv_to_ucs_ces_handlers_table.get_mb_cur_max (data);
+}
+
+#endif /* ICONV_TO_UCS_CES_TABLE_PCS */
+
+#if defined (ICONV_FROM_UCS_CES_TABLE_PCS)
+_CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_table_pcs =
+{
+ table_pcs_from_ucs_init,
+ table_pcs_from_ucs_close,
+ table_pcs_from_ucs_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ table_pcs_convert_from_ucs
+};
+#endif
+
+#if defined (ICONV_TO_UCS_CES_TABLE_PCS)
+_CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_table_pcs =
+{
+ table_pcs_to_ucs_init,
+ table_pcs_to_ucs_close,
+ table_pcs_to_ucs_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ table_pcs_convert_to_ucs
+};
+#endif
+
+#endif /* ICONV_TO_UCS_CES_TABLE_PCS || ICONV_FROM_UCS_CES_TABLE_PCS */
+
table-pcs.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: euc.c
===================================================================
--- euc.c (nonexistent)
+++ euc.c (revision 520)
@@ -0,0 +1,471 @@
+/*
+ * Copyright (c) 2003-2004, Artem B. Bityuckiy
+ * Copyright (c) 1999,2000, Konstantin Chuguev. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include "cesbi.h"
+
+#if defined (ICONV_TO_UCS_CES_EUC) \
+ || defined (ICONV_FROM_UCS_CES_EUC)
+
+#include <_ansi.h>
+#include
+#include
+#include
+#include
+#include
+#include
+#include "../lib/local.h"
+#include "../lib/ucsconv.h"
+#include "../lib/encnames.h"
+#include "../ccs/ccsnames.h"
+
+#define TYPE_EUC_JP 0
+#define TYPE_EUC_KR 1
+#define TYPE_EUC_TW 2
+
+#define MAX_CS_NUM 3
+
+/* CS description structure */
+typedef struct
+{
+ char *csname;
+ char *prefix;
+ int bytes;
+ int prefixbytes;
+ int touchmsb; /* If 1, msb will be set by euc converter */
+} euc_cs_desc_t;
+
+typedef struct
+{
+ int type;
+ int mb_cur_max;
+ euc_cs_desc_t *desc;
+
+ _VOID_PTR data[MAX_CS_NUM];
+} euc_data_t;
+
+#if defined (_ICONV_TO_ENCODING_EUC_JP) \
+ || defined (_ICONV_FROM_ENCODING_EUC_JP) \
+ || defined (_ICONV_ENABLE_EXTERNAL_CCS)
+static euc_cs_desc_t euc_jp_cs_desc[] =
+{
+ {ICONV_CCS_JIS_X0208_1990, "", 2, 0, 1},
+ {ICONV_CCS_JIS_X0201_1976, "\x8e", 1, 1, 0},
+ {ICONV_CCS_JIS_X0212_1990, "\x8f", 2, 1, 1},
+ {NULL, NULL, 0, 0}
+};
+#endif
+
+#if defined (_ICONV_TO_ENCODING_EUC_TW) \
+ || defined (_ICONV_FROM_ENCODING_EUC_TW) \
+ || defined (_ICONV_ENABLE_EXTERNAL_CCS)
+static euc_cs_desc_t euc_tw_cs_desc [] =
+{
+ {ICONV_CCS_CNS11643_PLANE1, "", 2, 0, 1},
+ {ICONV_CCS_CNS11643_PLANE2, "\x8e\xa2", 2, 2, 1},
+ {ICONV_CCS_CNS11643_PLANE14, "\x8e\xae", 2, 2, 1},
+ {NULL, NULL, 0, 0}
+};
+#endif
+
+#if defined (_ICONV_TO_ENCODING_EUC_KR) \
+ || defined (_ICONV_FROM_ENCODING_EUC_KR) \
+ || defined (_ICONV_ENABLE_EXTERNAL_CCS)
+static euc_cs_desc_t euc_kr_cs_desc [] =
+{
+ {ICONV_CCS_KSX1001, "", 2, 0, 1},
+ {NULL, NULL, 0, 0}
+};
+#endif
+
+#if defined (ICONV_FROM_UCS_CES_EUC)
+static _VOID_PTR
+_DEFUN(euc_from_ucs_init, (rptr, encoding),
+ struct _reent *rptr _AND
+ _CONST char *encoding)
+{
+ int i;
+ euc_data_t *data;
+
+ if ((data = (euc_data_t *)_calloc_r (rptr, 1, sizeof (euc_data_t))) == NULL)
+ return 0;
+
+#if defined (_ICONV_TO_ENCODING_EUC_JP) \
+ || defined (_ICONV_ENABLE_EXTERNAL_CCS)
+ if (strcmp (encoding, ICONV_ENCODING_EUC_JP) == 0)
+ {
+ data->type = TYPE_EUC_JP;
+ data->mb_cur_max = 3;
+ data->desc = &euc_jp_cs_desc[0];
+ goto ok;
+ }
+#endif
+#if defined (_ICONV_TO_ENCODING_EUC_KR) \
+ || defined (_ICONV_ENABLE_EXTERNAL_CCS)
+ if (strcmp (encoding, ICONV_ENCODING_EUC_KR) == 0)
+ {
+ data->type = TYPE_EUC_KR;
+ data->mb_cur_max = 2;
+ data->desc = &euc_kr_cs_desc[0];
+ goto ok;
+ }
+#endif
+#if defined (_ICONV_TO_ENCODING_EUC_TW) \
+ || defined (_ICONV_ENABLE_EXTERNAL_CCS)
+ if (strcmp (encoding, ICONV_ENCODING_EUC_TW) == 0)
+ {
+ data->type = TYPE_EUC_TW;
+ data->mb_cur_max = 4;
+ data->desc = &euc_tw_cs_desc[0];
+ goto ok;
+ }
+#endif
+
+ goto error1;
+
+ok:
+ for (i = 0; data->desc[i].csname != NULL; i++)
+ {
+ data->data[i] = _iconv_from_ucs_ces_handlers_table.init (
+ rptr,
+ data->desc[i].csname);
+ if (data->data == NULL)
+ goto error;
+ }
+
+ return data;
+
+error:
+ _iconv_from_ucs_ces_handlers_table.close (rptr, data);
+ return NULL;
+error1:
+ _free_r (rptr, (_VOID_PTR)data);
+ return NULL;
+}
+
+static size_t
+_DEFUN(euc_from_ucs_close, (rptr, data),
+ struct _reent *rptr _AND
+ _VOID_PTR data)
+{
+ int i;
+ size_t res = 0;
+
+ for (i = 0; i < MAX_CS_NUM; i++)
+ {
+ if (((euc_data_t *)data)->data[i] != NULL)
+ res |= _iconv_from_ucs_ces_handlers_table.close (
+ rptr,
+ ((euc_data_t *)data)->data[i]);
+ }
+ _free_r(rptr, data);
+
+ return res;
+}
+
+static size_t
+_DEFUN(euc_convert_from_ucs, (data, in, outbuf, outbytesleft),
+ _VOID_PTR data _AND
+ register ucs4_t in _AND
+ unsigned char **outbuf _AND
+ size_t *outbytesleft)
+{
+ int i;
+ int j;
+ int res;
+ unsigned char *outbuf1;
+ size_t outbytesleft1;
+ euc_data_t *d = (euc_data_t *)data;
+
+ if (in < 0x80) /* CS0 ASCII */
+ return _iconv_from_ucs_ces_handlers_us_ascii.convert_from_ucs (
+ NULL,
+ in,
+ outbuf,
+ outbytesleft);
+
+ /* Try other CS */
+ for (i = 0; d->desc[i].csname != NULL; i++)
+ {
+
+ if (((int)*outbytesleft - d->desc[i].prefixbytes - d->desc[i].bytes) < 0)
+ {
+ char buf[ICONV_MB_LEN_MAX];
+ outbytesleft1 = ICONV_MB_LEN_MAX;
+ outbuf1 = &buf[0];
+ /* See wether this is right sequence */
+ res =
+ (int)_iconv_from_ucs_ces_handlers_table.convert_from_ucs (
+ d->data[i],
+ in,
+ &outbuf1,
+ &outbytesleft1);
+ if (res > 0)
+ return (size_t)ICONV_CES_NOSPACE;
+
+ continue;
+ }
+
+ outbuf1 = *outbuf + d->desc[i].prefixbytes;
+ outbytesleft1 = *outbytesleft - d->desc[i].prefixbytes;
+
+ res = (int)_iconv_from_ucs_ces_handlers_table.convert_from_ucs (
+ d->data[i],
+ in,
+ &outbuf1,
+ &outbytesleft1);
+ if (res == d->desc[i].bytes)
+ {
+ for (j = 0; j < d->desc[i].prefixbytes; j++)
+ (*outbuf)[j] = d->desc[i].prefix[j];
+
+ if (d->desc[i].touchmsb)
+ for (j = 0; j < d->desc[i].bytes; j++)
+ {
+ if ((*outbuf)[j + d->desc[i].prefixbytes] & 0x80)
+ return (size_t)ICONV_CES_INVALID_CHARACTER;
+ (*outbuf)[j + d->desc[i].prefixbytes] |= 0x80;
+ }
+
+ *outbuf = outbuf1;
+ *outbytesleft = outbytesleft1;
+
+ return (size_t)(res + d->desc[i].bytes);
+ }
+ }
+
+ return (size_t)ICONV_CES_INVALID_CHARACTER;
+}
+#endif /* ICONV_FROM_UCS_CES_EUC */
+
+#if defined (ICONV_TO_UCS_CES_EUC)
+static _VOID_PTR
+_DEFUN(euc_to_ucs_init, (rptr, encoding),
+ struct _reent *rptr _AND
+ _CONST char *encoding)
+{
+ int i;
+ euc_data_t *data;
+
+ if ((data = (euc_data_t *)_calloc_r (rptr, 1, sizeof (euc_data_t))) == NULL)
+ return 0;
+
+#if defined (_ICONV_TO_ENCODING_EUC_JP) \
+ || defined (_ICONV_ENABLE_EXTERNAL_CCS)
+ if (strcmp (encoding, ICONV_ENCODING_EUC_JP) == 0)
+ {
+ data->type = TYPE_EUC_JP;
+ data->mb_cur_max = 3;
+ data->desc = &euc_jp_cs_desc[0];
+ goto ok;
+ }
+#endif
+#if defined (_ICONV_TO_ENCODING_EUC_KR) \
+ || defined (_ICONV_ENABLE_EXTERNAL_CCS)
+ if (strcmp (encoding, ICONV_ENCODING_EUC_KR) == 0)
+ {
+ data->type = TYPE_EUC_KR;
+ data->mb_cur_max = 2;
+ data->desc = &euc_kr_cs_desc[0];
+ goto ok;
+ }
+#endif
+#if defined (_ICONV_TO_ENCODING_EUC_TW) \
+ || defined (_ICONV_ENABLE_EXTERNAL_CCS)
+ if (strcmp (encoding, ICONV_ENCODING_EUC_TW) == 0)
+ {
+ data->type = TYPE_EUC_TW;
+ data->mb_cur_max = 4;
+ data->desc = &euc_tw_cs_desc[0];
+ goto ok;
+ }
+#endif
+
+ goto error1;
+
+ok:
+ for (i = 0; data->desc[i].csname != NULL; i++)
+ {
+ data->data[i] = _iconv_to_ucs_ces_handlers_table.init (
+ rptr,
+ data->desc[i].csname);
+ if (data->data == NULL)
+ goto error;
+ }
+
+ return data;
+
+error:
+ _iconv_to_ucs_ces_handlers_table.close (rptr, data);
+ return NULL;
+error1:
+ _free_r (rptr, (_VOID_PTR)data);
+ return NULL;
+}
+
+static size_t
+_DEFUN(euc_to_ucs_close, (rptr, data),
+ struct _reent *rptr _AND
+ _VOID_PTR data)
+{
+ int i;
+ size_t res = 0;
+
+ for (i = 0; i < MAX_CS_NUM; i++)
+ {
+ if (((euc_data_t *)data)->data[i] != NULL)
+ res |= _iconv_to_ucs_ces_handlers_table.close (
+ rptr,
+ ((euc_data_t *)data)->data[i]);
+ }
+ _free_r(rptr, data);
+
+ return res;
+}
+
+static ucs4_t
+_DEFUN(euc_convert_to_ucs, (data, inbuf, inbytesleft),
+ _VOID_PTR data _AND
+ _CONST unsigned char **inbuf _AND
+ size_t *inbytesleft)
+{
+ int i;
+ int j;
+ ucs4_t res;
+ unsigned char buf[ICONV_MB_LEN_MAX];
+ size_t inbytesleft1;
+ euc_data_t *d = (euc_data_t *)data;
+ unsigned char *inbuf1 = &buf[0];
+
+ if (**inbuf < 0x80) /* CS0 is always ASCII */
+ return _iconv_to_ucs_ces_handlers_us_ascii.convert_to_ucs (
+ NULL,
+ inbuf,
+ inbytesleft);
+
+ for (i = 1; d->desc[i].csname != NULL; i++)
+ {
+ if (memcmp((_CONST _VOID_PTR)(*inbuf),
+ (_CONST _VOID_PTR)d->desc[i].prefix,
+ d->desc[i].prefixbytes) == 0)
+ {
+ if (((int)*inbytesleft - d->desc[i].prefixbytes - d->desc[i].bytes) < 0)
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ if (d->desc[i].touchmsb)
+ for (j = 0; j < d->desc[i].bytes; j++)
+ {
+ if (!((*inbuf)[j + d->desc[i].prefixbytes] & 0x80))
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+ inbuf1[j] = (*inbuf)[j + d->desc[i].prefixbytes] & 0x7F;
+ }
+ else
+ for (j = 0; j < d->desc[i].bytes; j++)
+ inbuf1[j] = (*inbuf)[j + d->desc[i].prefixbytes];
+
+ inbytesleft1 = d->desc[i].bytes;
+
+ res = _iconv_to_ucs_ces_handlers_table.convert_to_ucs (
+ d->data[i],
+ (_CONST unsigned char **)&inbuf1,
+ &inbytesleft1);
+ if (((__int32_t)res) > 0)
+ {
+ *inbuf += d->desc[i].bytes + d->desc[i].prefixbytes;
+ *inbytesleft -= d->desc[i].bytes + d->desc[i].prefixbytes;
+ }
+
+ return res;
+ }
+ }
+
+ /* Process CS1 */
+ if (((int)(*inbytesleft - d->desc[0].prefixbytes - d->desc[0].bytes)) < 0)
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ if (d->desc[0].touchmsb)
+ for (j = 0; j < d->desc[0].bytes; j++)
+ {
+ if (!((*inbuf)[j + d->desc[0].prefixbytes] & 0x80))
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+ inbuf1[j] = (*inbuf)[j] & 0x7F;
+ }
+ else
+ for (j = 0; j < d->desc[0].bytes; j++)
+ inbuf1[j] = (*inbuf)[j];
+
+ inbytesleft1 = d->desc[0].bytes;
+
+ res = _iconv_to_ucs_ces_handlers_table.convert_to_ucs (
+ d->data[0],
+ (_CONST unsigned char **)&inbuf1,
+ &inbytesleft1);
+ if (((__int32_t)res) > 0)
+ {
+ *inbuf += d->desc[0].bytes;
+ *inbytesleft -= d->desc[0].bytes;
+ }
+
+ return res;
+}
+#endif /* ICONV_TO_UCS_CES_EUC */
+
+static int
+_DEFUN(euc_get_mb_cur_max, (data),
+ _VOID_PTR data)
+{
+ return ((euc_data_t *)data)->mb_cur_max;
+}
+
+#if defined (ICONV_FROM_UCS_CES_EUC)
+_CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_euc =
+{
+ euc_from_ucs_init,
+ euc_from_ucs_close,
+ euc_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ euc_convert_from_ucs
+};
+#endif
+
+#if defined (ICONV_TO_UCS_CES_EUC)
+_CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_euc =
+{
+ euc_to_ucs_init,
+ euc_to_ucs_close,
+ euc_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ euc_convert_to_ucs
+};
+#endif
+
+#endif /* ICONV_TO_UCS_CES_EUC || ICONV_FROM_UCS_CES_EUC */
+
+
euc.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mkdeps.pl
===================================================================
--- mkdeps.pl (nonexistent)
+++ mkdeps.pl (revision 520)
@@ -0,0 +1,930 @@
+#!/usr/bin/perl -w
+#
+# Copyright (c) 2003-2004, Artem B. Bityuckiy, SoftMine Corporation.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+use integer;
+use Getopt::Std;
+use strict;
+
+sub err($);
+sub process_section_encodings($);
+sub process_section_cesdeps($);
+sub next_entry($$$);
+
+sub generate_cesbi_h($$);
+sub generate_encnames_h(@);
+sub generate_aliasesbi_c($);
+sub generate_encoding_aliases_c($);
+sub generate_cesdeps_h($);
+sub generate_ccsbi_h($);
+sub generate_cesbi_c($);
+sub generate_ccsnames_h($);
+
+# ==============================================================================
+#
+# GLOBAL VARIABLES
+#
+# ==============================================================================
+
+my $comment_automatic =
+"/*
+ * This file was automatically generated mkdeps.pl script. Don't edit.
+ */";
+
+my $macro_from_enc = '_ICONV_FROM_ENCODING_';
+my $macro_to_enc = '_ICONV_TO_ENCODING_';
+my $macro_from_ucs_ces = 'ICONV_FROM_UCS_CES_';
+my $macro_to_ucs_ces = 'ICONV_TO_UCS_CES_';
+my $macro_from_ucs_ccs = 'ICONV_FROM_UCS_CCS_';
+my $macro_to_ucs_ccs = 'ICONV_TO_UCS_CCS_';
+my $macro_enc_name = 'ICONV_ENCODING_';
+my $macro_ccs_name = 'ICONV_CCS_';
+
+my $var_from_ucs_handlers = '_iconv_from_ucs_ces_handlers_';
+my $var_to_ucs_handlers = '_iconv_to_ucs_ces_handlers_';
+my $var_ccs = '_iconv_ccs_';
+my $var_aliases = '_iconv_aliases';
+my $var_ces_names = 'iconv_ces_names_';
+
+# ==============================================================================
+#
+# PARSE COMMAND-LINE OPTIONS.
+#
+# ==============================================================================
+
+my %options;
+
+# SUPPORTED OPTIONS.
+my $help_opt = 'h';
+my $infile_opt = 'i';
+my $verbose_opt = 'v';
+
+# Default input configuration file name
+my $default_infile = '../lib/encoding.deps';
+# Real input configuration file name
+my $infile;
+# Verbose flag (be verbose if not zero)
+my $verbose;
+
+{
+getopts ("${help_opt}${verbose_opt}${infile_opt}:", \%options)
+or err "getopts() failed: $!.";
+
+if ($options{$help_opt})
+{
+ # Output help message and exit.
+ print "Usage: $0 [-$infile_opt depfile] [-$help_opt]\n";
+ print "\t-$infile_opt - input file with configuration ($default_infile ";
+ print "file will be used by default)\n";
+ print "\t-$help_opt - this help message\n";
+ exit 0;
+}
+
+# Input file name.
+$infile = $options{$infile_opt} ? $options{$infile_opt} : $default_infile;
+$verbose = $options{$verbose_opt} ? 1 : 0;
+
+print "Debug: -$verbose_opt option found.\n" if $verbose;
+
+# ==============================================================================
+#
+# Find and fetch sections from input file
+#
+# ==============================================================================
+
+# Opening input file
+print "Debug: open \"$infile\" input file.\n" if $verbose;
+open (INFILE, '<', $infile) or err "Can't open \"$infile\" file for reading.\n"
+ . "System error message: $!.\n";
+
+# Configuration file markers
+my $marker_section = 'SECTION';
+my $marker_section_end = 'SECTION END';
+
+# File sections. Hash values are references to arrays with section contents
+my %sections;
+
+# Extract sections from file
+for (my $ln = 1; my $l = ; $ln += 1)
+{
+ # Skip comments and empty lines
+ next if $l =~ m/^#.*$/ or $l =~ m/^\s*$/;
+
+ # Remove last CR symbol
+ $l =~ s/^(.*)\n$/$1/, $l =~ s/^(.*)\r$/$1/;
+
+ # Generate error if line isn't section begin marker
+ err "(input file line $ln) Unexpected marker: \"$l\". ${marker_section} "
+ . "is expected."
+ if $l !~ m/^$marker_section(\s+(\S*)\s*)?$/;
+
+ # Generate error if there is no section name
+ err "(input file line $ln) Section name isn't found"
+ if !$1 or !$2;
+
+ # Generate error if this is section end marker
+ err "(input file line $ln) Unexpected \"${marker_section_end}\" marker "
+ . "in input file."
+ if $2 eq $marker_section_end;
+
+ my $sect_name = $2;
+
+ # Extract section content
+ for (; $l = ; $ln += 1)
+ {
+ # Skip comments and empty lines
+ next if $l =~ m/^#.*$/ or $l =~ m/^$/;
+ # Remove last CR symbol
+ $l =~ s/^(.*)\n$/$1/, $l =~ s/^(.*)\r$/$1/;
+
+ last if $l =~ m/^$marker_section_end$/;
+
+ push @{$sections{$sect_name}}, $l;
+ }
+
+ # Generate error if section wasn't ended
+ err "(input file line $ln) \"No $marker_section_end\" marker found"
+ if $l !~ m/^$marker_section_end$/;
+}
+
+close INFILE or err "Error while closing input file.";
+
+# =============================================================================
+#
+# Now sections are fetched. Each section is processed by separate function.
+# There are only three supported sections now: ENCODINGS, CES_DEPENDENCIES
+# and ENCODING_CCS_DEPENDENCIES.
+#
+# =============================================================================
+
+my $section_encodings = 'ENCODINGS';
+my $section_cesdeps = 'CES_DEPENDENCIES';
+
+my $section;
+
+err "$section_encodings not found."
+if !defined $sections{$section_encodings};
+err "$section_cesdeps not found."
+if !defined $sections{$section_cesdeps};
+
+# Process sections
+print "Debug: process $section_encodings section.\n" if $verbose;
+process_section_encodings ($sections{$section_encodings});
+delete $sections{$section_encodings};
+
+print "Debug: process $section_cesdeps section.\n" if $verbose;
+process_section_cesdeps ($sections{$section_cesdeps});
+delete $sections{$section_cesdeps};
+
+print STDERR "Warning: section \"$_\" was ignored!\n"
+foreach (keys %sections);
+
+exit 1;
+}
+
+# =============================================================================
+#
+# Print error message and exit.
+#
+# Parameter 1: error message.
+#
+# =============================================================================
+sub err($)
+{
+ print STDERR "Error while running script.\n$_[0]\n";
+ exit 0;
+}
+
+
+# =============================================================================
+#
+# Process ENCODINGS section.
+#
+# Parameter 1 (input): array reference with section content;
+#
+# =============================================================================
+sub process_section_encodings($)
+{
+ my $sect = $_[0];
+ my $lineidx = 0;
+ my @entry;
+ my $marker_encoding = 'ENCODING';
+ my $marker_ces = 'CES';
+ my $marker_ccs = 'CCS';
+ my $marker_aliases = 'ALIASES';
+
+ # Keys: CES names. Values: array reference with encodings list.
+ my %cesenc;
+ # Keys: encodings. Values: CES converter names.
+ my %encces;
+ # Keys: CCS tables names. Values: array reference with encodings.
+ my %ccsenc;
+ # Keys: encodings. Values: aliases list.
+ my %encalias;
+
+ while (next_entry ($sect, \@entry, \$lineidx))
+ {
+ my $encoding;
+ my $ces;
+ my $ccs;
+ my $aliases;
+
+ foreach my $l (@entry)
+ {
+ if ($l =~ m/^($marker_encoding):\s*(\S*)\s*$/)
+ {
+ err "(process_section_encodings()) More than one $marker_encoding "
+ . "records found ($l)"
+ if defined $encoding;
+
+ $encoding = $2;
+ }
+ elsif ($l =~ m/^($marker_ces):\s*(\S*)\s*$/)
+ {
+ err "(process_section_encodings()) More than one $marker_ces "
+ . "records found ($l)"
+ if defined $ces;
+
+ $ces = $2;
+ }
+ elsif ($l =~ m/^($marker_aliases):\s*(.*)\s*$/)
+ {
+ err "(process_section_encodings()) More than one "
+ . "$marker_aliases records found ($l)"
+ if defined $aliases;
+
+ $aliases = $2;
+ }
+ elsif ($l =~ m/^($marker_ccs):\s*(.*)\s*$/)
+ {
+ err "(process_section_encodings()) More than one "
+ . "$marker_ccs records found ($l)"
+ if defined $ccs;
+
+ $ccs = $2;
+ }
+ else
+ {
+ err "(process_section_encodings()) Can't parse \"$l\"";
+ }
+ }
+
+ err "(process_section_encodings()) $encoding is defined twice"
+ if (defined $encces{$encoding});
+ err "(process_section_encodings()) ENCODING: field isn't found"
+ if not defined $encoding;
+
+ if (defined $ces)
+ {
+ push @{$cesenc{$ces}}, $encoding;
+ $encces{$encoding} = $ces;
+ }
+
+ if (defined $ccs)
+ {
+ my @ccs = split / /, $ccs;
+ push @{$ccsenc{$_}}, $encoding foreach (@ccs);
+ }
+ $encalias{$encoding} = $aliases;
+ }
+
+ # Generate cesbi.h header file
+ generate_cesbi_h (\%cesenc, \%encces);
+
+ # Generate encnames.h header file
+ generate_encnames_h (keys %encces);
+
+ # Generate aliasesbi.c file
+ generate_aliasesbi_c (\%encalias);
+
+ # Generate encoding.aliases file
+ generate_encoding_aliases (\%encalias);
+
+ # Generate ccsbi.h header file
+ generate_ccsbi_h (\%ccsenc);
+
+ # Generate cesbi.c file
+ generate_cesbi_c (\%cesenc);
+
+ # Generate ccsbi.c file
+ my @ccs = keys %ccsenc;
+ generate_ccsbi_c (\@ccs);
+
+ # Generate ccsnames.h header file
+ generate_ccsnames_h (\%ccsenc);
+
+}
+
+# ==============================================================================
+#
+# Process CES_DEPENDENCIES section.
+#
+# Parameter 1: array reference with section content.
+#
+# ==============================================================================
+sub process_section_cesdeps($)
+{
+ my $sect = $_[0];
+ my $lineidx = 0;
+ my @entry;
+ my $marker_ces = 'CES';
+ my $marker_used_ces = 'USED_CES';
+ my %cesdeps;
+
+ while (next_entry ($sect, \@entry, \$lineidx))
+ {
+ my $ces;
+ my $used_ces;
+
+ foreach my $l (@entry)
+ {
+ if ($l =~ m/^($marker_ces):\s*(\S*)\s*$/)
+ {
+ err "(process_section_cesdeps()) More than one $marker_ces "
+ . "records found ($l)"
+ if $ces;
+
+ $ces = $2;
+ }
+ elsif ($l =~ m/^($marker_used_ces):\s*(.*)\s*$/)
+ {
+ err "(process_section_cesdeps()) More than one $marker_used_ces "
+ . "records found ($l)"
+ if $used_ces;
+
+ $used_ces = $2;
+ }
+ else
+ {
+ err "(process_section_cesdeps()) Can't parse \"$l\"";
+ }
+ }
+
+ err "(process_section_esdeps()) $ces dependecties are defined twice"
+ if (defined $cesdeps{$ces});
+
+ # Split string
+ my @used_ces = split / /, $used_ces;
+
+ $cesdeps{$ces} = \@used_ces;
+ }
+
+ # Generate cesdeps.h header file
+ generate_cesdeps_h (\%cesdeps);
+}
+
+# ==============================================================================
+#
+# Extract next entry.
+#
+# Parameter 1 (input): array reference with entries;
+# Parameter 2 (output): array reference with entry content;
+# Parameter 3 (input/output): scalar reference with line index to process.
+#
+# Returns 1 is entry was found, 0 if thee is no more entries;
+#
+# ==============================================================================
+sub next_entry($$$)
+{
+ my $entries = $_[0];
+ my $entry = $_[1];
+ my $idx = $_[2];
+ my $marker_entry = 'ENTRY';
+ my $marker_entry_end = 'ENTRY END';
+ my $entry_flag = 0;
+
+ return 0 if not defined ${$entries}[${$idx}];
+
+ undef @{$entry};
+
+ for (; my $l = ${$entries}[${$idx}++];)
+ {
+ # Skip comments and empty lines
+ next if $l =~ m/^#.*$/ or $l =~ m/^\s*$/;
+
+ if ($l =~ m/^$marker_entry$/)
+ {
+ err "(next_entry()) $marker_entry marker appears twice"
+ if ($entry_flag == 1);
+ $entry_flag = 1;
+ $l = ${$entries}[${$idx}++]
+ }
+ else
+ {
+ # Generate error if line isn't entry begin marker
+ err "(next_entry()) Unexpected marker: \"$l\". ${marker_entry} "
+ . "is expected."
+ if ($entry_flag == 0)
+ }
+
+ last if $l =~ m/^$marker_entry_end$/;
+
+ push @{$entry}, $l;
+ }
+
+ return 1;
+}
+
+# ==============================================================================
+#
+# Generate cesbi.h file.
+#
+# Parameter 1 (input): hash reference with keys = CES Converters names and
+# values = array references with list of supported encodings.
+# Parameter 2 (input): hash reference with keys = encodings names and
+# values = CES converter names.
+#
+# ==============================================================================
+sub generate_cesbi_h($$)
+{
+ my %cesenc = %{$_[0]};
+ my %encces = %{$_[1]};
+ my @ces = sort keys %cesenc;
+
+ print "Debug: create \"cesbi.h\" file.\n" if $verbose;
+ open (CESBI_H, '>', "cesbi.h")
+ or err "Can't create \"cesbi.h\" file for writing.\nSystem error message: $!.\n";
+
+ print CESBI_H "$comment_automatic\n\n";
+ print CESBI_H "#ifndef __CESBI_H__\n";
+ print CESBI_H "#define __CESBI_H__\n\n";
+ print CESBI_H "#include \n";
+ print CESBI_H "#include <_ansi.h>\n";
+ print CESBI_H "#include \"../lib/encnames.h\"\n";
+ print CESBI_H "#include \"../lib/ucsconv.h\"\n\n";
+ print CESBI_H "/*\n";
+ print CESBI_H " * Enable CES converter if correspondent encoding is requested.\n";
+ print CESBI_H " * Defining ${macro_to_ucs_ces}XXX macro or ${macro_from_ucs_ces}XXX\n";
+ print CESBI_H " * macro is needed to enable \"XXX encoding -> UCS\" or \"UCS -> XXX encoding\"\n";
+ print CESBI_H " * part of UCS-based CES converter.\n";
+ print CESBI_H " */\n";
+
+ foreach my $ces (@ces)
+ {
+ my @encs = sort @{$cesenc{$ces}};
+ foreach my $encoding (@encs)
+ {
+ print CESBI_H $encoding eq $encs[0] ? "#if " : " || ";
+ print CESBI_H "defined ($macro_from_enc\U$encoding)";
+ print CESBI_H " \\" if $encoding ne $encs[$#encs];
+ print CESBI_H "\n";
+ }
+ print CESBI_H "# define $macro_to_ucs_ces\U$ces\n";
+ print CESBI_H "#endif\n";
+
+ foreach my $encoding (@encs)
+ {
+ print CESBI_H $encoding eq $encs[0] ? "#if " : " || ";
+ print CESBI_H "defined ($macro_to_enc\U$encoding)";
+ print CESBI_H " \\" if $encoding ne $encs[$#encs];
+ print CESBI_H "\n";
+ }
+ print CESBI_H "# define $macro_from_ucs_ces\U$ces\n";
+ print CESBI_H "#endif\n\n";
+ }
+
+ print CESBI_H "/*\n";
+ print CESBI_H " * Some encodings require another encodings to be enabled.\n";
+ print CESBI_H " * These dependencies are handled in cesdeps.h header file.\n";
+ print CESBI_H " */\n";
+ print CESBI_H "#include \"cesdeps.h\"\n\n";
+
+ print CESBI_H "/*\n";
+ print CESBI_H " * NLS uses iconv's capabilities and require one of encodings\n";
+ print CESBI_H " * to be enabled for internal wchar_t representation.\n";
+ print CESBI_H " */\n";
+ print CESBI_H "#include \"../lib/iconvnls.h\"\n\n";
+
+ print CESBI_H "/*\n";
+ print CESBI_H " * Forward declarations of CES converter handlers.\n";
+ print CESBI_H " * These handlers are actually defined in correspondent CES converter files.\n";
+ print CESBI_H " */\n";
+
+ foreach my $ces (@ces)
+ {
+ print CESBI_H "#ifdef $macro_to_ucs_ces\U$ces\n";
+ print CESBI_H "extern _CONST iconv_to_ucs_ces_handlers_t\n";
+ print CESBI_H "$var_to_ucs_handlers$ces;\n";
+ print CESBI_H "#endif\n";
+
+ print CESBI_H "#ifdef $macro_from_ucs_ces\U$ces\n";
+ print CESBI_H "extern _CONST iconv_from_ucs_ces_handlers_t\n";
+ print CESBI_H "$var_from_ucs_handlers$ces;\n";
+ print CESBI_H "#endif\n\n";
+ }
+
+ print CESBI_H "#endif /* !__CESBI_H__ */\n\n";
+ close CESBI_H or err "Error while closing cesbi.h file.";
+}
+
+# ==============================================================================
+#
+# Generate encnames.h header file.
+#
+# Parameters: array of supported encodings.
+#
+# ==============================================================================
+sub generate_encnames_h(@)
+{
+ print "Debug: create \"../lib/encnames.h\" file.\n" if $verbose;
+ open (ENCNAMES_H, '>', "../lib/encnames.h")
+ or err "Can't create \"../lib/encnames.h\" file for writing.\nSystem error message: $!.\n";
+
+ print ENCNAMES_H "$comment_automatic\n\n";
+ print ENCNAMES_H "#ifndef __ENCNAMES_H__\n";
+ print ENCNAMES_H "#define __ENCNAMES_H__\n\n";
+
+ print ENCNAMES_H "/*\n";
+ print ENCNAMES_H " * Encodings name macros.\n";
+ print ENCNAMES_H " */\n";
+
+ foreach my $enc (sort @_)
+ {
+ print ENCNAMES_H "#define $macro_enc_name\U$enc\E \"$enc\"\n";
+ }
+
+ print ENCNAMES_H "\n#endif /* !__ENCNAMES_H__ */\n\n";
+ close ENCNAMES_H or err "Error while closing ../lib/encnames.h file.";
+}
+
+# ==============================================================================
+#
+# Generate aliasesbi.c C source file.
+#
+# Parameters: hash reference with keys = encodings and values = aliases string.
+#
+# ==============================================================================
+sub generate_aliasesbi_c($)
+{
+ print "Debug: create \"../lib/aliasesbi.c\" file.\n" if $verbose;
+ open (ALIASESBI_C, '>', "../lib/aliasesbi.c")
+ or err "Can't create \"../lib/aliasesbi.c\" file for writing.\nSystem error message: $!.\n";
+
+ print ALIASESBI_C "$comment_automatic\n\n";
+ print ALIASESBI_C "#include <_ansi.h>\n";
+ print ALIASESBI_C "#include \"encnames.h\"\n\n";
+ print ALIASESBI_C "_CONST char *\n";
+ print ALIASESBI_C "$var_aliases =\n";
+ print ALIASESBI_C "{\n";
+
+ foreach my $enc (sort keys %{$_[0]})
+ {
+ print ALIASESBI_C "#if defined ($macro_from_enc\U$enc) \\\n";
+ print ALIASESBI_C " || defined ($macro_to_enc\U$enc)\n";
+ print ALIASESBI_C " $macro_enc_name\U$enc\E";
+ print ALIASESBI_C " \" ${$_[0]}{$enc}\\n\"" if defined ${$_[0]}{$enc};
+ print ALIASESBI_C "\n";
+ print ALIASESBI_C "#endif\n";
+ }
+ print ALIASESBI_C " \"\"\n";
+ print ALIASESBI_C "};\n\n";
+
+ close ALIASESBI_C or err "Error while closing ../lib/aliasesbi.c file.";
+}
+
+# ==============================================================================
+#
+# Generate encoding.aliases file.
+#
+# Parameter 1: hash reference with keys = encodings and values = aliases string.
+#
+# ==============================================================================
+sub generate_encoding_aliases($)
+{
+ print "Debug: create \"../encoding.aliases\" file.\n" if $verbose;
+ open (ALIASES, '>', "../encoding.aliases")
+ or err "Can't create \"../encoding.aliases\" file for writing.\nSystem error message: $!.\n";
+
+ print ALIASES "#\n# This file was automatically generated. Don't edit.\n#\n\n";
+
+ foreach my $enc (sort keys %{$_[0]})
+ {
+ print ALIASES "$enc";
+ print ALIASES " ${$_[0]}{$enc}" if defined ${$_[0]}{$enc};
+ print ALIASES "\n";
+ }
+
+ print ALIASES "\n";
+
+ close ALIASES or err "Error while closing ./encoding.aliases file.";
+}
+
+# ==============================================================================
+#
+# Generate cesdeps.h header file.
+#
+# Parameter 1: hash reference with keys = CES converters and values = references
+# to arrays with list of CES converters which are needed by that CES converter
+# (defined by key).
+#
+# ==============================================================================
+sub generate_cesdeps_h($)
+{
+ my %cesdeps = %{$_[0]};
+
+ print "Debug: create \"cesdeps.h\" file.\n" if $verbose;
+ open (CESDEPS_H, '>', "cesdeps.h")
+ or err "Can't create \"cesdeps.h\" file for writing.\nSystem error message: $!.\n";
+
+ print CESDEPS_H "$comment_automatic\n\n";
+ print CESDEPS_H "#ifndef __CESDEPS_H__\n";
+ print CESDEPS_H "#define __CESDEPS_H__\n\n";
+
+ print CESDEPS_H "/*\n";
+ print CESDEPS_H " * Some CES converters use another CES converters and the following\n";
+ print CESDEPS_H " * is such dependencies description.\n";
+ print CESDEPS_H " */\n";
+
+ foreach my $ces (sort keys %cesdeps)
+ {
+ my @deps = sort @{$cesdeps{$ces}};
+
+ print CESDEPS_H "#ifdef $macro_to_ucs_ces\U$ces\n";
+
+ foreach my $dep (@deps)
+ {
+ print CESDEPS_H "# ifndef $macro_to_ucs_ces\U$dep\n";
+ print CESDEPS_H "# define $macro_to_ucs_ces\U$dep\n";
+ print CESDEPS_H "# endif\n";
+ }
+ print CESDEPS_H "#endif\n";
+
+ print CESDEPS_H "#ifdef $macro_from_ucs_ces\U$ces\n";
+ foreach my $dep (@deps)
+ {
+ print CESDEPS_H "# ifndef $macro_from_ucs_ces\U$dep\n";
+ print CESDEPS_H "# define $macro_from_ucs_ces\U$dep\n";
+ print CESDEPS_H "# endif\n";
+ }
+ print CESDEPS_H "#endif\n";
+ }
+
+ print CESDEPS_H "\n#endif /* !__CESDEPS_H__ */\n\n";
+ close CESDEPS_H or err "Error while closing cesdeps.h file.";
+}
+
+# ==============================================================================
+#
+# Generate ccsbi.h file.
+#
+# Parameter 1 (input): hash reference with keys = CCS tables names and
+# values = array references with list of encodings which need this CCS table.
+#
+# ==============================================================================
+sub generate_ccsbi_h($)
+{
+ my %ccsenc = %{$_[0]};
+ my @ccs = sort keys %ccsenc;
+
+ print "Debug: create \"../ccs/ccsbi.h\" file.\n" if $verbose;
+ open (CCSBI_H, '>', "../ccs/ccsbi.h")
+ or err "Can't create \"../ccs/ccsbi.h\" file for writing.\nSystem error message: $!.\n";
+
+ print CCSBI_H "$comment_automatic\n\n";
+ print CCSBI_H "#ifndef __CCSBI_H__\n";
+ print CCSBI_H "#define __CCSBI_H__\n\n";
+ print CCSBI_H "#include \n";
+ print CCSBI_H "#include <_ansi.h>\n";
+ print CCSBI_H "#include \"ccs.h\"\n\n";
+ print CCSBI_H "/*\n";
+ print CCSBI_H " * Enable CCS tables if encoding needs them.\n";
+ print CCSBI_H " * Defining ${macro_to_ucs_ccs}XXX macro or ${macro_from_ucs_ccs}XXX\n";
+ print CCSBI_H " * macro is needed to enable \"XXX encoding -> UCS\" or \"UCS -> XXX encoding\"\n";
+ print CCSBI_H " * part of CCS table.\n";
+ print CCSBI_H " * CCS tables aren't linked if Newlib was configuted to use external CCS tables.\n";
+ print CCSBI_H " */\n";
+
+ print CCSBI_H "#ifndef _ICONV_ENABLE_EXTERNAL_CCS\n\n";
+
+ foreach my $ccs (@ccs)
+ {
+ my @encs = sort @{$ccsenc{$ccs}};
+ foreach my $encoding (@encs)
+ {
+ print CCSBI_H $encoding eq $encs[0] ? "#if " : " || ";
+ print CCSBI_H "defined ($macro_from_enc\U$encoding)";
+ print CCSBI_H " \\" if $encoding ne $encs[$#encs];
+ print CCSBI_H "\n";
+ }
+ print CCSBI_H "# define $macro_to_ucs_ccs\U$ccs\n";
+ print CCSBI_H "#endif\n";
+
+ foreach my $encoding (@encs)
+ {
+ print CCSBI_H $encoding eq $encs[0] ? "#if " : " || ";
+ print CCSBI_H "defined ($macro_to_enc\U$encoding)";
+ print CCSBI_H " \\" if $encoding ne $encs[$#encs];
+ print CCSBI_H "\n";
+ }
+ print CCSBI_H "# define $macro_from_ucs_ccs\U$ccs\n";
+ print CCSBI_H "#endif\n\n";
+ }
+
+ print CCSBI_H "/*\n";
+ print CCSBI_H " * CCS table description structures forward declarations.\n";
+ print CCSBI_H " */\n";
+
+ foreach my $ccs (@ccs)
+ {
+ print CCSBI_H "#if defined ($macro_to_ucs_ccs\U$ccs) \\\n";
+ print CCSBI_H " || defined ($macro_from_ucs_ccs\U$ccs)\n";
+ print CCSBI_H "extern _CONST iconv_ccs_t\n";
+ print CCSBI_H "$var_ccs$ccs;\n";
+ print CCSBI_H "#endif\n";
+ }
+
+ print CCSBI_H "\n#endif /* !_ICONV_ENABLE_EXTERNAL_CCS */\n\n";
+ print CCSBI_H "\n#endif /* __CCSBI_H__ */\n\n";
+ close CCSBI_H or err "Error while closing ../ccs/ccsbi.h file.";
+}
+
+# ==============================================================================
+#
+# Generate cesbi.c file.
+#
+# Parameter 1 (input): hash reference with keys = CES Converters names and
+# values = array references with list of supported encodings.
+#
+# ==============================================================================
+sub generate_cesbi_c($)
+{
+ my %cesenc = %{$_[0]};
+ my @ces = sort keys %cesenc;
+
+ print "Debug: create \"cesbi.c\" file.\n" if $verbose;
+ open (CESBI_C, '>', "cesbi.c")
+ or err "Can't create \"cesbi.c\" file for writing.\nSystem error message: $!.\n";
+
+ print CESBI_C "$comment_automatic\n\n";
+ print CESBI_C "#include <_ansi.h>\n";
+ print CESBI_C "#include \n";
+ print CESBI_C "#include \"../lib/ucsconv.h\"\n";
+ print CESBI_C "#include \"cesbi.h\"\n\n";
+ print CESBI_C "/*\n";
+ print CESBI_C " * Each CES converter provides the list of supported encodings.\n";
+ print CESBI_C " */\n";
+
+ foreach my $ces (@ces)
+ {
+ print CESBI_C "#if defined ($macro_to_ucs_ces\U$ces) \\\n";
+ print CESBI_C " || defined ($macro_from_ucs_ces\U$ces)\n";
+ print CESBI_C "static _CONST char *\n";
+ print CESBI_C "$var_ces_names${ces}\[] =\n";
+ print CESBI_C "{\n";
+ my @encodings = sort @{$cesenc{$ces}};
+ foreach my $encoding (@encodings)
+ {
+ print CESBI_C "# if defined ($macro_from_enc\U$encoding) \\\n";
+ print CESBI_C " || defined ($macro_to_enc\U$encoding)\n";
+ print CESBI_C " $macro_enc_name\U$encoding,\n";
+ print CESBI_C "#endif\n";
+ }
+ print CESBI_C " NULL\n";
+ print CESBI_C "};\n";
+ print CESBI_C "#endif\n\n";
+ }
+
+ print CESBI_C "/*\n";
+ print CESBI_C " * The following structure contains the list of \"to UCS\" linked-in CES converters.\n";
+ print CESBI_C " */\n";
+ print CESBI_C "_CONST iconv_to_ucs_ces_t\n";
+ print CESBI_C "_iconv_to_ucs_ces[] =\n";
+ print CESBI_C "{\n";
+
+ foreach my $ces (@ces)
+ {
+ print CESBI_C "#ifdef $macro_to_ucs_ces\U$ces\n";
+ print CESBI_C " {(_CONST char **)$var_ces_names$ces,\n";
+ print CESBI_C " &$var_to_ucs_handlers$ces},\n";
+ print CESBI_C "#endif\n";
+ }
+ print CESBI_C " {(_CONST char **)NULL,\n";
+ print CESBI_C " (iconv_to_ucs_ces_handlers_t *)NULL}\n";
+ print CESBI_C "};\n\n";
+
+ print CESBI_C "/*\n";
+ print CESBI_C " * The following structure contains the list of \"from UCS\" linked-in CES converters.\n";
+ print CESBI_C " */\n";
+ print CESBI_C "_CONST iconv_from_ucs_ces_t\n";
+ print CESBI_C "_iconv_from_ucs_ces[] =\n";
+ print CESBI_C "{\n";
+
+ foreach my $ces (@ces)
+ {
+ print CESBI_C "#ifdef $macro_from_ucs_ces\U$ces\n";
+ print CESBI_C " {(_CONST char **)$var_ces_names$ces,\n";
+ print CESBI_C " &$var_from_ucs_handlers$ces},\n";
+ print CESBI_C "#endif\n";
+ }
+ print CESBI_C " {(_CONST char **)NULL,\n";
+ print CESBI_C " (iconv_from_ucs_ces_handlers_t *)NULL}\n";
+ print CESBI_C "};\n";
+
+ close CESBI_C or err "Error while closing cesbi.c file.";
+}
+
+# ==============================================================================
+#
+# Generate ccsbi.c file.
+#
+# Parameter 1 (input): array reference with CCS tables names
+#
+# ==============================================================================
+sub generate_ccsbi_c($)
+{
+ my @ccs = @{$_[0]};
+
+ print "Debug: create \"../ccs/ccsbi.c\" file.\n" if $verbose;
+ open (CESBI_C, '>', "../ccs/ccsbi.c")
+ or err "Can't create \"../ccs/ccsbi.c\" file for writing.\nSystem error message: $!.\n";
+
+ print CESBI_C "$comment_automatic\n\n";
+ print CESBI_C "#include <_ansi.h>\n";
+ print CESBI_C "#include \"ccsbi.h\"\n\n";
+ print CESBI_C "/*\n";
+ print CESBI_C " * The following array contains the list of built-in CCS tables.\n";
+ print CESBI_C " */\n";
+
+ print CESBI_C "_CONST iconv_ccs_t *\n";
+ print CESBI_C "_iconv_ccs[] =\n";
+ print CESBI_C "{\n";
+
+ foreach my $ccs (@ccs)
+ {
+ print CESBI_C "#if defined ($macro_to_ucs_ccs\U$ccs) \\\n";
+ print CESBI_C " || defined ($macro_from_ucs_ccs\U$ccs)\n";
+ print CESBI_C " &$var_ccs$ccs,\n";
+ print CESBI_C "#endif\n";
+ }
+ print CESBI_C " NULL\n";
+ print CESBI_C "};\n";
+
+ close CESBI_C or err "Error while closing ../ccs/ccsbi.c file.";
+}
+
+# ==============================================================================
+#
+# Generate ccsnames.h file.
+#
+# Parameter 1 (input): hash reference with keys = CCS tables names and
+# values = array references with list of encodings which need this CCS table.
+#
+# ==============================================================================
+sub generate_ccsnames_h($)
+{
+ my %ccsenc = %{$_[0]};
+ my @ccs = sort keys %ccsenc;
+
+ print "Debug: create \"../ccs/ccsnames.h\" file.\n" if $verbose;
+ open (CCSNAMES_H, '>', "../ccs/ccsnames.h")
+ or err "Can't create \"../ccs/ccsnames.h\" file for writing.\nSystem error message: $!.\n";
+
+ print CCSNAMES_H "$comment_automatic\n\n";
+ print CCSNAMES_H "#ifndef __CCSNAMES_H__\n";
+ print CCSNAMES_H "#define __CCSNAMES_H__\n\n";
+ print CCSNAMES_H "#include \"../lib/encnames.h\"\n\n";
+ print CCSNAMES_H "/*\n";
+ print CCSNAMES_H " * CCS tables names macros.\n";
+ print CCSNAMES_H " */\n";
+
+ foreach my $ccs (@ccs)
+ {
+ my @encs = @{$ccsenc{$ccs}};
+ my $flag;
+ foreach my $encoding (@encs)
+ {
+ print CCSNAMES_H "#define $macro_ccs_name\U$ccs ";
+ if ($encoding eq $ccs)
+ {
+ $flag = 1;
+ print CCSNAMES_H "$macro_enc_name\U$encoding\n";
+ last;
+ }
+ }
+ print CCSNAMES_H "\"$ccs\"\n" if !$flag;
+ }
+
+ print CCSNAMES_H "\n#endif /* !__CCSNAMES_H__ */\n\n";
+ close CCSNAMES_H or err "Error while closing ../ccs/ccsnames.h file.";
+}
mkdeps.pl
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: us-ascii.c
===================================================================
--- us-ascii.c (nonexistent)
+++ us-ascii.c (revision 520)
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2003-2004, Artem B. Bityuckiy
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include "cesbi.h"
+
+#if defined (ICONV_TO_UCS_CES_US_ASCII) \
+ || defined (ICONV_FROM_UCS_CES_US_ASCII)
+
+#include <_ansi.h>
+#include
+#include
+#include "../lib/local.h"
+#include "../lib/ucsconv.h"
+
+/*
+ * For optimization purposes us_ascii is implemented as separate CES converter.
+ * Another possible way is to add us_ascii CCS and use table-based CES converter.
+ */
+
+#if defined (ICONV_FROM_UCS_CES_US_ASCII)
+static size_t
+_DEFUN(us_ascii_convert_from_ucs, (data, in, outbuf, outbytesleft),
+ _VOID_PTR data _AND
+ ucs4_t in _AND
+ unsigned char **outbuf _AND
+ size_t *outbytesleft)
+{
+ if (in > 0x7F)
+ return (size_t)ICONV_CES_INVALID_CHARACTER;
+
+ *((char *)(*outbuf)) = (char)in;
+
+ *outbuf += 1;
+ *outbytesleft -= 1;
+
+ return 1;
+}
+#endif /* ICONV_FROM_UCS_CES_US_ASCII */
+
+#if defined (ICONV_TO_UCS_CES_US_ASCII)
+static ucs4_t
+_DEFUN(us_ascii_convert_to_ucs, (data, inbuf, inbytesleft),
+ _VOID_PTR data _AND
+ _CONST unsigned char **inbuf _AND
+ size_t *inbytesleft)
+{
+ ucs4_t res;
+
+ if (*inbytesleft < 1)
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ res = (ucs4_t)**inbuf;
+
+ if (res > 0x7F)
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ *inbytesleft -= 1;
+ *inbuf += 1;
+
+ return res;
+}
+#endif /* ICONV_TO_UCS_CES_US_ASCII */
+
+static int
+_DEFUN(us_ascii_get_mb_cur_max, (data),
+ _VOID_PTR data)
+{
+ return 2;
+}
+
+#if defined (ICONV_TO_UCS_CES_US_ASCII)
+_CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_us_ascii =
+{
+ NULL,
+ NULL,
+ us_ascii_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ us_ascii_convert_to_ucs
+};
+#endif
+
+#if defined (ICONV_FROM_UCS_CES_US_ASCII)
+_CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_us_ascii =
+{
+ NULL,
+ NULL,
+ us_ascii_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ us_ascii_convert_from_ucs
+};
+#endif
+
+#endif /* ICONV_TO_UCS_CES_US_ASCII || ICONV_FROM_UCS_CES_US_ASCII */
+
us-ascii.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: utf-16.c
===================================================================
--- utf-16.c (nonexistent)
+++ utf-16.c (revision 520)
@@ -0,0 +1,306 @@
+/*
+ * Copyright (c) 2003-2004, Artem B. Bityuckiy
+ * Copyright (c) 1999,2000, Konstantin Chuguev. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include "cesbi.h"
+
+#if defined (ICONV_TO_UCS_CES_UTF_16) \
+ || defined (ICONV_FROM_UCS_CES_UTF_16)
+
+#include <_ansi.h>
+#include
+#include
+#include
+#include
+#include
+#include "../lib/local.h"
+#include "../lib/ucsconv.h"
+#include "../lib/endian.h"
+
+/*
+ * On input UTF-16 converter interpret BOM and uses Big Endian byte order if BOM
+ * is absent. UTF-16 converter outputs in System Endian and adds correspondent
+ * BOM as first code. UTF-16LE and UTF-16BE converters ignore BOM on input and
+ * don't output BOM.
+ */
+
+#define UTF16_UNDEFINED 0x00
+#define UTF16_BIG_ENDIAN 0x01
+#define UTF16_LITTLE_ENDIAN 0x02
+#define UTF16_SYSTEM_ENDIAN 0x04
+#define UTF16_BOM_WRITTEN 0x08
+
+#define UTF16_BOM 0xFEFF
+
+#define UTF_16 "utf_16"
+#define UTF_16BE "utf_16be"
+#define UTF_16LE "utf_16le"
+
+static size_t
+_DEFUN(utf_16_close, (rptr, data),
+ struct _reent *rptr _AND
+ _VOID_PTR data)
+{
+ _free_r(rptr, data);
+ return 0;
+}
+
+#if defined (ICONV_FROM_UCS_CES_UTF_16)
+static _VOID_PTR
+_DEFUN(utf_16_init_from_ucs, (rptr, encoding),
+ struct _reent *rptr _AND
+ _CONST char *encoding)
+{
+ int *data;
+
+ if ((data = (int *)_malloc_r (rptr, sizeof (int))) == NULL)
+ return (_VOID_PTR)NULL;
+
+ if (strcmp (encoding, UTF_16LE) == 0)
+ *data = UTF16_LITTLE_ENDIAN;
+ else if (strcmp (encoding, UTF_16BE) == 0)
+ *data = UTF16_BIG_ENDIAN;
+ else
+ *data = UTF16_SYSTEM_ENDIAN;
+
+ return (_VOID_PTR)data;
+}
+
+static size_t
+_DEFUN(utf_16_convert_from_ucs, (data, in, outbuf, outbytesleft),
+ _VOID_PTR data _AND
+ register ucs4_t in _AND
+ unsigned char **outbuf _AND
+ size_t *outbytesleft)
+{
+ register ucs2_t *cp;
+ register size_t bytes;
+ register int *state;
+
+ if (in > 0x0010FFFF || (in >= 0x0000D800 && in <= 0x0000DFFF)
+ || in == 0x0000FFFF || in == 0x0000FFFE)
+ return (size_t)ICONV_CES_INVALID_CHARACTER;
+
+ state = (int *)data;
+ bytes = (*state == UTF16_SYSTEM_ENDIAN) ? sizeof (ucs2_t) * 2
+ : sizeof (ucs2_t);
+
+ if (in > 0x0000FFFF)
+ bytes += sizeof (ucs2_t);
+
+ if (*outbytesleft < bytes)
+ return (size_t)ICONV_CES_NOSPACE;
+
+ cp = (ucs2_t *)*outbuf;
+
+ if (*state == UTF16_SYSTEM_ENDIAN)
+ {
+ *cp++ = UTF16_BOM;
+ *state |= UTF16_BOM_WRITTEN;
+ }
+
+ if (in < 0x00010000)
+ {
+ switch (*state)
+ {
+ case UTF16_LITTLE_ENDIAN:
+ *cp = ICONV_HTOLES ((ucs2_t)in);
+ break;
+ case UTF16_BIG_ENDIAN:
+ *cp = ICONV_HTOBES ((ucs2_t)in);
+ break;
+ case (UTF16_SYSTEM_ENDIAN | UTF16_BOM_WRITTEN):
+ *cp = (ucs2_t)in;
+ break;
+ }
+ }
+ else
+ {
+ ucs2_t w1, w2;
+
+ /* Process surrogate pair */
+ in -= 0x00010000;
+ w1 = ((ucs2_t)((in >> 10)) & 0x03FF) | 0xD800;
+ w2 = (ucs2_t)(in & 0x000003FF) | 0xDC00;
+
+ switch (*state)
+ {
+ case UTF16_LITTLE_ENDIAN:
+ *cp++ = ICONV_HTOLES (w1);
+ *cp = ICONV_HTOLES (w2);
+ break;
+ case UTF16_BIG_ENDIAN:
+ *cp++ = ICONV_HTOBES (w1);
+ *cp = ICONV_HTOBES (w2);
+ break;
+ case (UTF16_SYSTEM_ENDIAN | UTF16_BOM_WRITTEN):
+ *cp++ = w1;
+ *cp = w2;
+ break;
+ }
+ }
+
+ *outbuf += bytes;
+ *outbytesleft -= bytes;
+
+ return bytes;
+}
+#endif /* ICONV_FROM_UCS_CES_UTF_16 */
+
+#if defined (ICONV_TO_UCS_CES_UTF_16)
+static _VOID_PTR
+_DEFUN(utf_16_init_to_ucs, (rptr, encoding),
+ struct _reent *rptr _AND
+ _CONST char *encoding)
+{
+ int *data;
+
+ if ((data = (int *)_malloc_r (rptr, sizeof (int))) == NULL)
+ return (_VOID_PTR)NULL;
+
+ if (strcmp (encoding, UTF_16BE) == 0)
+ *data = UTF16_BIG_ENDIAN;
+ else if (strcmp (encoding, UTF_16LE) == 0)
+ *data = UTF16_LITTLE_ENDIAN;
+ else
+ *data = UTF16_UNDEFINED;
+
+ return (_VOID_PTR)data;
+}
+
+static ucs4_t
+_DEFUN(utf_16_convert_to_ucs, (data, inbuf, inbytesleft),
+ _VOID_PTR data _AND
+ _CONST unsigned char **inbuf _AND
+ size_t *inbytesleft)
+{
+ register ucs2_t w1;
+ register ucs2_t w2;
+ register ucs2_t *cp;
+ int *state;
+ ucs4_t res;
+ int bytes = sizeof (ucs2_t);
+
+ if (*inbytesleft < bytes)
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ state = (int *)data;
+ cp = ((ucs2_t *)*inbuf);
+
+ if (*state == UTF16_UNDEFINED)
+ {
+ if (*cp == ICONV_HTOLES(UTF16_BOM))
+ *state = UTF16_LITTLE_ENDIAN;
+ else
+ *state = UTF16_BIG_ENDIAN;
+
+ if ( *cp == ICONV_HTOBES (UTF16_BOM)
+ || *cp == ICONV_HTOLES (UTF16_BOM))
+ {
+ if (*inbytesleft < (bytes += sizeof (ucs2_t)))
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+ cp += 1;
+ }
+ }
+
+ if (*state == UTF16_LITTLE_ENDIAN)
+ w1 = ICONV_LETOHS (*cp);
+ else
+ w1 = ICONV_BETOHS (*cp);
+
+ if (w1 < 0xD800 || w1 > 0xDFFF)
+ {
+ if (w1 == 0xFFFF || w1 == 0xFFFE)
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+ res = (ucs4_t)w1;
+ }
+ else
+ {
+ /* Process surrogate pair */
+ if (*inbytesleft < (bytes += 2))
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ if (w1 > 0xDBFF)
+ /* Broken surrogate character */
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ cp += 1;
+
+ if (*state == UTF16_LITTLE_ENDIAN)
+ w2 = ICONV_LETOHS (*cp);
+ else
+ w2 = ICONV_BETOHS (*cp);
+
+ if (w2 < 0xDC00 || w2 > 0xDFFF)
+ /* Broken surrogate character */
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ res = (ucs4_t)(w2 & 0x03FF) | ((ucs4_t)(w1 & 0x03FF) << 10);
+ res += 0x00010000;
+ }
+
+ *inbuf += bytes;
+ *inbytesleft -= bytes;
+
+ return res;
+}
+#endif /* ICONV_TO_UCS_CES_UTF_16 */
+
+static int
+_DEFUN(utf_16_get_mb_cur_max, (data),
+ _VOID_PTR data)
+{
+ return 6;
+}
+
+#if defined (ICONV_TO_UCS_CES_UTF_16)
+_CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_utf_16 =
+{
+ utf_16_init_to_ucs,
+ utf_16_close,
+ utf_16_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ utf_16_convert_to_ucs
+};
+#endif
+
+#if defined (ICONV_FROM_UCS_CES_UTF_16)
+_CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_utf_16 =
+{
+ utf_16_init_from_ucs,
+ utf_16_close,
+ utf_16_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ utf_16_convert_from_ucs
+};
+#endif
+
+#endif /* ICONV_TO_UCS_CES_UTF_16 || ICONV_FROM_UCS_CES_UTF_16 */
+
utf-16.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cesbi.c
===================================================================
--- cesbi.c (nonexistent)
+++ cesbi.c (revision 520)
@@ -0,0 +1,401 @@
+/*
+ * This file was automatically generated mkdeps.pl script. Don't edit.
+ */
+
+#include <_ansi.h>
+#include
+#include "../lib/ucsconv.h"
+#include "cesbi.h"
+
+/*
+ * Each CES converter provides the list of supported encodings.
+ */
+#if defined (ICONV_TO_UCS_CES_EUC) \
+ || defined (ICONV_FROM_UCS_CES_EUC)
+static _CONST char *
+iconv_ces_names_euc[] =
+{
+# if defined (_ICONV_FROM_ENCODING_EUC_JP) \
+ || defined (_ICONV_TO_ENCODING_EUC_JP)
+ ICONV_ENCODING_EUC_JP,
+#endif
+# if defined (_ICONV_FROM_ENCODING_EUC_KR) \
+ || defined (_ICONV_TO_ENCODING_EUC_KR)
+ ICONV_ENCODING_EUC_KR,
+#endif
+# if defined (_ICONV_FROM_ENCODING_EUC_TW) \
+ || defined (_ICONV_TO_ENCODING_EUC_TW)
+ ICONV_ENCODING_EUC_TW,
+#endif
+ NULL
+};
+#endif
+
+#if defined (ICONV_TO_UCS_CES_TABLE) \
+ || defined (ICONV_FROM_UCS_CES_TABLE)
+static _CONST char *
+iconv_ces_names_table[] =
+{
+# if defined (_ICONV_FROM_ENCODING_CP775) \
+ || defined (_ICONV_TO_ENCODING_CP775)
+ ICONV_ENCODING_CP775,
+#endif
+# if defined (_ICONV_FROM_ENCODING_CP850) \
+ || defined (_ICONV_TO_ENCODING_CP850)
+ ICONV_ENCODING_CP850,
+#endif
+# if defined (_ICONV_FROM_ENCODING_CP852) \
+ || defined (_ICONV_TO_ENCODING_CP852)
+ ICONV_ENCODING_CP852,
+#endif
+# if defined (_ICONV_FROM_ENCODING_CP855) \
+ || defined (_ICONV_TO_ENCODING_CP855)
+ ICONV_ENCODING_CP855,
+#endif
+# if defined (_ICONV_FROM_ENCODING_CP866) \
+ || defined (_ICONV_TO_ENCODING_CP866)
+ ICONV_ENCODING_CP866,
+#endif
+# if defined (_ICONV_FROM_ENCODING_ISO_8859_1) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_1)
+ ICONV_ENCODING_ISO_8859_1,
+#endif
+# if defined (_ICONV_FROM_ENCODING_ISO_8859_10) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_10)
+ ICONV_ENCODING_ISO_8859_10,
+#endif
+# if defined (_ICONV_FROM_ENCODING_ISO_8859_11) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_11)
+ ICONV_ENCODING_ISO_8859_11,
+#endif
+# if defined (_ICONV_FROM_ENCODING_ISO_8859_13) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_13)
+ ICONV_ENCODING_ISO_8859_13,
+#endif
+# if defined (_ICONV_FROM_ENCODING_ISO_8859_14) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_14)
+ ICONV_ENCODING_ISO_8859_14,
+#endif
+# if defined (_ICONV_FROM_ENCODING_ISO_8859_15) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_15)
+ ICONV_ENCODING_ISO_8859_15,
+#endif
+# if defined (_ICONV_FROM_ENCODING_ISO_8859_2) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_2)
+ ICONV_ENCODING_ISO_8859_2,
+#endif
+# if defined (_ICONV_FROM_ENCODING_ISO_8859_3) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_3)
+ ICONV_ENCODING_ISO_8859_3,
+#endif
+# if defined (_ICONV_FROM_ENCODING_ISO_8859_4) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_4)
+ ICONV_ENCODING_ISO_8859_4,
+#endif
+# if defined (_ICONV_FROM_ENCODING_ISO_8859_5) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_5)
+ ICONV_ENCODING_ISO_8859_5,
+#endif
+# if defined (_ICONV_FROM_ENCODING_ISO_8859_6) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_6)
+ ICONV_ENCODING_ISO_8859_6,
+#endif
+# if defined (_ICONV_FROM_ENCODING_ISO_8859_7) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_7)
+ ICONV_ENCODING_ISO_8859_7,
+#endif
+# if defined (_ICONV_FROM_ENCODING_ISO_8859_8) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_8)
+ ICONV_ENCODING_ISO_8859_8,
+#endif
+# if defined (_ICONV_FROM_ENCODING_ISO_8859_9) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_9)
+ ICONV_ENCODING_ISO_8859_9,
+#endif
+# if defined (_ICONV_FROM_ENCODING_ISO_IR_111) \
+ || defined (_ICONV_TO_ENCODING_ISO_IR_111)
+ ICONV_ENCODING_ISO_IR_111,
+#endif
+# if defined (_ICONV_FROM_ENCODING_KOI8_R) \
+ || defined (_ICONV_TO_ENCODING_KOI8_R)
+ ICONV_ENCODING_KOI8_R,
+#endif
+# if defined (_ICONV_FROM_ENCODING_KOI8_RU) \
+ || defined (_ICONV_TO_ENCODING_KOI8_RU)
+ ICONV_ENCODING_KOI8_RU,
+#endif
+# if defined (_ICONV_FROM_ENCODING_KOI8_U) \
+ || defined (_ICONV_TO_ENCODING_KOI8_U)
+ ICONV_ENCODING_KOI8_U,
+#endif
+# if defined (_ICONV_FROM_ENCODING_KOI8_UNI) \
+ || defined (_ICONV_TO_ENCODING_KOI8_UNI)
+ ICONV_ENCODING_KOI8_UNI,
+#endif
+# if defined (_ICONV_FROM_ENCODING_WIN_1250) \
+ || defined (_ICONV_TO_ENCODING_WIN_1250)
+ ICONV_ENCODING_WIN_1250,
+#endif
+# if defined (_ICONV_FROM_ENCODING_WIN_1251) \
+ || defined (_ICONV_TO_ENCODING_WIN_1251)
+ ICONV_ENCODING_WIN_1251,
+#endif
+# if defined (_ICONV_FROM_ENCODING_WIN_1252) \
+ || defined (_ICONV_TO_ENCODING_WIN_1252)
+ ICONV_ENCODING_WIN_1252,
+#endif
+# if defined (_ICONV_FROM_ENCODING_WIN_1253) \
+ || defined (_ICONV_TO_ENCODING_WIN_1253)
+ ICONV_ENCODING_WIN_1253,
+#endif
+# if defined (_ICONV_FROM_ENCODING_WIN_1254) \
+ || defined (_ICONV_TO_ENCODING_WIN_1254)
+ ICONV_ENCODING_WIN_1254,
+#endif
+# if defined (_ICONV_FROM_ENCODING_WIN_1255) \
+ || defined (_ICONV_TO_ENCODING_WIN_1255)
+ ICONV_ENCODING_WIN_1255,
+#endif
+# if defined (_ICONV_FROM_ENCODING_WIN_1256) \
+ || defined (_ICONV_TO_ENCODING_WIN_1256)
+ ICONV_ENCODING_WIN_1256,
+#endif
+# if defined (_ICONV_FROM_ENCODING_WIN_1257) \
+ || defined (_ICONV_TO_ENCODING_WIN_1257)
+ ICONV_ENCODING_WIN_1257,
+#endif
+# if defined (_ICONV_FROM_ENCODING_WIN_1258) \
+ || defined (_ICONV_TO_ENCODING_WIN_1258)
+ ICONV_ENCODING_WIN_1258,
+#endif
+ NULL
+};
+#endif
+
+#if defined (ICONV_TO_UCS_CES_TABLE_PCS) \
+ || defined (ICONV_FROM_UCS_CES_TABLE_PCS)
+static _CONST char *
+iconv_ces_names_table_pcs[] =
+{
+# if defined (_ICONV_FROM_ENCODING_BIG5) \
+ || defined (_ICONV_TO_ENCODING_BIG5)
+ ICONV_ENCODING_BIG5,
+#endif
+ NULL
+};
+#endif
+
+#if defined (ICONV_TO_UCS_CES_UCS_2) \
+ || defined (ICONV_FROM_UCS_CES_UCS_2)
+static _CONST char *
+iconv_ces_names_ucs_2[] =
+{
+# if defined (_ICONV_FROM_ENCODING_UCS_2) \
+ || defined (_ICONV_TO_ENCODING_UCS_2)
+ ICONV_ENCODING_UCS_2,
+#endif
+# if defined (_ICONV_FROM_ENCODING_UCS_2BE) \
+ || defined (_ICONV_TO_ENCODING_UCS_2BE)
+ ICONV_ENCODING_UCS_2BE,
+#endif
+# if defined (_ICONV_FROM_ENCODING_UCS_2LE) \
+ || defined (_ICONV_TO_ENCODING_UCS_2LE)
+ ICONV_ENCODING_UCS_2LE,
+#endif
+ NULL
+};
+#endif
+
+#if defined (ICONV_TO_UCS_CES_UCS_2_INTERNAL) \
+ || defined (ICONV_FROM_UCS_CES_UCS_2_INTERNAL)
+static _CONST char *
+iconv_ces_names_ucs_2_internal[] =
+{
+# if defined (_ICONV_FROM_ENCODING_UCS_2_INTERNAL) \
+ || defined (_ICONV_TO_ENCODING_UCS_2_INTERNAL)
+ ICONV_ENCODING_UCS_2_INTERNAL,
+#endif
+ NULL
+};
+#endif
+
+#if defined (ICONV_TO_UCS_CES_UCS_4) \
+ || defined (ICONV_FROM_UCS_CES_UCS_4)
+static _CONST char *
+iconv_ces_names_ucs_4[] =
+{
+# if defined (_ICONV_FROM_ENCODING_UCS_4) \
+ || defined (_ICONV_TO_ENCODING_UCS_4)
+ ICONV_ENCODING_UCS_4,
+#endif
+# if defined (_ICONV_FROM_ENCODING_UCS_4BE) \
+ || defined (_ICONV_TO_ENCODING_UCS_4BE)
+ ICONV_ENCODING_UCS_4BE,
+#endif
+# if defined (_ICONV_FROM_ENCODING_UCS_4LE) \
+ || defined (_ICONV_TO_ENCODING_UCS_4LE)
+ ICONV_ENCODING_UCS_4LE,
+#endif
+ NULL
+};
+#endif
+
+#if defined (ICONV_TO_UCS_CES_UCS_4_INTERNAL) \
+ || defined (ICONV_FROM_UCS_CES_UCS_4_INTERNAL)
+static _CONST char *
+iconv_ces_names_ucs_4_internal[] =
+{
+# if defined (_ICONV_FROM_ENCODING_UCS_4_INTERNAL) \
+ || defined (_ICONV_TO_ENCODING_UCS_4_INTERNAL)
+ ICONV_ENCODING_UCS_4_INTERNAL,
+#endif
+ NULL
+};
+#endif
+
+#if defined (ICONV_TO_UCS_CES_US_ASCII) \
+ || defined (ICONV_FROM_UCS_CES_US_ASCII)
+static _CONST char *
+iconv_ces_names_us_ascii[] =
+{
+# if defined (_ICONV_FROM_ENCODING_US_ASCII) \
+ || defined (_ICONV_TO_ENCODING_US_ASCII)
+ ICONV_ENCODING_US_ASCII,
+#endif
+ NULL
+};
+#endif
+
+#if defined (ICONV_TO_UCS_CES_UTF_16) \
+ || defined (ICONV_FROM_UCS_CES_UTF_16)
+static _CONST char *
+iconv_ces_names_utf_16[] =
+{
+# if defined (_ICONV_FROM_ENCODING_UTF_16) \
+ || defined (_ICONV_TO_ENCODING_UTF_16)
+ ICONV_ENCODING_UTF_16,
+#endif
+# if defined (_ICONV_FROM_ENCODING_UTF_16BE) \
+ || defined (_ICONV_TO_ENCODING_UTF_16BE)
+ ICONV_ENCODING_UTF_16BE,
+#endif
+# if defined (_ICONV_FROM_ENCODING_UTF_16LE) \
+ || defined (_ICONV_TO_ENCODING_UTF_16LE)
+ ICONV_ENCODING_UTF_16LE,
+#endif
+ NULL
+};
+#endif
+
+#if defined (ICONV_TO_UCS_CES_UTF_8) \
+ || defined (ICONV_FROM_UCS_CES_UTF_8)
+static _CONST char *
+iconv_ces_names_utf_8[] =
+{
+# if defined (_ICONV_FROM_ENCODING_UTF_8) \
+ || defined (_ICONV_TO_ENCODING_UTF_8)
+ ICONV_ENCODING_UTF_8,
+#endif
+ NULL
+};
+#endif
+
+/*
+ * The following structure contains the list of "to UCS" linked-in CES converters.
+ */
+_CONST iconv_to_ucs_ces_t
+_iconv_to_ucs_ces[] =
+{
+#ifdef ICONV_TO_UCS_CES_EUC
+ {(_CONST char **)iconv_ces_names_euc,
+ &_iconv_to_ucs_ces_handlers_euc},
+#endif
+#ifdef ICONV_TO_UCS_CES_TABLE
+ {(_CONST char **)iconv_ces_names_table,
+ &_iconv_to_ucs_ces_handlers_table},
+#endif
+#ifdef ICONV_TO_UCS_CES_TABLE_PCS
+ {(_CONST char **)iconv_ces_names_table_pcs,
+ &_iconv_to_ucs_ces_handlers_table_pcs},
+#endif
+#ifdef ICONV_TO_UCS_CES_UCS_2
+ {(_CONST char **)iconv_ces_names_ucs_2,
+ &_iconv_to_ucs_ces_handlers_ucs_2},
+#endif
+#ifdef ICONV_TO_UCS_CES_UCS_2_INTERNAL
+ {(_CONST char **)iconv_ces_names_ucs_2_internal,
+ &_iconv_to_ucs_ces_handlers_ucs_2_internal},
+#endif
+#ifdef ICONV_TO_UCS_CES_UCS_4
+ {(_CONST char **)iconv_ces_names_ucs_4,
+ &_iconv_to_ucs_ces_handlers_ucs_4},
+#endif
+#ifdef ICONV_TO_UCS_CES_UCS_4_INTERNAL
+ {(_CONST char **)iconv_ces_names_ucs_4_internal,
+ &_iconv_to_ucs_ces_handlers_ucs_4_internal},
+#endif
+#ifdef ICONV_TO_UCS_CES_US_ASCII
+ {(_CONST char **)iconv_ces_names_us_ascii,
+ &_iconv_to_ucs_ces_handlers_us_ascii},
+#endif
+#ifdef ICONV_TO_UCS_CES_UTF_16
+ {(_CONST char **)iconv_ces_names_utf_16,
+ &_iconv_to_ucs_ces_handlers_utf_16},
+#endif
+#ifdef ICONV_TO_UCS_CES_UTF_8
+ {(_CONST char **)iconv_ces_names_utf_8,
+ &_iconv_to_ucs_ces_handlers_utf_8},
+#endif
+ {(_CONST char **)NULL,
+ (iconv_to_ucs_ces_handlers_t *)NULL}
+};
+
+/*
+ * The following structure contains the list of "from UCS" linked-in CES converters.
+ */
+_CONST iconv_from_ucs_ces_t
+_iconv_from_ucs_ces[] =
+{
+#ifdef ICONV_FROM_UCS_CES_EUC
+ {(_CONST char **)iconv_ces_names_euc,
+ &_iconv_from_ucs_ces_handlers_euc},
+#endif
+#ifdef ICONV_FROM_UCS_CES_TABLE
+ {(_CONST char **)iconv_ces_names_table,
+ &_iconv_from_ucs_ces_handlers_table},
+#endif
+#ifdef ICONV_FROM_UCS_CES_TABLE_PCS
+ {(_CONST char **)iconv_ces_names_table_pcs,
+ &_iconv_from_ucs_ces_handlers_table_pcs},
+#endif
+#ifdef ICONV_FROM_UCS_CES_UCS_2
+ {(_CONST char **)iconv_ces_names_ucs_2,
+ &_iconv_from_ucs_ces_handlers_ucs_2},
+#endif
+#ifdef ICONV_FROM_UCS_CES_UCS_2_INTERNAL
+ {(_CONST char **)iconv_ces_names_ucs_2_internal,
+ &_iconv_from_ucs_ces_handlers_ucs_2_internal},
+#endif
+#ifdef ICONV_FROM_UCS_CES_UCS_4
+ {(_CONST char **)iconv_ces_names_ucs_4,
+ &_iconv_from_ucs_ces_handlers_ucs_4},
+#endif
+#ifdef ICONV_FROM_UCS_CES_UCS_4_INTERNAL
+ {(_CONST char **)iconv_ces_names_ucs_4_internal,
+ &_iconv_from_ucs_ces_handlers_ucs_4_internal},
+#endif
+#ifdef ICONV_FROM_UCS_CES_US_ASCII
+ {(_CONST char **)iconv_ces_names_us_ascii,
+ &_iconv_from_ucs_ces_handlers_us_ascii},
+#endif
+#ifdef ICONV_FROM_UCS_CES_UTF_16
+ {(_CONST char **)iconv_ces_names_utf_16,
+ &_iconv_from_ucs_ces_handlers_utf_16},
+#endif
+#ifdef ICONV_FROM_UCS_CES_UTF_8
+ {(_CONST char **)iconv_ces_names_utf_8,
+ &_iconv_from_ucs_ces_handlers_utf_8},
+#endif
+ {(_CONST char **)NULL,
+ (iconv_from_ucs_ces_handlers_t *)NULL}
+};
cesbi.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: table.c
===================================================================
--- table.c (nonexistent)
+++ table.c (revision 520)
@@ -0,0 +1,594 @@
+/*
+ * Copyright (c) 2003-2004, Artem B. Bityuckiy
+ * Copyright (c) 1999,2000, Konstantin Chuguev. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include "cesbi.h"
+
+#if defined (ICONV_TO_UCS_CES_TABLE) \
+ || defined (ICONV_FROM_UCS_CES_TABLE)
+
+#include <_ansi.h>
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "../lib/endian.h"
+#include "../lib/local.h"
+#include "../lib/ucsconv.h"
+#include "../ccs/ccs.h"
+
+/*
+ * Table-based CES converter is implemented here. Table-based CES converter
+ * deals with encodings with "null" CES, like KOI8-R. In this case it is
+ * possible to implement one generic algorithm which works with different
+ * CCS tables.
+ *
+ * Table-based CES converter deals with CCS tables placed into iconv/ccs
+ * subdirectory. First, converter tries to find needed CCS table among
+ * linked-in tables. If not found, it tries to load it from external file
+ * (only if corespondent capability was enabled in Newlib configuration).
+ *
+ * 16 bit encodings are assumed to be Big Endian.
+ */
+
+static ucs2_t
+_EXFUN(find_code_size, (ucs2_t code, _CONST __uint16_t *tblp));
+
+static __inline ucs2_t
+_EXFUN(find_code_speed, (ucs2_t code, _CONST __uint16_t *tblp));
+
+static __inline ucs2_t
+_EXFUN(find_code_speed_8bit, (ucs2_t code, _CONST unsigned char *tblp));
+
+#ifdef _ICONV_ENABLE_EXTERNAL_CCS
+static _CONST iconv_ccs_desc_t *
+_EXFUN(load_file, (struct _reent *rptr, _CONST char *name, int direction));
+#endif
+
+/*
+ * Interface data and functions implementation.
+ */
+static size_t
+_DEFUN(table_close, (rptr, data),
+ struct _reent *rptr _AND
+ _VOID_PTR data)
+{
+ _CONST iconv_ccs_desc_t *ccsp = (iconv_ccs_desc_t *)data;
+
+ if (ccsp->type == TABLE_EXTERNAL)
+ _free_r (rptr, (_VOID_PTR)ccsp->tbl);
+
+ _free_r( rptr, (_VOID_PTR)ccsp);
+ return 0;
+}
+
+#if defined (ICONV_FROM_UCS_CES_TABLE)
+static _VOID_PTR
+_DEFUN(table_init_from_ucs, (rptr, encoding),
+ struct _reent *rptr _AND
+ _CONST char *encoding)
+{
+ int i;
+ _CONST iconv_ccs_t *biccsp = NULL;
+ iconv_ccs_desc_t *ccsp;
+
+ for (i = 0; _iconv_ccs[i] != NULL; i++)
+ if (strcmp (_iconv_ccs[i]->name, encoding) == 0)
+ {
+ biccsp = _iconv_ccs[i];
+ break;
+ }
+
+ if (biccsp != NULL)
+ {
+ if (biccsp->from_ucs == NULL
+ || (ccsp = (iconv_ccs_desc_t *)
+ _malloc_r (rptr, sizeof (iconv_ccs_desc_t))) == NULL)
+ return NULL;
+
+ ccsp->type = TABLE_BUILTIN;
+ ccsp->bits = biccsp->bits;
+ ccsp->optimization = biccsp->from_ucs_type;
+ ccsp->tbl = biccsp->from_ucs;
+
+ return (_VOID_PTR)ccsp;
+ }
+
+#ifdef _ICONV_ENABLE_EXTERNAL_CCS
+ return (_VOID_PTR)load_file (rptr, encoding, 1);
+#else
+ return NULL;
+#endif
+}
+
+static size_t
+_DEFUN(table_convert_from_ucs, (data, in, outbuf, outbytesleft),
+ _VOID_PTR data _AND
+ ucs4_t in _AND
+ unsigned char **outbuf _AND
+ size_t *outbytesleft)
+{
+ _CONST iconv_ccs_desc_t *ccsp = (iconv_ccs_desc_t *)data;
+ ucs2_t code;
+
+ if (in > 0xFFFF || in == INVALC)
+ return (size_t)ICONV_CES_INVALID_CHARACTER;
+
+ if (ccsp->bits == TABLE_8BIT)
+ {
+ code = find_code_speed_8bit ((ucs2_t)in,
+ (_CONST unsigned char *)ccsp->tbl);
+ if (code == INVALC)
+ return (size_t)ICONV_CES_INVALID_CHARACTER;
+ **outbuf = (unsigned char)code;
+ *outbuf += 1;
+ *outbytesleft -= 1;
+ return 1;
+ }
+ else if (ccsp->optimization == TABLE_SPEED_OPTIMIZED)
+ code = find_code_speed ((ucs2_t)in, ccsp->tbl);
+ else
+ code = find_code_size ((ucs2_t)in, ccsp->tbl);
+
+ if (code == INVALC)
+ return (size_t)ICONV_CES_INVALID_CHARACTER;
+
+ if (*outbytesleft < 2)
+ return (size_t)ICONV_CES_NOSPACE;
+
+ /* We can't store whole word since **outbuf may be not 2-byte aligned */
+ **outbuf = (unsigned char)((ucs2_t)code >> 8);
+ *(*outbuf + 1) = (unsigned char)code;
+ *outbuf += 2;
+ *outbytesleft -= 2;
+ return 2;
+}
+#endif /* ICONV_FROM_UCS_CES_TABLE */
+
+#if defined (ICONV_TO_UCS_CES_TABLE)
+static _VOID_PTR
+_DEFUN(table_init_to_ucs, (rptr, encoding),
+ struct _reent *rptr _AND
+ _CONST char *encoding)
+{
+ int i;
+ _CONST iconv_ccs_t *biccsp = NULL;
+ iconv_ccs_desc_t *ccsp;
+
+ for (i = 0; _iconv_ccs[i] != NULL; i++)
+ if (strcmp (_iconv_ccs[i]->name, encoding) == 0)
+ {
+ biccsp = _iconv_ccs[i];
+ break;
+ }
+
+ if (biccsp != NULL)
+ {
+ if (biccsp->to_ucs == NULL
+ || (ccsp = (iconv_ccs_desc_t *)
+ _malloc_r (rptr, sizeof (iconv_ccs_desc_t))) == NULL)
+ return NULL;
+
+ ccsp->type = TABLE_BUILTIN;
+ ccsp->bits = biccsp->bits;
+ ccsp->optimization = biccsp->to_ucs_type;
+ ccsp->tbl = biccsp->to_ucs;
+
+ return (_VOID_PTR)ccsp;
+ }
+
+#ifdef _ICONV_ENABLE_EXTERNAL_CCS
+ return (_VOID_PTR)load_file (rptr, encoding, 0);
+#else
+ return NULL;
+#endif
+}
+
+static ucs4_t
+_DEFUN(table_convert_to_ucs, (data, inbuf, inbytesleft),
+ _VOID_PTR data _AND
+ _CONST unsigned char **inbuf _AND
+ size_t *inbytesleft)
+{
+ _CONST iconv_ccs_desc_t *ccsp = (iconv_ccs_desc_t *)data;
+ ucs2_t ucs;
+
+ if (ccsp->bits == TABLE_8BIT)
+ {
+ if (*inbytesleft < 1)
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ ucs = (ucs2_t)ccsp->tbl[**inbuf];
+
+ if (ucs == INVALC)
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ *inbytesleft -= 1;
+ *inbuf += 1;
+ return (ucs4_t)ucs;
+ }
+
+ if (*inbytesleft < 2)
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ if (ccsp->optimization == TABLE_SIZE_OPTIMIZED)
+ ucs = find_code_size((ucs2_t)**inbuf << 8 | (ucs2_t)*(*inbuf + 1),
+ ccsp->tbl);
+ else
+ ucs = find_code_speed((ucs2_t)**inbuf << 8 | (ucs2_t)*(*inbuf + 1),
+ ccsp->tbl);
+
+ if (ucs == INVALC)
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ *inbuf += 2;
+ *inbytesleft -= 2;
+ return (ucs4_t)ucs;
+}
+#endif /* ICONV_TO_UCS_CES_TABLE */
+
+static int
+_DEFUN(table_get_mb_cur_max, (data),
+ _VOID_PTR data)
+{
+ return ((iconv_ccs_desc_t *)data)->bits/8;
+}
+
+
+#if defined (ICONV_TO_UCS_CES_TABLE)
+_CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_table =
+{
+ table_init_to_ucs,
+ table_close,
+ table_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ table_convert_to_ucs
+};
+#endif /* ICONV_FROM_UCS_CES_TABLE */
+
+#if defined (ICONV_FROM_UCS_CES_TABLE)
+_CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_table =
+{
+ table_init_from_ucs,
+ table_close,
+ table_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ table_convert_from_ucs
+};
+#endif /* ICONV_TO_UCS_CES_TABLE */
+
+/*
+ * Supplementary functions.
+ */
+
+/*
+ * find_code_speed - find code in 16 bit speed-optimized table.
+ *
+ * PARAMETERS:
+ * ucs2_t code - code whose mapping to find.
+ * _CONST __uint16_t *tblp - table pointer.
+ *
+ * RETURN:
+ * Code that corresponds to 'code'.
+ */
+static __inline ucs2_t
+_DEFUN(find_code_speed, (code, tblp),
+ ucs2_t code _AND
+ _CONST __uint16_t *tblp)
+{
+ int idx = tblp[code >> 8];
+
+ if (idx == INVBLK)
+ return (ucs2_t)INVALC;
+
+ return (ucs2_t)tblp[(code & 0x00FF) + idx];
+}
+
+/*
+ * find_code_speed_8bit - find code in 8 bit speed-optimized table.
+ *
+ * PARAMETERS:
+ * ucs2_t code - code whose mapping to find.
+ * _CONST __uint16_t *tblp - table pointer.
+ *
+ * RETURN:
+ * Code that corresponds to 'code'.
+ */
+static __inline ucs2_t
+_DEFUN(find_code_speed_8bit, (code, tblp),
+ ucs2_t code _AND
+ _CONST unsigned char *tblp)
+{
+ int idx;
+ unsigned char ccs;
+
+ if (code == ((ucs2_t *)tblp)[0])
+ return (ucs2_t)0xFF;
+
+ idx = ((ucs2_t *)tblp)[1 + (code >> 8)];
+
+ if (idx == INVBLK)
+ return (ucs2_t)INVALC;
+
+ ccs = tblp[(code & 0x00FF) + idx];
+
+ return ccs == 0xFF ? (ucs2_t)INVALC : (ucs2_t)ccs;
+}
+
+/* Left range boundary */
+#define RANGE_LEFT(n) (tblp[FIRST_RANGE_INDEX + (n)*3 + 0])
+/* Right range boundary */
+#define RANGE_RIGHT(n) (tblp[FIRST_RANGE_INDEX + (n)*3 + 1])
+/* Range offset */
+#define RANGE_INDEX(n) (tblp[FIRST_RANGE_INDEX + (n)*3 + 2])
+/* Un-ranged offset */
+#define UNRANGED_INDEX(n) (tblp[FIRST_UNRANGED_INDEX_INDEX] + (n)*2)
+
+/*
+ * find_code_size - find code in 16 bit size-optimized table.
+ *
+ * PARAMETERS:
+ * ucs2_t code - code whose mapping to find.
+ * _CONST __uint16_t *tblp - table pointer.
+ *
+ * RETURN:
+ * Code that corresponds to 'code'.
+ */
+static ucs2_t
+_DEFUN(find_code_size, (code, tblp),
+ ucs2_t code _AND
+ _CONST __uint16_t *tblp)
+{
+ int first, last, cur, center;
+
+ if (tblp[RANGES_NUM_INDEX] > 0)
+ {
+ first = 0;
+ last = tblp[RANGES_NUM_INDEX] - 1;
+
+ do
+ {
+ center = (last - first)/2;
+ cur = center + first;
+
+ if (code > RANGE_RIGHT (cur))
+ first = cur;
+ else if (code < RANGE_LEFT (cur))
+ last = cur;
+ else
+ return (ucs2_t)tblp[RANGE_INDEX (cur) + code - RANGE_LEFT (cur)];
+ } while (center > 0);
+
+ if (last - first == 1)
+ {
+ if (code >= RANGE_LEFT (first) && code <= RANGE_RIGHT (first))
+ return (ucs2_t)tblp[RANGE_INDEX (first)
+ + code - RANGE_LEFT (first)];
+ if (code >= RANGE_LEFT (last) && code <= RANGE_RIGHT (last))
+ return (ucs2_t)tblp[RANGE_INDEX (last)
+ + code - RANGE_LEFT (last)];
+ }
+ }
+
+ if (tblp[UNRANGED_NUM_INDEX] > 0)
+ {
+ first = 0;
+ last = tblp[UNRANGED_NUM_INDEX] - 1;
+
+ do
+ {
+ int c;
+
+ center = (last - first)/2;
+ cur = center + first;
+ c = tblp[UNRANGED_INDEX (cur)];
+
+ if (code > c)
+ first = cur;
+ else if (code < c)
+ last = cur;
+ else
+ return (ucs2_t)tblp[UNRANGED_INDEX (cur) + 1];
+ } while (center > 0);
+
+ if (last - first == 1)
+ {
+ if (code == tblp[UNRANGED_INDEX (first)])
+ return (ucs2_t)tblp[UNRANGED_INDEX (first) + 1];
+ if (code == tblp[UNRANGED_INDEX (last)])
+ return (ucs2_t)tblp[UNRANGED_INDEX (last) + 1];
+ }
+ }
+
+ return (ucs2_t)INVALC;
+}
+
+#ifdef _ICONV_ENABLE_EXTERNAL_CCS
+
+#define _16BIT_ELT(offset) \
+ ICONV_BETOHS(*((__uint16_t *)(buf + (offset))))
+#define _32BIT_ELT(offset) \
+ ICONV_BETOHL(*((__uint32_t *)(buf + (offset))))
+
+/*
+ * load_file - load conversion table from external file and initialize
+ * iconv_ccs_desc_t object.
+ *
+ * PARAMETERS:
+ * struct _reent *rptr - reent structure of current thread/process.
+ * _CONST char *name - encoding name.
+ * int direction - conversion direction.
+ *
+ * DESCRIPTION:
+ * Loads conversion table of appropriate endianess from external file
+ * and initializes 'iconv_ccs_desc_t' table description structure.
+ * If 'direction' is 0 - load "To UCS" table, else load "From UCS"
+ * table.
+ *
+ * RETURN:
+ * iconv_ccs_desc_t * pointer is success, NULL if failure.
+ */
+static _CONST iconv_ccs_desc_t *
+_DEFUN(load_file, (rptr, name, direction),
+ struct _reent *rptr _AND
+ _CONST char *name _AND
+ int direction)
+{
+ int fd;
+ _CONST unsigned char *buf;
+ int tbllen, hdrlen;
+ off_t off;
+ _CONST char *fname;
+ iconv_ccs_desc_t *ccsp = NULL;
+ int nmlen = strlen(name);
+ /* Since CCS table name length can vary - it is aligned (by adding extra
+ * bytes to it's end) to 4-byte boundary. */
+ int alignment = nmlen & 3 ? 4 - (nmlen & 3) : 0;
+
+ nmlen = strlen(name);
+
+ hdrlen = nmlen + EXTTABLE_HEADER_LEN + alignment;
+
+ if ((fname = _iconv_nls_construct_filename (rptr, name, ICONV_SUBDIR,
+ ICONV_DATA_EXT)) == NULL)
+ return NULL;
+
+ if ((fd = _open_r (rptr, fname, O_RDONLY, S_IRUSR)) == -1)
+ goto error1;
+
+ if ((buf = (_CONST unsigned char *)_malloc_r (rptr, hdrlen)) == NULL)
+ goto error2;
+
+ if (_read_r (rptr, fd, (_VOID_PTR)buf, hdrlen) != hdrlen)
+ goto error3;
+
+ if (_16BIT_ELT (EXTTABLE_VERSION_OFF) != TABLE_VERSION_1
+ || _32BIT_ELT (EXTTABLE_CCSNAME_LEN_OFF) != nmlen
+ || strncmp (buf + EXTTABLE_CCSNAME_OFF, name, nmlen) != 0)
+ goto error3; /* Bad file */
+
+ if ((ccsp = (iconv_ccs_desc_t *)
+ _calloc_r (rptr, 1, sizeof (iconv_ccs_desc_t))) == NULL)
+ goto error3;
+
+ ccsp->bits = _16BIT_ELT (EXTTABLE_BITS_OFF);
+ ccsp->type = TABLE_EXTERNAL;
+
+ /* Add 4-byte alignment to name length */
+ nmlen += alignment;
+
+ if (ccsp->bits == TABLE_8BIT)
+ {
+ if (direction == 0) /* Load "To UCS" table */
+ {
+ off = (off_t)_32BIT_ELT (nmlen + EXTTABLE_TO_SPEED_OFF);
+ tbllen = _32BIT_ELT (nmlen + EXTTABLE_TO_SPEED_LEN_OFF);
+ }
+ else /* Load "From UCS" table */
+ {
+ off = (off_t)_32BIT_ELT (nmlen + EXTTABLE_FROM_SPEED_OFF);
+ tbllen = _32BIT_ELT (nmlen + EXTTABLE_FROM_SPEED_LEN_OFF);
+ }
+ }
+ else if (ccsp->bits == TABLE_16BIT)
+ {
+ if (direction == 0) /* Load "To UCS" table */
+ {
+#ifdef TABLE_USE_SIZE_OPTIMIZATION
+ off = (off_t)_32BIT_ELT (nmlen + EXTTABLE_TO_SIZE_OFF);
+ tbllen = _32BIT_ELT (nmlen + EXTTABLE_TO_SIZE_LEN_OFF);
+#else
+ off = (off_t)_32BIT_ELT (nmlen + EXTTABLE_TO_SPEED_OFF);
+ tbllen = _32BIT_ELT (nmlen + EXTTABLE_TO_SPEED_LEN_OFF);
+#endif
+ }
+ else /* Load "From UCS" table */
+ {
+#ifdef TABLE_USE_SIZE_OPTIMIZATION
+ off = (off_t)_32BIT_ELT (nmlen + EXTTABLE_FROM_SIZE_OFF);
+ tbllen = _32BIT_ELT (nmlen + EXTTABLE_FROM_SIZE_LEN_OFF);
+#else
+ off = (off_t)_32BIT_ELT (nmlen + EXTTABLE_FROM_SPEED_OFF);
+ tbllen = _32BIT_ELT (nmlen + EXTTABLE_FROM_SPEED_LEN_OFF);
+#endif
+ }
+#ifdef TABLE_USE_SIZE_OPTIMIZATION
+ ccsp->optimization = TABLE_SIZE_OPTIMIZED;
+#else
+ ccsp->optimization = TABLE_SPEED_OPTIMIZED;
+#endif
+ }
+ else
+ goto error4; /* Bad file */
+
+ if (off == EXTTABLE_NO_TABLE)
+ goto error4; /* No correspondent table in file */
+
+ if ((ccsp->tbl = (ucs2_t *)_malloc_r (rptr, tbllen)) == NULL)
+ goto error4;
+
+ if (_lseek_r (rptr, fd, off, SEEK_SET) == (off_t)-1
+ || _read_r (rptr, fd, (_VOID_PTR)ccsp->tbl, tbllen) != tbllen)
+ goto error5;
+
+ goto normal_exit;
+
+error5:
+ _free_r (rptr, (_VOID_PTR)ccsp->tbl);
+ ccsp->tbl = NULL;
+error4:
+ _free_r (rptr, (_VOID_PTR)ccsp);
+ ccsp = NULL;
+error3:
+normal_exit:
+ _free_r (rptr, (_VOID_PTR)buf);
+error2:
+ if (_close_r (rptr, fd) == -1)
+ {
+ if (ccsp != NULL)
+ {
+ if (ccsp->tbl != NULL)
+ _free_r (rptr, (_VOID_PTR)ccsp->tbl);
+ _free_r (rptr, (_VOID_PTR)ccsp);
+ }
+ ccsp = NULL;
+ }
+error1:
+ _free_r (rptr, (_VOID_PTR)fname);
+ return ccsp;
+}
+#endif
+
+#endif /* ICONV_TO_UCS_CES_TABLE || ICONV_FROM_UCS_CES_TABLE */
+
table.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: Makefile.am
===================================================================
--- Makefile.am (nonexistent)
+++ Makefile.am (revision 520)
@@ -0,0 +1,61 @@
+## Process this file with automake to generate Makefile.in
+
+AUTOMAKE_OPTIONS = cygnus
+
+INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+
+GENERAL_SOURCES = \
+ utf-8.c \
+ utf-16.c \
+ ucs-2.c \
+ us-ascii.c \
+ ucs-4.c \
+ ucs-2-internal.c \
+ ucs-4-internal.c \
+ cesbi.c \
+ table.c \
+ table-pcs.c \
+ euc.c
+
+## The following interfaces are EL/IX level 2
+if ELIX_LEVEL_1
+ELIX_SOURCES = \
+ utf-8.c \
+ utf-16.c \
+ ucs-2.c \
+ us-ascii.c \
+ ucs-4.c \
+ ucs-2-internal.c \
+ ucs-4-internal.c \
+ cesbi.c \
+ table.c \
+ table-pcs.c \
+ euc.c
+else
+ELIX_SOURCES =
+endif
+
+noinst_LIBRARIES = lib.a
+lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
+lib_a_CFLAGS = $(AM_CFLAGS)
+noinst_DATA =
+
+include $(srcdir)/../../../Makefile.shared
+
+CHEWOUT_FILES = ces.def
+
+SUFFIXES = .def
+
+CHEW = ../../../doc/makedoc -f $(srcdir)/../../../doc/doc.str
+
+.c.def:
+ $(CHEW) < $< > $*.def 2> $*.ref
+ touch stmp-def
+
+TARGETDOC = ../tmp.texi
+
+doc: $(CHEWOUT_FILES)
+ cat $(srcdir)/ces.tex >> $(TARGETDOC)
+
+CLEANFILES = $(CHEWOUT_FILES) *.ref
+
Makefile.am
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: ucs-2.c
===================================================================
--- ucs-2.c (nonexistent)
+++ ucs-2.c (revision 520)
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2003-2004, Artem B. Bityuckiy
+ * Copyright (c) 1999,2000, Konstantin Chuguev. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include "cesbi.h"
+
+#if defined (ICONV_TO_UCS_CES_UCS_2) \
+ || defined (ICONV_FROM_UCS_CES_UCS_2)
+
+#include <_ansi.h>
+#include
+#include
+#include
+#include
+#include "../lib/local.h"
+#include "../lib/ucsconv.h"
+#include "../lib/endian.h"
+
+/*
+ * BOM isn't supported. UCS-2 is Big Endian. Bad codes are rejected.
+ * Bad codes: 0xFFFF, 0xFFFE, 0xD800-0xDFFF.
+ */
+
+#define UCS_2_BIG_ENDIAN 0
+#define UCS_2_LITTLE_ENDIAN 1
+
+#define UCS_2 "ucs_2"
+#define UCS_2BE "ucs_2be"
+#define UCS_2LE "ucs_2le"
+
+static _VOID_PTR
+_DEFUN(ucs_2_init, (rptr, encoding),
+ struct _reent *rptr _AND
+ _CONST char *encoding)
+{
+ int *data;
+
+ if ((data = (int *) _malloc_r(rptr, sizeof (int))) == NULL)
+ return (_VOID_PTR)NULL;
+
+ if (strcmp (encoding, UCS_2LE) == 0)
+ *data = UCS_2_LITTLE_ENDIAN;
+ else
+ *data = UCS_2_BIG_ENDIAN;
+
+ return (_VOID_PTR)data;
+}
+
+static size_t
+_DEFUN(ucs_2_close, (rptr, data),
+ struct _reent *rptr _AND
+ _VOID_PTR data)
+{
+ _free_r (rptr, data);
+ return 0;
+}
+
+#if defined (ICONV_FROM_UCS_CES_UCS_2)
+static size_t
+_DEFUN(ucs_2_convert_from_ucs, (data, in, outbuf, outbytesleft),
+ _VOID_PTR data _AND
+ ucs4_t in _AND
+ unsigned char **outbuf _AND
+ size_t *outbytesleft)
+{
+ if ((in >= 0x0000D800 && in <= 0x0000DFFF) /* Surrogate character */
+ || in >= 0x0000FFFE)
+ return (size_t)ICONV_CES_INVALID_CHARACTER;
+
+ if (*outbytesleft < sizeof (ucs2_t))
+ return (size_t)ICONV_CES_NOSPACE;
+
+ if (*((int *)data) == UCS_2_BIG_ENDIAN)
+ *((ucs2_t *)(*outbuf)) = ICONV_HTOBES ((ucs2_t)in);
+ else
+ *((ucs2_t *)(*outbuf)) = ICONV_HTOLES ((ucs2_t)in);
+
+ *outbuf += sizeof (ucs2_t);
+ *outbytesleft -= sizeof (ucs2_t);
+
+ return sizeof (ucs2_t);
+}
+#endif /* ICONV_FROM_UCS_CES_UCS_2 */
+
+#if defined (ICONV_TO_UCS_CES_UCS_2)
+static ucs4_t
+_DEFUN(ucs_2_convert_to_ucs, (data, inbuf, inbytesleft),
+ _VOID_PTR data _AND
+ _CONST unsigned char **inbuf _AND
+ size_t *inbytesleft)
+{
+ ucs4_t res;
+
+ if (*inbytesleft < sizeof (ucs2_t))
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ if (*((int *)data) == UCS_2_BIG_ENDIAN)
+ res = (ucs4_t)ICONV_BETOHS (*((ucs2_t *)(*inbuf)));
+ else
+ res = (ucs4_t)ICONV_LETOHS (*((ucs2_t *)(*inbuf)));
+
+ if ((res >= 0x0000D800 && res <= 0x0000DFFF) /* Surrogate character */
+ || res >= 0x0000FFFE)
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ *inbytesleft -= sizeof (ucs2_t);
+ *inbuf += sizeof (ucs2_t);
+
+ return res;
+}
+#endif /* ICONV_TO_UCS_CES_UCS_2 */
+
+static int
+_DEFUN(ucs_2_get_mb_cur_max, (data),
+ _VOID_PTR data)
+{
+ return 2;
+}
+
+#if defined (ICONV_TO_UCS_CES_UCS_2)
+_CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_ucs_2 =
+{
+ ucs_2_init,
+ ucs_2_close,
+ ucs_2_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ ucs_2_convert_to_ucs
+};
+#endif
+
+#if defined (ICONV_FROM_UCS_CES_UCS_2)
+_CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_ucs_2 =
+{
+ ucs_2_init,
+ ucs_2_close,
+ ucs_2_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ ucs_2_convert_from_ucs
+};
+#endif
+
+#endif /* ICONV_TO_UCS_CES_UCS_2 || ICONV_FROM_UCS_CES_UCS_2 */
+
ucs-2.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cesbi.h
===================================================================
--- cesbi.h (nonexistent)
+++ cesbi.h (revision 520)
@@ -0,0 +1,276 @@
+/*
+ * This file was automatically generated mkdeps.pl script. Don't edit.
+ */
+
+#ifndef __CESBI_H__
+#define __CESBI_H__
+
+#include
+#include <_ansi.h>
+#include "../lib/encnames.h"
+#include "../lib/ucsconv.h"
+
+/*
+ * Enable CES converter if correspondent encoding is requested.
+ * Defining ICONV_TO_UCS_CES_XXX macro or ICONV_FROM_UCS_CES_XXX
+ * macro is needed to enable "XXX encoding -> UCS" or "UCS -> XXX encoding"
+ * part of UCS-based CES converter.
+ */
+#if defined (_ICONV_FROM_ENCODING_EUC_JP) \
+ || defined (_ICONV_FROM_ENCODING_EUC_KR) \
+ || defined (_ICONV_FROM_ENCODING_EUC_TW)
+# define ICONV_TO_UCS_CES_EUC
+#endif
+#if defined (_ICONV_TO_ENCODING_EUC_JP) \
+ || defined (_ICONV_TO_ENCODING_EUC_KR) \
+ || defined (_ICONV_TO_ENCODING_EUC_TW)
+# define ICONV_FROM_UCS_CES_EUC
+#endif
+
+#if defined (_ICONV_FROM_ENCODING_CP775) \
+ || defined (_ICONV_FROM_ENCODING_CP850) \
+ || defined (_ICONV_FROM_ENCODING_CP852) \
+ || defined (_ICONV_FROM_ENCODING_CP855) \
+ || defined (_ICONV_FROM_ENCODING_CP866) \
+ || defined (_ICONV_FROM_ENCODING_ISO_8859_1) \
+ || defined (_ICONV_FROM_ENCODING_ISO_8859_10) \
+ || defined (_ICONV_FROM_ENCODING_ISO_8859_11) \
+ || defined (_ICONV_FROM_ENCODING_ISO_8859_13) \
+ || defined (_ICONV_FROM_ENCODING_ISO_8859_14) \
+ || defined (_ICONV_FROM_ENCODING_ISO_8859_15) \
+ || defined (_ICONV_FROM_ENCODING_ISO_8859_2) \
+ || defined (_ICONV_FROM_ENCODING_ISO_8859_3) \
+ || defined (_ICONV_FROM_ENCODING_ISO_8859_4) \
+ || defined (_ICONV_FROM_ENCODING_ISO_8859_5) \
+ || defined (_ICONV_FROM_ENCODING_ISO_8859_6) \
+ || defined (_ICONV_FROM_ENCODING_ISO_8859_7) \
+ || defined (_ICONV_FROM_ENCODING_ISO_8859_8) \
+ || defined (_ICONV_FROM_ENCODING_ISO_8859_9) \
+ || defined (_ICONV_FROM_ENCODING_ISO_IR_111) \
+ || defined (_ICONV_FROM_ENCODING_KOI8_R) \
+ || defined (_ICONV_FROM_ENCODING_KOI8_RU) \
+ || defined (_ICONV_FROM_ENCODING_KOI8_U) \
+ || defined (_ICONV_FROM_ENCODING_KOI8_UNI) \
+ || defined (_ICONV_FROM_ENCODING_WIN_1250) \
+ || defined (_ICONV_FROM_ENCODING_WIN_1251) \
+ || defined (_ICONV_FROM_ENCODING_WIN_1252) \
+ || defined (_ICONV_FROM_ENCODING_WIN_1253) \
+ || defined (_ICONV_FROM_ENCODING_WIN_1254) \
+ || defined (_ICONV_FROM_ENCODING_WIN_1255) \
+ || defined (_ICONV_FROM_ENCODING_WIN_1256) \
+ || defined (_ICONV_FROM_ENCODING_WIN_1257) \
+ || defined (_ICONV_FROM_ENCODING_WIN_1258)
+# define ICONV_TO_UCS_CES_TABLE
+#endif
+#if defined (_ICONV_TO_ENCODING_CP775) \
+ || defined (_ICONV_TO_ENCODING_CP850) \
+ || defined (_ICONV_TO_ENCODING_CP852) \
+ || defined (_ICONV_TO_ENCODING_CP855) \
+ || defined (_ICONV_TO_ENCODING_CP866) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_1) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_10) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_11) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_13) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_14) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_15) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_2) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_3) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_4) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_5) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_6) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_7) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_8) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_9) \
+ || defined (_ICONV_TO_ENCODING_ISO_IR_111) \
+ || defined (_ICONV_TO_ENCODING_KOI8_R) \
+ || defined (_ICONV_TO_ENCODING_KOI8_RU) \
+ || defined (_ICONV_TO_ENCODING_KOI8_U) \
+ || defined (_ICONV_TO_ENCODING_KOI8_UNI) \
+ || defined (_ICONV_TO_ENCODING_WIN_1250) \
+ || defined (_ICONV_TO_ENCODING_WIN_1251) \
+ || defined (_ICONV_TO_ENCODING_WIN_1252) \
+ || defined (_ICONV_TO_ENCODING_WIN_1253) \
+ || defined (_ICONV_TO_ENCODING_WIN_1254) \
+ || defined (_ICONV_TO_ENCODING_WIN_1255) \
+ || defined (_ICONV_TO_ENCODING_WIN_1256) \
+ || defined (_ICONV_TO_ENCODING_WIN_1257) \
+ || defined (_ICONV_TO_ENCODING_WIN_1258)
+# define ICONV_FROM_UCS_CES_TABLE
+#endif
+
+#if defined (_ICONV_FROM_ENCODING_BIG5)
+# define ICONV_TO_UCS_CES_TABLE_PCS
+#endif
+#if defined (_ICONV_TO_ENCODING_BIG5)
+# define ICONV_FROM_UCS_CES_TABLE_PCS
+#endif
+
+#if defined (_ICONV_FROM_ENCODING_UCS_2) \
+ || defined (_ICONV_FROM_ENCODING_UCS_2BE) \
+ || defined (_ICONV_FROM_ENCODING_UCS_2LE)
+# define ICONV_TO_UCS_CES_UCS_2
+#endif
+#if defined (_ICONV_TO_ENCODING_UCS_2) \
+ || defined (_ICONV_TO_ENCODING_UCS_2BE) \
+ || defined (_ICONV_TO_ENCODING_UCS_2LE)
+# define ICONV_FROM_UCS_CES_UCS_2
+#endif
+
+#if defined (_ICONV_FROM_ENCODING_UCS_2_INTERNAL)
+# define ICONV_TO_UCS_CES_UCS_2_INTERNAL
+#endif
+#if defined (_ICONV_TO_ENCODING_UCS_2_INTERNAL)
+# define ICONV_FROM_UCS_CES_UCS_2_INTERNAL
+#endif
+
+#if defined (_ICONV_FROM_ENCODING_UCS_4) \
+ || defined (_ICONV_FROM_ENCODING_UCS_4BE) \
+ || defined (_ICONV_FROM_ENCODING_UCS_4LE)
+# define ICONV_TO_UCS_CES_UCS_4
+#endif
+#if defined (_ICONV_TO_ENCODING_UCS_4) \
+ || defined (_ICONV_TO_ENCODING_UCS_4BE) \
+ || defined (_ICONV_TO_ENCODING_UCS_4LE)
+# define ICONV_FROM_UCS_CES_UCS_4
+#endif
+
+#if defined (_ICONV_FROM_ENCODING_UCS_4_INTERNAL)
+# define ICONV_TO_UCS_CES_UCS_4_INTERNAL
+#endif
+#if defined (_ICONV_TO_ENCODING_UCS_4_INTERNAL)
+# define ICONV_FROM_UCS_CES_UCS_4_INTERNAL
+#endif
+
+#if defined (_ICONV_FROM_ENCODING_US_ASCII)
+# define ICONV_TO_UCS_CES_US_ASCII
+#endif
+#if defined (_ICONV_TO_ENCODING_US_ASCII)
+# define ICONV_FROM_UCS_CES_US_ASCII
+#endif
+
+#if defined (_ICONV_FROM_ENCODING_UTF_16) \
+ || defined (_ICONV_FROM_ENCODING_UTF_16BE) \
+ || defined (_ICONV_FROM_ENCODING_UTF_16LE)
+# define ICONV_TO_UCS_CES_UTF_16
+#endif
+#if defined (_ICONV_TO_ENCODING_UTF_16) \
+ || defined (_ICONV_TO_ENCODING_UTF_16BE) \
+ || defined (_ICONV_TO_ENCODING_UTF_16LE)
+# define ICONV_FROM_UCS_CES_UTF_16
+#endif
+
+#if defined (_ICONV_FROM_ENCODING_UTF_8)
+# define ICONV_TO_UCS_CES_UTF_8
+#endif
+#if defined (_ICONV_TO_ENCODING_UTF_8)
+# define ICONV_FROM_UCS_CES_UTF_8
+#endif
+
+/*
+ * Some encodings require another encodings to be enabled.
+ * These dependencies are handled in cesdeps.h header file.
+ */
+#include "cesdeps.h"
+
+/*
+ * NLS uses iconv's capabilities and require one of encodings
+ * to be enabled for internal wchar_t representation.
+ */
+#include "../lib/iconvnls.h"
+
+/*
+ * Forward declarations of CES converter handlers.
+ * These handlers are actually defined in correspondent CES converter files.
+ */
+#ifdef ICONV_TO_UCS_CES_EUC
+extern _CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_euc;
+#endif
+#ifdef ICONV_FROM_UCS_CES_EUC
+extern _CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_euc;
+#endif
+
+#ifdef ICONV_TO_UCS_CES_TABLE
+extern _CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_table;
+#endif
+#ifdef ICONV_FROM_UCS_CES_TABLE
+extern _CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_table;
+#endif
+
+#ifdef ICONV_TO_UCS_CES_TABLE_PCS
+extern _CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_table_pcs;
+#endif
+#ifdef ICONV_FROM_UCS_CES_TABLE_PCS
+extern _CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_table_pcs;
+#endif
+
+#ifdef ICONV_TO_UCS_CES_UCS_2
+extern _CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_ucs_2;
+#endif
+#ifdef ICONV_FROM_UCS_CES_UCS_2
+extern _CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_ucs_2;
+#endif
+
+#ifdef ICONV_TO_UCS_CES_UCS_2_INTERNAL
+extern _CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_ucs_2_internal;
+#endif
+#ifdef ICONV_FROM_UCS_CES_UCS_2_INTERNAL
+extern _CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_ucs_2_internal;
+#endif
+
+#ifdef ICONV_TO_UCS_CES_UCS_4
+extern _CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_ucs_4;
+#endif
+#ifdef ICONV_FROM_UCS_CES_UCS_4
+extern _CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_ucs_4;
+#endif
+
+#ifdef ICONV_TO_UCS_CES_UCS_4_INTERNAL
+extern _CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_ucs_4_internal;
+#endif
+#ifdef ICONV_FROM_UCS_CES_UCS_4_INTERNAL
+extern _CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_ucs_4_internal;
+#endif
+
+#ifdef ICONV_TO_UCS_CES_US_ASCII
+extern _CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_us_ascii;
+#endif
+#ifdef ICONV_FROM_UCS_CES_US_ASCII
+extern _CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_us_ascii;
+#endif
+
+#ifdef ICONV_TO_UCS_CES_UTF_16
+extern _CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_utf_16;
+#endif
+#ifdef ICONV_FROM_UCS_CES_UTF_16
+extern _CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_utf_16;
+#endif
+
+#ifdef ICONV_TO_UCS_CES_UTF_8
+extern _CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_utf_8;
+#endif
+#ifdef ICONV_FROM_UCS_CES_UTF_8
+extern _CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_utf_8;
+#endif
+
+#endif /* !__CESBI_H__ */
+
cesbi.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cesdeps.h
===================================================================
--- cesdeps.h (nonexistent)
+++ cesdeps.h (revision 520)
@@ -0,0 +1,40 @@
+/*
+ * This file was automatically generated mkdeps.pl script. Don't edit.
+ */
+
+#ifndef __CESDEPS_H__
+#define __CESDEPS_H__
+
+/*
+ * Some CES converters use another CES converters and the following
+ * is such dependencies description.
+ */
+#ifdef ICONV_TO_UCS_CES_EUC
+# ifndef ICONV_TO_UCS_CES_TABLE
+# define ICONV_TO_UCS_CES_TABLE
+# endif
+# ifndef ICONV_TO_UCS_CES_US_ASCII
+# define ICONV_TO_UCS_CES_US_ASCII
+# endif
+#endif
+#ifdef ICONV_FROM_UCS_CES_EUC
+# ifndef ICONV_FROM_UCS_CES_TABLE
+# define ICONV_FROM_UCS_CES_TABLE
+# endif
+# ifndef ICONV_FROM_UCS_CES_US_ASCII
+# define ICONV_FROM_UCS_CES_US_ASCII
+# endif
+#endif
+#ifdef ICONV_TO_UCS_CES_TABLE_PCS
+# ifndef ICONV_TO_UCS_CES_TABLE
+# define ICONV_TO_UCS_CES_TABLE
+# endif
+#endif
+#ifdef ICONV_FROM_UCS_CES_TABLE_PCS
+# ifndef ICONV_FROM_UCS_CES_TABLE
+# define ICONV_FROM_UCS_CES_TABLE
+# endif
+#endif
+
+#endif /* !__CESDEPS_H__ */
+
cesdeps.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: ucs-4.c
===================================================================
--- ucs-4.c (nonexistent)
+++ ucs-4.c (revision 520)
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2003-2004, Artem B. Bityuckiy
+ * Copyright (c) 1999,2000, Konstantin Chuguev. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include "cesbi.h"
+
+#if defined (ICONV_TO_UCS_CES_UCS_4) \
+ || defined (ICONV_FROM_UCS_CES_UCS_4)
+
+#include <_ansi.h>
+#include
+#include
+#include
+#include
+#include "../lib/local.h"
+#include "../lib/ucsconv.h"
+#include "../lib/endian.h"
+
+/*
+ * BOM isn't supported. UCS-4 is Big Endian. Bad codes are rejected.
+ * Bad codes: 0x0000FFFF, 0x0000FFFE, 0x0000D800-0x0000DFFF,
+ * 0x7FFFFFFF-0xFFFFFFFF.
+ */
+
+#define UCS_4_BIG_ENDIAN 0
+#define UCS_4_LITTLE_ENDIAN 1
+
+#define UCS_4 "ucs_4"
+#define UCS_4BE "ucs_4be"
+#define UCS_4LE "ucs_4le"
+
+static _VOID_PTR
+_DEFUN(ucs_4_init, (rptr, encoding),
+ struct _reent *rptr _AND
+ _CONST char *encoding)
+{
+ int *data;
+
+ if ((data = (int *)_malloc_r (rptr, sizeof(int))) == NULL)
+ return (_VOID_PTR)NULL;
+
+ if (strcmp (encoding, UCS_4LE) == 0)
+ *data = UCS_4_LITTLE_ENDIAN;
+ else
+ *data = UCS_4_BIG_ENDIAN;
+
+ return (_VOID_PTR)data;
+}
+
+static size_t
+_DEFUN(ucs_4_close, (rptr, data),
+ struct _reent *rptr _AND
+ _VOID_PTR data)
+{
+ _free_r(rptr, data);
+ return 0;
+}
+
+
+#if defined (ICONV_FROM_UCS_CES_UCS_4)
+static size_t
+_DEFUN(ucs_4_convert_from_ucs, (data, in, outbuf, outbytesleft),
+ _VOID_PTR data _AND
+ ucs4_t in _AND
+ unsigned char **outbuf _AND
+ size_t *outbytesleft)
+{
+ if ((in >= 0x0000D800 && in <= 0x0000DFFF) /* Surrogate character */
+ || in > 0x7FFFFFFF || in == 0x0000FFFF || in == 0x0000FFFE)
+ return (size_t)ICONV_CES_INVALID_CHARACTER;
+
+ if (*outbytesleft < sizeof (ucs4_t))
+ return (size_t)ICONV_CES_NOSPACE;
+
+ if (*((int *)data) == UCS_4_BIG_ENDIAN)
+ *((ucs4_t *)(*outbuf)) = ICONV_HTOBEL (in);
+ else
+ *((ucs4_t *)(*outbuf)) = ICONV_HTOLEL (in);
+
+ *outbuf += sizeof (ucs4_t);
+ *outbytesleft -= sizeof (ucs4_t);
+
+ return sizeof (ucs4_t);
+}
+#endif /* ICONV_FROM_UCS_CES_UCS_4 */
+
+#if defined (ICONV_TO_UCS_CES_UCS_4)
+static ucs4_t
+_DEFUN(ucs_4_convert_to_ucs, (data, inbuf, inbytesleft),
+ _VOID_PTR data _AND
+ _CONST unsigned char **inbuf _AND
+ size_t *inbytesleft)
+{
+ ucs4_t res;
+
+ if (*inbytesleft < sizeof (ucs4_t))
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ if (*((int *)data) == UCS_4_BIG_ENDIAN)
+ res = ICONV_BETOHL (*((ucs4_t *)(*inbuf)));
+ else
+ res = ICONV_LETOHL (*((ucs4_t *)(*inbuf)));
+
+ if ((res >= 0x0000D800 && res <= 0x0000DFFF) /* Surrogate character */
+ || res > 0x7FFFFFFF || res == 0x0000FFFF || res == 0x0000FFFE)
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ *inbytesleft -= sizeof (ucs4_t);
+ *inbuf += sizeof(ucs4_t);
+
+ return res;
+}
+#endif /* ICONV_TO_UCS_CES_UCS_4 */
+
+static int
+_DEFUN(ucs_4_get_mb_cur_max, (data),
+ _VOID_PTR data)
+{
+ return 4;
+}
+
+#if defined (ICONV_TO_UCS_CES_UCS_4)
+_CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_ucs_4 =
+{
+ ucs_4_init,
+ ucs_4_close,
+ ucs_4_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ ucs_4_convert_to_ucs
+};
+#endif
+
+#if defined (ICONV_FROM_UCS_CES_UCS_4)
+_CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_ucs_4 =
+{
+ ucs_4_init,
+ ucs_4_close,
+ ucs_4_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ ucs_4_convert_from_ucs
+};
+#endif
+
+#endif /* ICONV_TO_UCS_CES_UCS_4 || ICONV_FROM_UCS_CES_UCS_4 */
+
ucs-4.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property