diff options
Diffstat (limited to 'libX11/src/xlibi18n')
40 files changed, 962 insertions, 389 deletions
diff --git a/libX11/src/xlibi18n/ICWrap.c b/libX11/src/xlibi18n/ICWrap.c index b51da6f41..3708229b9 100644 --- a/libX11/src/xlibi18n/ICWrap.c +++ b/libX11/src/xlibi18n/ICWrap.c @@ -13,30 +13,30 @@ * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of OMRON, NTT Software, NTT, and - * Open Software Foundation not be used in advertising or publicity - * pertaining to distribution of the software without specific, + * Open Software Foundation not be used in advertising or publicity + * pertaining to distribution of the software without specific, * written prior permission. OMRON, NTT Software, NTT, and Open Software * Foundation make no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * - * OMRON, NTT SOFTWARE, NTT, AND OPEN SOFTWARE FOUNDATION - * DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT + * OMRON, NTT SOFTWARE, NTT, AND OPEN SOFTWARE FOUNDATION + * DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT * SHALL OMRON, NTT SOFTWARE, NTT, OR OPEN SOFTWARE FOUNDATION BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * + * * Authors: Li Yuhong OMRON Corporation * Tatsuya Kato NTT Software Corporation * Hiroshi Kuribayashi OMRON Coproration * Muneiyoshi Suzuki Nippon Telegraph and Telephone Co. - * - * M. Collins OSF + * + * M. Collins OSF * Takashi Fujiwara FUJITSU LIMITED - */ + */ /* Copyright 1991, 1998 The Open Group @@ -224,7 +224,7 @@ XGetIMValues(XIM im, ...) } /* - * Create an input context within the input method, + * Create an input context within the input method, * and return a pointer to the input context. */ @@ -235,7 +235,7 @@ XCreateIC(XIM im, ...) int total_count; XIMArg *args; XIC ic; - + /* * so count the stuff dangling here */ @@ -263,8 +263,7 @@ XCreateIC(XIM im, ...) * Free the input context. */ void -XDestroyIC(ic) - XIC ic; +XDestroyIC(XIC ic) { XIM im = ic->core.im; XIC *prev; @@ -283,7 +282,7 @@ XDestroyIC(ic) char * XGetICValues(XIC ic, ...) -{ +{ va_list var; int total_count; XIMArg *args; @@ -346,8 +345,7 @@ XSetICValues(XIC ic, ...) * argument. */ void -XSetICFocus(ic) - XIC ic; +XSetICFocus(XIC ic) { if (ic && ic->core.im) (*ic->methods->set_focus) (ic); @@ -358,8 +356,7 @@ XSetICFocus(ic) * argument. */ void -XUnsetICFocus(ic) - XIC ic; +XUnsetICFocus(XIC ic) { if (ic->core.im) (*ic->methods->unset_focus) (ic); @@ -369,15 +366,13 @@ XUnsetICFocus(ic) * Return the XIM associated with the input context. */ XIM -XIMOfIC(ic) - XIC ic; +XIMOfIC(XIC ic) { return ic->core.im; } char * -XmbResetIC(ic) - XIC ic; +XmbResetIC(XIC ic) { if (ic->core.im) return (*ic->methods->mb_reset)(ic); @@ -385,8 +380,7 @@ XmbResetIC(ic) } wchar_t * -XwcResetIC(ic) - XIC ic; +XwcResetIC(XIC ic) { if (ic->core.im) return (*ic->methods->wc_reset)(ic); @@ -394,8 +388,7 @@ XwcResetIC(ic) } char * -Xutf8ResetIC(ic) - XIC ic; +Xutf8ResetIC(XIC ic) { if (ic->core.im) { if (ic->methods->utf8_reset) @@ -407,13 +400,8 @@ Xutf8ResetIC(ic) } int -XmbLookupString(ic, ev, buffer, nbytes, keysym, status) - XIC ic; - register XKeyEvent *ev; - char *buffer; - int nbytes; - KeySym *keysym; - Status *status; +XmbLookupString(XIC ic, XKeyEvent *ev, char *buffer, int nbytes, + KeySym *keysym, Status *status) { if (ic->core.im) return (*ic->methods->mb_lookup_string) (ic, ev, buffer, nbytes, @@ -422,13 +410,8 @@ XmbLookupString(ic, ev, buffer, nbytes, keysym, status) } int -XwcLookupString(ic, ev, buffer, nchars, keysym, status) - XIC ic; - register XKeyEvent *ev; - wchar_t *buffer; - int nchars; - KeySym *keysym; - Status *status; +XwcLookupString(XIC ic, XKeyEvent *ev, wchar_t *buffer, int nchars, + KeySym *keysym, Status *status) { if (ic->core.im) return (*ic->methods->wc_lookup_string) (ic, ev, buffer, nchars, @@ -437,13 +420,8 @@ XwcLookupString(ic, ev, buffer, nchars, keysym, status) } int -Xutf8LookupString(ic, ev, buffer, nbytes, keysym, status) - XIC ic; - register XKeyEvent *ev; - char *buffer; - int nbytes; - KeySym *keysym; - Status *status; +Xutf8LookupString(XIC ic, XKeyEvent *ev, char *buffer, int nbytes, + KeySym *keysym, Status *status) { if (ic->core.im) { if (ic->methods->utf8_lookup_string) diff --git a/libX11/src/xlibi18n/IMWrap.c b/libX11/src/xlibi18n/IMWrap.c index a90b40675..1e5b8f0b4 100644 --- a/libX11/src/xlibi18n/IMWrap.c +++ b/libX11/src/xlibi18n/IMWrap.c @@ -11,10 +11,10 @@ * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of Open Software Foundation and - * Sony Corporation not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior permission. - * Open Software Foundation and Sony Corporation make no - * representations about the suitability of this software for any purpose. + * Sony Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Open Software Foundation and Sony Corporation make no + * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * OPEN SOFTWARE FOUNDATION AND SONY CORPORATION DISCLAIM ALL @@ -24,11 +24,11 @@ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * M. Collins OSF + * PERFORMANCE OF THIS SOFTWARE. + * + * M. Collins OSF * Makoto Wakamatsu Sony Corporation - */ + */ /* Copyright 1991, 1998 The Open Group @@ -69,9 +69,7 @@ from The Open Group. * Compile the resource name. (resource_name ---> xrm_name) */ void -_XIMCompileResourceList(res, num_res) - register XIMResourceList res; - unsigned int num_res; +_XIMCompileResourceList(XIMResourceList res, unsigned int num_res) { register unsigned int count; @@ -81,10 +79,7 @@ _XIMCompileResourceList(res, num_res) } void -_XCopyToArg(src, dst, size) - XPointer src; - XPointer *dst; - register unsigned int size; +_XCopyToArg(XPointer src, XPointer *dst, unsigned int size) { if (!*dst) { union { @@ -121,12 +116,8 @@ _XCopyToArg(src, dst, size) * a XIM object and return a pointer the newly created XIM back to the caller. */ -XIM -XOpenIM( display, rdb, res_name, res_class ) - Display *display; - XrmDatabase rdb; - char *res_name; - char *res_class; +XIM +XOpenIM(Display *display, XrmDatabase rdb, char *res_name, char *res_class) { XLCd lcd = _XOpenLC( (char *)NULL ); @@ -139,13 +130,12 @@ XOpenIM( display, rdb, res_name, res_class ) * Close the connection to the input manager, and free the XIM structure */ Status -XCloseIM(im) - XIM im; +XCloseIM(XIM im) { Status s; XIC ic; XLCd lcd = im->core.lcd; - + s = (im->methods->close) (im); for (ic = im->core.ic_chain; ic; ic = ic->core.next) ic->core.im = (XIM)NULL; @@ -158,8 +148,7 @@ XCloseIM(im) * Return the Display associated with the input method. */ Display * -XDisplayOfIM(im) - XIM im; +XDisplayOfIM(XIM im) { return im->core.display; } @@ -168,8 +157,7 @@ XDisplayOfIM(im) * Return the Locale associated with the input method. */ char * -XLocaleOfIM(im) - XIM im; +XLocaleOfIM(XIM im) { return im->core.lcd->core->name; } diff --git a/libX11/src/xlibi18n/Makefile.am b/libX11/src/xlibi18n/Makefile.am index b97316a1b..9582a6561 100644 --- a/libX11/src/xlibi18n/Makefile.am +++ b/libX11/src/xlibi18n/Makefile.am @@ -91,11 +91,13 @@ libi18n_la_SOURCES = \ lcUniConv/ascii.h\ lcUniConv/big5.h\ lcUniConv/big5_emacs.h\ + lcUniConv/big5hkscs.h\ lcUniConv/cp1133.h\ lcUniConv/cp1251.h\ lcUniConv/cp1255.h\ lcUniConv/cp1256.h\ lcUniConv/gb2312.h\ + lcUniConv/gbk.h\ lcUniConv/georgian_academy.h\ lcUniConv/georgian_ps.h\ lcUniConv/iso8859_1.h\ diff --git a/libX11/src/xlibi18n/Makefile.in b/libX11/src/xlibi18n/Makefile.in index dab91b7dc..8c2e0d89b 100644 --- a/libX11/src/xlibi18n/Makefile.in +++ b/libX11/src/xlibi18n/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# 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 Free Software Foundation, Inc. +# 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. @@ -16,8 +17,9 @@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@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 @@ -43,6 +45,7 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h \ $(top_builddir)/include/X11/XlibConf.h CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libi18n_la_DEPENDENCIES = $(IM_LIBS) $(LC_LIBS) $(OM_LIBS) am__libi18n_la_SOURCES_DIST = XlcDL.c XlcSL.c XDefaultIMIF.c \ @@ -54,23 +57,23 @@ am__libi18n_la_SOURCES_DIST = XlcDL.c XlcSL.c XDefaultIMIF.c \ XimImSw.h XimProto.h XimThai.h XimTrInt.h XimTrX.h XimTrans.h \ Ximint.h XimintL.h XimintP.h XlcGeneric.h XlcPubI.h \ XlcPublic.h Xlcint.h lcUniConv/armscii_8.h lcUniConv/ascii.h \ - lcUniConv/big5.h lcUniConv/big5_emacs.h lcUniConv/cp1133.h \ - lcUniConv/cp1251.h lcUniConv/cp1255.h lcUniConv/cp1256.h \ - lcUniConv/gb2312.h lcUniConv/georgian_academy.h \ - lcUniConv/georgian_ps.h lcUniConv/iso8859_1.h \ - lcUniConv/iso8859_10.h lcUniConv/iso8859_11.h \ - lcUniConv/iso8859_13.h lcUniConv/iso8859_14.h \ - lcUniConv/iso8859_15.h lcUniConv/iso8859_16.h \ - lcUniConv/iso8859_2.h lcUniConv/iso8859_3.h \ - lcUniConv/iso8859_4.h lcUniConv/iso8859_5.h \ - lcUniConv/iso8859_6.h lcUniConv/iso8859_7.h \ - lcUniConv/iso8859_8.h lcUniConv/iso8859_9.h \ - lcUniConv/iso8859_9e.h lcUniConv/jisx0201.h \ - lcUniConv/jisx0208.h lcUniConv/jisx0212.h lcUniConv/koi8_c.h \ - lcUniConv/koi8_r.h lcUniConv/koi8_u.h lcUniConv/ksc5601.h \ - lcUniConv/mulelao.h lcUniConv/tatar_cyr.h lcUniConv/tcvn.h \ - lcUniConv/tis620.h lcUniConv/ucs2be.h lcUniConv/utf8.h \ - lcUniConv/viscii.h + lcUniConv/big5.h lcUniConv/big5_emacs.h lcUniConv/big5hkscs.h \ + lcUniConv/cp1133.h lcUniConv/cp1251.h lcUniConv/cp1255.h \ + lcUniConv/cp1256.h lcUniConv/gb2312.h lcUniConv/gbk.h \ + lcUniConv/georgian_academy.h lcUniConv/georgian_ps.h \ + lcUniConv/iso8859_1.h lcUniConv/iso8859_10.h \ + lcUniConv/iso8859_11.h lcUniConv/iso8859_13.h \ + lcUniConv/iso8859_14.h lcUniConv/iso8859_15.h \ + lcUniConv/iso8859_16.h lcUniConv/iso8859_2.h \ + lcUniConv/iso8859_3.h lcUniConv/iso8859_4.h \ + lcUniConv/iso8859_5.h lcUniConv/iso8859_6.h \ + lcUniConv/iso8859_7.h lcUniConv/iso8859_8.h \ + lcUniConv/iso8859_9.h lcUniConv/iso8859_9e.h \ + lcUniConv/jisx0201.h lcUniConv/jisx0208.h lcUniConv/jisx0212.h \ + lcUniConv/koi8_c.h lcUniConv/koi8_r.h lcUniConv/koi8_u.h \ + lcUniConv/ksc5601.h lcUniConv/mulelao.h lcUniConv/tatar_cyr.h \ + lcUniConv/tcvn.h lcUniConv/tis620.h lcUniConv/ucs2be.h \ + lcUniConv/utf8.h lcUniConv/viscii.h @XLIB_LOADABLE_I18N_TRUE@am__objects_1 = XlcDL.lo XlcSL.lo am_libi18n_la_OBJECTS = $(am__objects_1) XDefaultIMIF.lo \ XDefaultOMIF.lo xim_trans.lo ICWrap.lo IMWrap.lo imKStoUCS.lo \ @@ -82,11 +85,9 @@ libi18n_la_OBJECTS = $(am_libi18n_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src -I$(top_builddir)/include/X11 depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles +am__mv = mv -f 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) \ @@ -111,27 +112,26 @@ BIGFONT_CFLAGS = @BIGFONT_CFLAGS@ BIGFONT_LIBS = @BIGFONT_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOLT_BASH = @DOLT_BASH@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DSYMUTIL = @DSYMUTIL@ -ECHO = @ECHO@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ GREP = @GREP@ @@ -143,6 +143,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KEYSYMDEF = @KEYSYMDEF@ LAUNCHD = @LAUNCHD@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ @@ -152,7 +153,10 @@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LINT = @LINT@ LINTLIB = @LINTLIB@ LINT_FLAGS = @LINT_FLAGS@ +LIPO = @LIPO@ LN_S = @LN_S@ +LTCOMPILE = @LTCOMPILE@ +LTCXXCOMPILE = @LTCXXCOMPILE@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -160,8 +164,12 @@ MALLOC_ZERO_CFLAGS = @MALLOC_ZERO_CFLAGS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ +NM = @NM@ NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -201,17 +209,14 @@ XMALLOC_ZERO_CFLAGS = @XMALLOC_ZERO_CFLAGS@ XPROTO_CFLAGS = @XPROTO_CFLAGS@ XPROTO_LIBS = @XPROTO_LIBS@ XTHREADLIB = @XTHREADLIB@ -XTHREADS = @XTHREADS@ XTHREAD_CFLAGS = @XTHREAD_CFLAGS@ XTMALLOC_ZERO_CFLAGS = @XTMALLOC_ZERO_CFLAGS@ -XUSE_MTSAFE_API = @XUSE_MTSAFE_API@ 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_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -226,6 +231,7 @@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ +distcleancheck_listfiles = @distcleancheck_listfiles@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ @@ -242,6 +248,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -254,6 +261,7 @@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ @@ -346,11 +354,13 @@ libi18n_la_SOURCES = \ lcUniConv/ascii.h\ lcUniConv/big5.h\ lcUniConv/big5_emacs.h\ + lcUniConv/big5hkscs.h\ lcUniConv/cp1133.h\ lcUniConv/cp1251.h\ lcUniConv/cp1255.h\ lcUniConv/cp1256.h\ lcUniConv/gb2312.h\ + lcUniConv/gbk.h\ lcUniConv/georgian_academy.h\ lcUniConv/georgian_ps.h\ lcUniConv/iso8859_1.h\ @@ -403,14 +413,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( 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) --foreign src/xlibi18n/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/xlibi18n/Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/xlibi18n/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/xlibi18n/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -428,6 +438,7 @@ $(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-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @@ -479,21 +490,21 @@ distclean-compile: .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< @@ -509,14 +520,14 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \ + $(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) - tags=; \ + set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -524,29 +535,34 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ + 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) - tags=; \ 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)$$tags$$unique" \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -567,13 +583,17 @@ distdir: $(DISTFILES) if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @@ -601,6 +621,7 @@ clean-generic: 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" @@ -622,6 +643,8 @@ dvi-am: html: html-am +html-am: + info: info-am info-am: @@ -630,18 +653,28 @@ 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 @@ -682,6 +715,7 @@ uninstall-am: @LINT_TRUE@lint: @LINT_TRUE@ $(LINT) $(ALL_LINT_FLAGS) $(libi18n_la_SOURCES) + # 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: diff --git a/libX11/src/xlibi18n/XDefaultIMIF.c b/libX11/src/xlibi18n/XDefaultIMIF.c index fd6a84725..a8677f78a 100644 --- a/libX11/src/xlibi18n/XDefaultIMIF.c +++ b/libX11/src/xlibi18n/XDefaultIMIF.c @@ -162,7 +162,7 @@ _XDefaultOpenIM( XlcNCompoundText, lcd, XlcNMultiByte))) { return((XIM)NULL); } - + if (!(ctow_conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar))) { return((XIM)NULL); @@ -413,7 +413,7 @@ _MbLookupString( { XComposeStatus NotSupportedYet ; int length; - + length = XLookupString(ev, buffer, bytes, keysym, &NotSupportedYet); if (keysym && *keysym == NoSymbol){ diff --git a/libX11/src/xlibi18n/XDefaultOMIF.c b/libX11/src/xlibi18n/XDefaultOMIF.c index 921ab2baf..a6b891b08 100644 --- a/libX11/src/xlibi18n/XDefaultOMIF.c +++ b/libX11/src/xlibi18n/XDefaultOMIF.c @@ -62,10 +62,6 @@ Sun Microsystems, Inc. or its licensors is granted. #define AllocLocalBuf(length) (length > BUFSIZ ? (char *)Xmalloc(length) : local_buf) #define FreeLocalBuf(ptr) if (ptr != local_buf) Xfree(ptr) -#ifdef _MSC_VER -typedef long ssize_t; -#endif - typedef struct _FontDataRec { char *name; } FontDataRec, *FontData; @@ -101,7 +97,7 @@ typedef struct _XOCGenericPart { typedef struct _XOCGenericRec { XOCMethods methods; - XOCCoreRec core; + XOCCoreRec core; XOCGenericPart gen; } XOCGenericRec, *XOCGeneric; @@ -137,7 +133,7 @@ get_prop_name( unsigned long fp; if (XGetFontProperty(fs, XA_FONT, &fp)) - return XGetAtomName(dpy, fp); + return XGetAtomName(dpy, fp); return (char *) NULL; } @@ -163,7 +159,7 @@ check_charset( if (length > name_len) return(NULL); - + if (_XlcCompareISOLatin1(last - length, font_data->name) == 0) return font_data; } @@ -266,7 +262,7 @@ load_font_info( return False; if (fn_num > 0) font_set->info->fid = XLoadFont(dpy, font_set->font_name); - + if (fn_list) XFreeFontNames(fn_list); } return True; @@ -378,7 +374,7 @@ get_font_name( name = (char *) Xmalloc(strlen(*list) + 1); if (name) strcpy(name, *list); - + XFreeFontNames(list); } else { fs = XLoadQueryFont(dpy, pattern); @@ -484,7 +480,7 @@ Limit the length of the string copy to prevent stack corruption. continue; } else { if (num_fields == 13 || num_fields == 14) { - /* + /* * There are 14 fields in an XLFD name -- make certain the * charset (& encoding) is placed in the correct field. */ @@ -549,11 +545,11 @@ Limit the length of the string copy to prevent stack corruption. strcpy(base_name, oc->core.base_name_list); oc->core.base_name_list = base_name; - XFreeStringList(name_list); + XFreeStringList(name_list); return found_num; err: - XFreeStringList(name_list); + XFreeStringList(name_list); return -1; } @@ -664,7 +660,7 @@ destroy_oc( if (oc->core.res_class) Xfree(oc->core.res_class); #endif - + Xfree(oc); } @@ -718,7 +714,7 @@ wcs_to_mbs( &to_left, NULL, 0); if (ret != 0 || length > 0) return False; - + return True; } @@ -847,7 +843,7 @@ _XmbDefaultTextPerCharExtents(XOC oc, _Xconst char *text, int length, cs->rbearing); overall.width += cs->width; } - (*num_chars)++; + (*num_chars)++; } if (overall_ink) { @@ -1002,12 +998,12 @@ create_oc( if (oc == NULL) return (XOC) NULL; bzero((char *) oc, sizeof(XOCGenericRec)); - + oc->core.om = om; if (oc_resources[0].xrm_name == NULLQUARK) _XlcCompileResourceList(oc_resources, XlcNumber(oc_resources)); - + if (_XlcSetValues((XPointer) oc, oc_resources, XlcNumber(oc_resources), args, num_args, XlcCreateMask | XlcDefaultMask)) goto err; @@ -1043,7 +1039,7 @@ close_om( if ((data = gen->data)) { if (data->font_data) { for (font_data = data->font_data, count = data->font_data_count; - count-- > 0 ; font_data++) { + count-- > 0 ; font_data++) { if (font_data->name) Xfree(font_data->name); } @@ -1141,7 +1137,7 @@ static _Xconst char *supported_charset_list[] = { "SUNOLCURSOR-1", "SUNOLGLYPH-1" }; - + static Bool init_om( XOM om) @@ -1234,7 +1230,7 @@ _XDefaultOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb, if (om == NULL) return (XOM) NULL; bzero((char *) om, sizeof(XOMGenericRec)); - + om->methods = (XOMMethods)&methods; om->core.lcd = lcd; om->core.display = dpy; @@ -1254,7 +1250,7 @@ _XDefaultOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb, if (om_resources[0].xrm_name == NULLQUARK) _XlcCompileResourceList(om_resources, XlcNumber(om_resources)); - + om->core.resources = om_resources; om->core.num_resources = XlcNumber(om_resources); diff --git a/libX11/src/xlibi18n/Xaixlcint.h b/libX11/src/xlibi18n/Xaixlcint.h index 2e4f3f521..b7d344e96 100644 --- a/libX11/src/xlibi18n/Xaixlcint.h +++ b/libX11/src/xlibi18n/Xaixlcint.h @@ -14,7 +14,7 @@ * software without specific, written prior permission. * * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS, AND + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS, AND * NONINFRINGEMENT OF THIRD PARTY RIGHTS, IN NO EVENT SHALL * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, diff --git a/libX11/src/xlibi18n/XimImSw.h b/libX11/src/xlibi18n/XimImSw.h index 8ad5d2872..d13d43c24 100644 --- a/libX11/src/xlibi18n/XimImSw.h +++ b/libX11/src/xlibi18n/XimImSw.h @@ -11,7 +11,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of -this software for any purpose. +this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, @@ -22,7 +22,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - Author: Takashi Fujiwara FUJITSU LIMITED + Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ diff --git a/libX11/src/xlibi18n/XimProto.h b/libX11/src/xlibi18n/XimProto.h index fe6e5f693..c7458b089 100644 --- a/libX11/src/xlibi18n/XimProto.h +++ b/libX11/src/xlibi18n/XimProto.h @@ -11,7 +11,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of -this software for any purpose. +this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, @@ -22,7 +22,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - Author: Takashi Fujiwara FUJITSU LIMITED + Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ diff --git a/libX11/src/xlibi18n/XimThai.h b/libX11/src/xlibi18n/XimThai.h index 5b2666ebf..28e909568 100644 --- a/libX11/src/xlibi18n/XimThai.h +++ b/libX11/src/xlibi18n/XimThai.h @@ -28,13 +28,13 @@ Copyright 1993 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -48,17 +48,17 @@ SOFTWARE. /* $XFree86: xc/lib/X11/XimThai.h,v 1.5 2001/12/14 19:54:08 dawes Exp $ */ /* -**++ -** FACILITY: -** -** Xlib -** -** ABSTRACT: -** -** Definition file for Thai specific functions. -** -** MODIFICATION HISTORY: -** +**++ +** FACILITY: +** +** Xlib +** +** ABSTRACT: +** +** Definition file for Thai specific functions. +** +** MODIFICATION HISTORY: +** **/ #ifndef _XIMTHAI_H_ diff --git a/libX11/src/xlibi18n/XimTrX.h b/libX11/src/xlibi18n/XimTrX.h index a43784397..edf8a8a86 100644 --- a/libX11/src/xlibi18n/XimTrX.h +++ b/libX11/src/xlibi18n/XimTrX.h @@ -24,7 +24,7 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. - Takashi Fujiwara FUJITSU LIMITED + Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ diff --git a/libX11/src/xlibi18n/XimTrans.h b/libX11/src/xlibi18n/XimTrans.h index f75270b27..3123879d5 100644 --- a/libX11/src/xlibi18n/XimTrans.h +++ b/libX11/src/xlibi18n/XimTrans.h @@ -24,7 +24,7 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. - Takashi Fujiwara FUJITSU LIMITED + Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ @@ -84,12 +84,6 @@ extern void _XimFreeTransIntrCallback( Xim im ); -extern Bool _XimTransIntrCallbackCheck( - Xim im, - INT16 len, - XPointer data -); - extern Bool _XimTransFilterWaitEvent( Display *d, Window w, diff --git a/libX11/src/xlibi18n/Ximint.h b/libX11/src/xlibi18n/Ximint.h index 3cbcfc4b9..1b1ad3377 100644 --- a/libX11/src/xlibi18n/Ximint.h +++ b/libX11/src/xlibi18n/Ximint.h @@ -13,7 +13,7 @@ Sony Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED and Sony Corporation makes no representations about the suitability of this software for any -purpose. It is provided "as is" without express or implied warranty. +purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED AND SONY CORPORATION DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF @@ -22,9 +22,9 @@ SONY CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. +PERFORMANCE OF THIS SOFTWARE. - Author: Takashi Fujiwara FUJITSU LIMITED + Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp Motifier: Makoto Wakamatsu Sony Corporation makoto@sm.sony.co.jp @@ -585,7 +585,7 @@ extern char * _XimEncodeIMATTRIBUTE( Xim im, XIMResourceList res_list, unsigned int res_num, - XIMArg *arg, + XIMArg *arg, XIMArg **arg_ret, char *buf, int size, @@ -598,7 +598,7 @@ extern char * _XimEncodeICATTRIBUTE( Xic ic, XIMResourceList res_list, unsigned int res_num, - XIMArg *arg, + XIMArg *arg, XIMArg **arg_ret, char *buf, int size, @@ -841,14 +841,6 @@ extern Bool _XimRead( XPointer arg ); -extern Bool _XimIntrCallback( - Xim im, - Bool (*callback)( - Xim, INT16, XPointer, XPointer - ), - XPointer call_data -); - extern void _XimFlush( Xim im ); @@ -870,9 +862,9 @@ extern CARD32 _XimExtenArgCheck( #endif extern Bool _XimCbDispatch( - Xim im, - INT16 len, - XPointer data, + Xim im, + INT16 len, + XPointer data, XPointer call_data ); diff --git a/libX11/src/xlibi18n/XimintL.h b/libX11/src/xlibi18n/XimintL.h index 5eeb21f23..1ac4d478f 100644 --- a/libX11/src/xlibi18n/XimintL.h +++ b/libX11/src/xlibi18n/XimintL.h @@ -16,17 +16,17 @@ makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. -FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL -WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR -ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR +ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - Author: Takashi Fujiwara FUJITSU LIMITED + Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp Modifier: Franky Ling Digital Equipment Corporation frankyling@hgrd01.enet.dec.com diff --git a/libX11/src/xlibi18n/XimintP.h b/libX11/src/xlibi18n/XimintP.h index d36abdc64..bb99313d2 100644 --- a/libX11/src/xlibi18n/XimintP.h +++ b/libX11/src/xlibi18n/XimintP.h @@ -15,7 +15,7 @@ pertaining to distribution of the software without specific, written prior permission. Sun Microsystems, Inc., FUJITSU LIMITED and Sony Corporation makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or -implied warranty. +implied warranty. Sun Microsystems Inc. ,FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES @@ -27,7 +27,7 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. - Takashi Fujiwara FUJITSU LIMITED + Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp Makoto Wakamatsu Sony Corporation makoto@sm.sony.co.jp diff --git a/libX11/src/xlibi18n/XlcDL.c b/libX11/src/xlibi18n/XlcDL.c index 96a9e9535..30dee0c41 100644 --- a/libX11/src/xlibi18n/XlcDL.c +++ b/libX11/src/xlibi18n/XlcDL.c @@ -143,7 +143,7 @@ strdup_with_underscore(const char *symbol) { char *result; - if ((result = malloc(strlen(symbol) + 2)) == NULL) + if ((result = malloc(strlen(symbol) + 2)) == NULL) return NULL; result[0] = '_'; strcpy(result + 1, symbol); @@ -213,7 +213,7 @@ Limit the length of path to prevent stack buffer corruption. if (!xi18n_objects_list) return; } n = parse_line(p, args, 6); - + if (n == 3 || n == 5) { if (!strcmp(args[0], "XLC")){ xi18n_objects_list[lc_count].type = XLC_OBJECT; @@ -323,7 +323,7 @@ open_object( char *lc_dir) { char *path; - + if (object->refcount == 0) { path = __lc_path(object->dl_name, lc_dir); if (!path) @@ -430,7 +430,7 @@ _XlcDynamicLoad(const char *lc_name) if (lcd != (XLCd)NULL) { break; } - + close_object (objects_list); } return (XLCd)lcd; @@ -468,7 +468,7 @@ _XDynamicOpenIM(XLCd lcd, Display *display, XrmDatabase rdb, if (im != (XIM)NULL) { break; } - + close_object (objects_list); } return (XIM)im; @@ -612,7 +612,7 @@ _XDynamicOpenOM(XLCd lcd, Display *display, XrmDatabase rdb, strcmp(objects_list->locale_name, lc_name)) continue; if (!open_object (objects_list, lc_dir)) continue; - + om_openOM = (dynamicIOpenProcp)fetch_symbol(objects_list, objects_list->open); if (!om_openOM) continue; om = (*om_openOM)(lcd, display, rdb, res_name, res_class); diff --git a/libX11/src/xlibi18n/XlcGeneric.h b/libX11/src/xlibi18n/XlcGeneric.h index f1d14e710..1b9c68b1f 100644 --- a/libX11/src/xlibi18n/XlcGeneric.h +++ b/libX11/src/xlibi18n/XlcGeneric.h @@ -136,9 +136,9 @@ typedef struct _XLCdGenericPart { } XLCdGenericPart; typedef struct _XLCdGenericRec { - XLCdCoreRec core; + XLCdCoreRec core; XLCdPublicPart pub; - XLCdGenericPart gen; + XLCdGenericPart gen; } XLCdGenericRec, *XLCdGeneric; extern XLCdMethods _XlcGenericMethods; diff --git a/libX11/src/xlibi18n/XlcPubI.h b/libX11/src/xlibi18n/XlcPubI.h index 4544fb8cf..51219305e 100644 --- a/libX11/src/xlibi18n/XlcPubI.h +++ b/libX11/src/xlibi18n/XlcPubI.h @@ -98,7 +98,7 @@ typedef struct _XLCdPublicPart { } XLCdPublicPart; typedef struct _XLCdPublicRec { - XLCdCoreRec core; + XLCdCoreRec core; XLCdPublicPart pub; } XLCdPublicRec, *XLCdPublic; diff --git a/libX11/src/xlibi18n/Xlcint.h b/libX11/src/xlibi18n/Xlcint.h index 53704c542..a8c991bab 100644 --- a/libX11/src/xlibi18n/Xlcint.h +++ b/libX11/src/xlibi18n/Xlcint.h @@ -42,31 +42,31 @@ from The Open Group. * copyright notice and this permission notice appear in supporting * documentation, and that the names of OMRON, NTT Software, NTT, Open * Software Foundation, and Sony Corporation not be used in advertising - * or publicity pertaining to distribution of the software without specific, + * or publicity pertaining to distribution of the software without specific, * written prior permission. OMRON, NTT Software, NTT, Open Software - * Foundation, and Sony Corporation make no representations about the - * suitability of this software for any purpose. It is provided "as is" + * Foundation, and Sony Corporation make no representations about the + * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * - * OMRON, NTT SOFTWARE, NTT, OPEN SOFTWARE FOUNDATION, AND SONY - * CORPORATION DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT - * SHALL OMRON, NTT SOFTWARE, NTT, OPEN SOFTWARE FOUNDATION, OR SONY + * OMRON, NTT SOFTWARE, NTT, OPEN SOFTWARE FOUNDATION, AND SONY + * CORPORATION DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT + * SHALL OMRON, NTT SOFTWARE, NTT, OPEN SOFTWARE FOUNDATION, OR SONY * CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * + * * Authors: Li Yuhong OMRON Corporation * Tatsuya Kato NTT Software Corporation * Hiroshi Kuribayashi OMRON Coproration * Muneiyoshi Suzuki Nippon Telegraph and Telephone Co. - * - * M. Collins OSF + * + * M. Collins OSF * Katsuhisa Yano TOSHIBA Corp. * Makoto Wakamatsu Sony Corporation * Takashi Fujiwara FUJITSU LIMITED - */ + */ #ifndef _XLCINT_H_ @@ -436,11 +436,11 @@ typedef char* (*XGetOCValuesProc)( ); /* - * X Font Sets are an instantiable object, so we define it, the + * X Font Sets are an instantiable object, so we define it, the * object itself, a method list and data */ -/* +/* * XFontSet object method list */ @@ -598,7 +598,7 @@ typedef struct _XOC { /* - * X Input Managers are an instantiable object, so we define it, the + * X Input Managers are an instantiable object, so we define it, the * object itself, a method list and data. */ @@ -656,7 +656,7 @@ typedef struct { /* - * An X Input Manager (IM). Implementations may need to extend this data + * An X Input Manager (IM). Implementations may need to extend this data * structure to accomodate additional data, state information etc. */ typedef struct _XIM { @@ -667,13 +667,13 @@ typedef struct _XIM { /* - * X Input Contexts (IC) are an instantiable object, so we define it, the + * X Input Contexts (IC) are an instantiable object, so we define it, the * object itself, a method list and data for this object */ /* * Input Context method list - */ + */ typedef struct { void (*destroy)( XIC @@ -740,7 +740,7 @@ typedef struct { /* - * an Input Context. Implementations may need to extend this data + * an Input Context. Implementations may need to extend this data * structure to accomodate additional data, state information etc. */ typedef struct _XIC { @@ -912,6 +912,11 @@ extern void _XlcAddUtf8LocaleConverters( XLCd lcd ); +/* Registers GB18030 converters for a GB18030 locale. */ +extern void _XlcAddGB18030LocaleConverters( + XLCd lcd +); + /* The default locale loader. Assumes an ASCII encoding. */ extern XLCd _XlcDefaultLoader( const char* name diff --git a/libX11/src/xlibi18n/imKStoUCS.c b/libX11/src/xlibi18n/imKStoUCS.c index 7d8d5b92d..940d3ed2e 100644 --- a/libX11/src/xlibi18n/imKStoUCS.c +++ b/libX11/src/xlibi18n/imKStoUCS.c @@ -66,7 +66,7 @@ static unsigned short const keysym_to_unicode_590_5fe[] = { 0x06f0, 0x06f1, 0x06f2, 0x06f3, 0x06f4, 0x06f5, 0x06f6, 0x06f7, /* 0x0590-0x0597 */ 0x06f8, 0x06f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x0598-0x059f */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x066a, 0x0670, 0x0679, /* 0x05a0-0x05a7 */ - + 0x067e, 0x0686, 0x0688, 0x0691, 0x060c, 0x0000, 0x06d4, 0x0000, /* 0x05ac-0x05af */ 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, /* 0x05b0-0x05b7 */ 0x0668, 0x0669, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, /* 0x05b8-0x05bf */ @@ -120,11 +120,11 @@ static unsigned short const keysym_to_unicode_8a4_8fe[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08b0-0x08b7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222b, /* 0x08b8-0x08bf */ 0x2234, 0x0000, 0x221e, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, /* 0x08c0-0x08c7 */ - 0x2245, 0x2246, 0x0000, 0x0000, 0x0000, 0x0000, 0x22a2, 0x0000, /* 0x08c8-0x08cf */ + 0x2245, 0x2246, 0x0000, 0x0000, 0x0000, 0x0000, 0x21d2, 0x0000, /* 0x08c8-0x08cf */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221a, 0x0000, /* 0x08d0-0x08d7 */ 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222a, 0x2227, 0x2228, /* 0x08d8-0x08df */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e0-0x08e7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e8-0x08ef */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, /* 0x08e8-0x08ef */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, /* 0x08f0-0x08f7 */ 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193 /* 0x08f8-0x08ff */ }; @@ -206,7 +206,7 @@ static unsigned short keysym_to_unicode_12a1_12fe[] = { 0x0175, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6b, /* 0x12f0-0x12f7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0177 /* 0x12f0-0x12ff */ }; - + static unsigned short const keysym_to_unicode_13bc_13be[] = { 0x0152, 0x0153, 0x0178 /* 0x13b8-0x13bf */ }; @@ -318,6 +318,6 @@ KeySymToUcs4(KeySym keysym) return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f]; else if (keysym > 0x209f && keysym < 0x20ad) return keysym_to_unicode_20a0_20ac[keysym - 0x20a0]; - else + else return 0; } diff --git a/libX11/src/xlibi18n/lcCT.c b/libX11/src/xlibi18n/lcCT.c index f3a91e6c0..4eee21dcf 100644 --- a/libX11/src/xlibi18n/lcCT.c +++ b/libX11/src/xlibi18n/lcCT.c @@ -125,6 +125,8 @@ static const CTDataRec default_ct_data[] = #endif /* For use by utf8 -> ctext */ { "BIG5-0:GLGR", "\033%/2"}, + { "BIG5HKSCS-0:GLGR", "\033%/2"}, + { "GBK-0:GLGR", "\033%/2"}, /* used by Emacs, but not backed by ISO-IR */ { "BIG5-E0:GL", "\033$(0" }, { "BIG5-E0:GR", "\033$)0" }, @@ -319,7 +321,7 @@ _XlcParseCharSet( const char *ptr = charset->ct_sequence; int length; int char_size; - + if (*ptr == '\0') return False; @@ -751,7 +753,7 @@ cttocs( or stop the current run. */ if (charset) { if (charset != ch_charset) - break; + break; } else { state->charset = charset = ch_charset; } @@ -791,7 +793,7 @@ cttocs( or stop the current run. */ if (charset) { if (charset != state->charset) - break; + break; } else { charset = state->charset; } @@ -1097,7 +1099,7 @@ strtocs( while (side == (*((unsigned char *) src) & 0x80) && length-- > 0) *dst++ = *src++; - + *from_left -= src - (const char *) *from; *from = (XPointer) src; *to_left -= dst - (char *) *to; @@ -1133,7 +1135,7 @@ cstostr( || !((XlcCharSet) args[0] == state->GL_charset || (XlcCharSet) args[0] == state->GR_charset)) return -1; - + csptr = *((const char **) from); string_ptr = *((char **) to); csstr_len = *from_left; @@ -1262,7 +1264,7 @@ open_cstostr( /* =========================== Initialization =========================== */ Bool -_XlcInitCTInfo() +_XlcInitCTInfo(void) { if (ct_list == NULL) { const CTDataRec *ct_data; diff --git a/libX11/src/xlibi18n/lcCharSet.c b/libX11/src/xlibi18n/lcCharSet.c index 006a0be23..ceb07095a 100644 --- a/libX11/src/xlibi18n/lcCharSet.c +++ b/libX11/src/xlibi18n/lcCharSet.c @@ -50,7 +50,7 @@ _XlcGetCharSet( { XlcCharSetList list; XrmQuark xrm_name; - + xrm_name = XrmStringToQuark(name); for (list = charset_list; list; list = list->next) { @@ -71,7 +71,7 @@ _XlcGetCharSetWithSide( { XlcCharSetList list; XrmQuark xrm_encoding_name; - + xrm_encoding_name = XrmStringToQuark(encoding_name); for (list = charset_list; list; list = list->next) { @@ -97,7 +97,7 @@ _XlcAddCharSet( list = (XlcCharSetList) Xmalloc(sizeof(XlcCharSetListRec)); if (list == NULL) return False; - + list->charset = charset; list->next = charset_list; charset_list = list; @@ -158,7 +158,7 @@ _XlcGetCSValues(XlcCharSet charset, ...) if (args == (XlcArgList) NULL) return (char *) NULL; - + ret = get_values(charset, args, num_args); Xfree(args); diff --git a/libX11/src/xlibi18n/lcConv.c b/libX11/src/xlibi18n/lcConv.c index 2f65ac7bd..9acb3519d 100644 --- a/libX11/src/xlibi18n/lcConv.c +++ b/libX11/src/xlibi18n/lcConv.c @@ -62,7 +62,7 @@ get_converter( XlcConverterList list, prev = NULL; for (list = conv_list; list; list = list->next) { - if (list->from_lcd == from_lcd && list->to_lcd == to_lcd + if (list->from_lcd == from_lcd && list->to_lcd == to_lcd && list->from_type == from_type && list->to_type == to_type) { if (prev && prev != conv_list) { /* XXX */ @@ -95,7 +95,7 @@ _XlcSetConverter( to_type = XrmStringToQuark(to); for (list = conv_list; list; list = list->next) { - if (list->from_lcd == from_lcd && list->to_lcd == to_lcd + if (list->from_lcd == from_lcd && list->to_lcd == to_lcd && list->from_type == from_type && list->to_type == to_type) { list->converter = converter; diff --git a/libX11/src/xlibi18n/lcDB.c b/libX11/src/xlibi18n/lcDB.c index 23da4f64e..31ef9b800 100644 --- a/libX11/src/xlibi18n/lcDB.c +++ b/libX11/src/xlibi18n/lcDB.c @@ -14,7 +14,7 @@ * software without specific, written prior permission. * * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS, AND + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS, AND * NONINFRINGEMENT OF THIRD PARTY RIGHTS, IN NO EVENT SHALL * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, @@ -64,10 +64,6 @@ #define BUFSIZE 6144 /* 2048*3 */ #endif -#ifdef _MSC_VER -typedef long ssize_t; -#endif - #include <stdio.h> typedef struct _DatabaseRec { @@ -555,7 +551,7 @@ append_value_list (void) return 0; } -static int +static int construct_name( char *name, int size) @@ -840,7 +836,7 @@ f_double_quote( len = get_quoted_word(str, wordp); if (len < 1) goto err; - if ((parse_info.bufsize + (int)strlen(wordp) + 1) + if ((parse_info.bufsize + (int)strlen(wordp) + 1) >= parse_info.bufMaxSize) { if (realloc_parse_info(strlen(wordp)+1) == False) { goto err; @@ -902,7 +898,7 @@ f_numeric( len = get_word(p, wordp); if (len < 1) goto err; - if ((parse_info.bufsize + token_len + (int)strlen(wordp) + 1) + if ((parse_info.bufsize + token_len + (int)strlen(wordp) + 1) >= parse_info.bufMaxSize) { if (realloc_parse_info(token_len + strlen(wordp) + 1) == False) goto err; @@ -979,7 +975,7 @@ f_default( break; case S_NAME: case S_VALUE: - if ((parse_info.bufsize + (int)strlen(wordp) + 1) + if ((parse_info.bufsize + (int)strlen(wordp) + 1) >= parse_info.bufMaxSize) { if (realloc_parse_info(strlen(wordp) + 1) == False) goto err; diff --git a/libX11/src/xlibi18n/lcFile.c b/libX11/src/xlibi18n/lcFile.c index add0a7b1b..f65b54e9f 100644 --- a/libX11/src/xlibi18n/lcFile.c +++ b/libX11/src/xlibi18n/lcFile.c @@ -14,7 +14,7 @@ * software without specific, written prior permission. * * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS, AND + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS, AND * NONINFRINGEMENT OF THIRD PARTY RIGHTS, IN NO EVENT SHALL * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, @@ -34,9 +34,7 @@ #include "Xlibint.h" #include "XlcPubI.h" #include <X11/Xos.h> -#ifndef _MSC_VER #include <unistd.h> -#endif /************************************************************************/ @@ -268,7 +266,7 @@ xlocaledir( priv = 0; } else { if (seteuid(oldeuid) == -1) { - /* XXX ouch, coudn't get back to original uid + /* XXX ouch, coudn't get back to original uid what can we do ??? */ _exit(127); } @@ -346,7 +344,7 @@ xlocalelibdir( priv = 0; } else { if (seteuid(oldeuid) == -1) { - /* XXX ouch, coudn't get back to original uid + /* XXX ouch, coudn't get back to original uid what can we do ??? */ _exit(127); } @@ -465,11 +463,11 @@ normalize_lcname (const char *name) { char *p, *ret; const char *tmp = name; - + p = ret = Xmalloc(strlen(name) + 1); if (!p) return NULL; - + if (tmp) { while (*tmp && *tmp != '.' && *tmp != '@') *p++ = *tmp++; @@ -506,15 +504,17 @@ _XlcFileName( siname = XLC_PUBLIC(lcd, siname); - lowercase(cat, category); + if (category) + lowercase(cat, category); + else + cat[0] = '\0'; xlocaledir(dir,XLC_BUFSIZE); n = _XlcParsePath(dir, args, NUM_LOCALEDIR); for (i = 0; i < n; ++i) { char buf[PATH_MAX], *name; name = NULL; - if ((5 + (args[i] ? strlen (args[i]) : 0) + - (cat ? strlen (cat) : 0)) < PATH_MAX) { + if ((5 + (args[i] ? strlen (args[i]) : 0) + strlen(cat)) < PATH_MAX) { sprintf(buf, "%s/%s.dir", args[i], cat); name = resolve_name(siname, buf, RtoL); } @@ -562,7 +562,7 @@ _XlcResolveLocaleName( xlocaledir (dir, PATH_MAX); n = _XlcParsePath(dir, args, NUM_LOCALEDIR); for (i = 0; i < n; ++i) { - if ((2 + (args[i] ? strlen (args[i]) : 0) + + if ((2 + (args[i] ? strlen (args[i]) : 0) + strlen (locale_alias)) < PATH_MAX) { sprintf (buf, "%s/%s", args[i], locale_alias); name = resolve_name (lc_name, buf, LtoR); @@ -594,7 +594,7 @@ _XlcResolveLocaleName( return 1; } - /* + /* * pub->siname is in the format <lang>_<terr>.<codeset>, typical would * be "en_US.ISO8859-1", "en_US.utf8", "ru_RU.KOI-8", or ja_JP.SJIS, * although it could be ja.SJIS too. @@ -630,9 +630,7 @@ _XlcResolveLocaleName( /************************************************************************/ int -_XlcResolveI18NPath(buf, buf_len) - char *buf; - int buf_len; +_XlcResolveI18NPath(char *buf, int buf_len) { if (buf != NULL) { xlocaledir(buf, buf_len); @@ -641,10 +639,7 @@ _XlcResolveI18NPath(buf, buf_len) } char * -_XlcLocaleDirName(dir_name, dir_len, lc_name) - char *dir_name; - size_t dir_len; - char *lc_name; +_XlcLocaleDirName(char *dir_name, size_t dir_len, char *lc_name) { char dir[PATH_MAX], buf[PATH_MAX], *name = NULL; int i, n; @@ -666,8 +661,8 @@ _XlcLocaleDirName(dir_name, dir_len, lc_name) xlocaledir (dir, PATH_MAX); n = _XlcParsePath(dir, args, 256); for (i = 0; i < n; ++i) { - - if ((2 + (args[i] ? strlen(args[i]) : 0) + + + if ((2 + (args[i] ? strlen(args[i]) : 0) + strlen(locale_alias)) < PATH_MAX) { sprintf (buf, "%s/%s", args[i], locale_alias); name = resolve_name(lc_name, buf, LtoR); @@ -678,13 +673,13 @@ _XlcLocaleDirName(dir_name, dir_len, lc_name) name = resolve_name (nlc_name, buf, LtoR); } } - + /* If name is not an alias, use lc_name for locale.dir search */ if (name == NULL) name = lc_name; - + /* look at locale.dir */ - + target_dir = args[i]; if (!target_dir) { /* something wrong */ @@ -724,7 +719,7 @@ _XlcLocaleDirName(dir_name, dir_len, lc_name) } else { strcat(dir_name, "/"); strncat(dir_name, target_name, dir_len - strlen(dir_name) - 1); - if (strlen(target_name) >= dir_len - strlen(dir_name) - 1) + if (strlen(target_name) >= dir_len - strlen(dir_name) - 1) dir_name[dir_len - 1] = '\0'; } if (target_name != lc_name) @@ -744,10 +739,7 @@ _XlcLocaleDirName(dir_name, dir_len, lc_name) } char * -_XlcLocaleLibDirName(dir_name, dir_len, lc_name) - char *dir_name; - size_t dir_len; - char *lc_name; +_XlcLocaleLibDirName(char *dir_name, size_t dir_len, char *lc_name) { char dir[PATH_MAX], buf[PATH_MAX], *name = NULL; int i, n; @@ -769,8 +761,8 @@ _XlcLocaleLibDirName(dir_name, dir_len, lc_name) xlocalelibdir (dir, PATH_MAX); n = _XlcParsePath(dir, args, 256); for (i = 0; i < n; ++i) { - - if ((2 + (args[i] ? strlen(args[i]) : 0) + + + if ((2 + (args[i] ? strlen(args[i]) : 0) + strlen(locale_alias)) < PATH_MAX) { sprintf (buf, "%s/%s", args[i], locale_alias); name = resolve_name(lc_name, buf, LtoR); @@ -781,13 +773,13 @@ _XlcLocaleLibDirName(dir_name, dir_len, lc_name) name = resolve_name (nlc_name, buf, LtoR); } } - + /* If name is not an alias, use lc_name for locale.dir search */ if (name == NULL) name = lc_name; - + /* look at locale.dir */ - + target_dir = args[i]; if (!target_dir) { /* something wrong */ @@ -827,7 +819,7 @@ _XlcLocaleLibDirName(dir_name, dir_len, lc_name) } else { strcat(dir_name, "/"); strncat(dir_name, target_name, dir_len - strlen(dir_name) - 1); - if (strlen(target_name) >= dir_len - strlen(dir_name) - 1) + if (strlen(target_name) >= dir_len - strlen(dir_name) - 1) dir_name[dir_len - 1] = '\0'; } if (target_name != lc_name) diff --git a/libX11/src/xlibi18n/lcGeneric.c b/libX11/src/xlibi18n/lcGeneric.c index dead30561..5cb8c5234 100644 --- a/libX11/src/xlibi18n/lcGeneric.c +++ b/libX11/src/xlibi18n/lcGeneric.c @@ -716,7 +716,7 @@ load_generic( /***** wc_encoding_mask *****/ _XlcGetResource(lcd, "XLC_XLOCALE", "wc_encoding_mask", &value, &num); if (num > 0) { - if (string_to_ulong(value[0], &l) == False) + if (string_to_ulong(value[0], &l) == False) goto err; gen->wc_encode_mask = l; } @@ -738,7 +738,7 @@ load_generic( gen->force_convert_to_mb = True; else gen->force_convert_to_mb = False; - + for (i = 0; ; i++) { CodeSetRec *codeset = NULL; char cs[16]; @@ -788,7 +788,7 @@ load_generic( sprintf(name, "%s.%s", cs, "mb_encoding"); _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); if (num > 0) { - static struct { + static struct { const char *str; EncodingType type; } shifts[] = { @@ -813,7 +813,7 @@ load_generic( break; } } - if (strlen (tmp) > sizeof encoding || + if (strlen (tmp) > sizeof encoding || string_to_encoding(tmp, encoding) == False) goto err; add_parse_list(gen, type, encoding, codeset); @@ -826,11 +826,11 @@ load_generic( if (num > 0) { if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) goto err; - if (string_to_ulong(value[0], &l) == False) + if (string_to_ulong(value[0], &l) == False) goto err; codeset->wc_encoding = l; } - + /***** codeset.ct_encoding *****/ sprintf(name, "%s.%s", cs, "ct_encoding"); _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); @@ -950,7 +950,7 @@ load_generic( /* For VW/UDC end */ } - + read_charset_define(lcd,gen); /* For VW/UDC */ read_segmentconversion(lcd,gen); /* For VW/UDC */ @@ -1007,8 +1007,7 @@ initialize_core( #endif static Bool -initialize(lcd) - XLCd lcd; +initialize(XLCd lcd) { XLCdPublicMethods superclass = (XLCdPublicMethods) _XlcPublicMethods; @@ -1031,7 +1030,7 @@ initialize(lcd) } /* VW/UDC start 95.01.08 */ -static void +static void freeByteM( CodeSet codeset) { @@ -1047,11 +1046,11 @@ freeByteM( blst[i].byteinfo = NULL; } } - Xfree(codeset->byteM); + Xfree(codeset->byteM); codeset->byteM = NULL; } -static void +static void freeConversion( CodeSet codeset) { @@ -1078,7 +1077,7 @@ freeConversion( } } -static void +static void freeExtdSegment( CodeSet codeset) { @@ -1095,11 +1094,11 @@ freeExtdSegment( Xfree(ctextseg->area); ctextseg->area = NULL; } - Xfree(codeset->ctextseg); + Xfree(codeset->ctextseg); codeset->ctextseg = NULL; } -static void +static void freeParseInfo( CodeSet codeset) { @@ -1112,7 +1111,7 @@ freeParseInfo( Xfree(parse_info->encoding); parse_info->encoding = NULL; } - Xfree(codeset->parse_info); + Xfree(codeset->parse_info); codeset->parse_info = NULL; } @@ -1154,7 +1153,7 @@ destroy_SegConv( seg[i].source_encoding = NULL; } if (seg[i].destination_encoding) { - Xfree(seg[i].destination_encoding); + Xfree(seg[i].destination_encoding); seg[i].destination_encoding = NULL; } if (seg[i].conv) { diff --git a/libX11/src/xlibi18n/lcInit.c b/libX11/src/xlibi18n/lcInit.c index 6375de805..db774a92e 100644 --- a/libX11/src/xlibi18n/lcInit.c +++ b/libX11/src/xlibi18n/lcInit.c @@ -71,7 +71,7 @@ Sun Microsystems, Inc. or its licensors is granted. * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. * - * Modifier: Masayoshi Shimamura FUJITSU LIMITED + * Modifier: Masayoshi Shimamura FUJITSU LIMITED * */ /* $XFree86: xc/lib/X11/lcInit.c,v 3.9 2001/11/16 00:52:27 dawes Exp $ */ @@ -103,7 +103,7 @@ Sun Microsystems, Inc. or its licensors is granted. */ void -_XlcInitLoader() +_XlcInitLoader(void) { #ifdef USE_DYNAMIC_LC @@ -142,7 +142,7 @@ _XlcInitLoader() } void -_XlcDeInitLoader() +_XlcDeInitLoader(void) { #ifdef USE_DYNAMIC_LC diff --git a/libX11/src/xlibi18n/lcPrTxt.c b/libX11/src/xlibi18n/lcPrTxt.c index 5a781280e..644759075 100644 --- a/libX11/src/xlibi18n/lcPrTxt.c +++ b/libX11/src/xlibi18n/lcPrTxt.c @@ -81,7 +81,7 @@ copy_list( if (is_wide_char) { wchar_t *wc_text, *wstr, **wstr_list; - + wc_text = (wchar_t *) text; wstr_list = (wchar_t **) list; @@ -94,7 +94,7 @@ copy_list( } } else { char *mb_text, *str, **str_list; - + mb_text = (char *) text; str_list = (char **) list; diff --git a/libX11/src/xlibi18n/lcPubWrap.c b/libX11/src/xlibi18n/lcPubWrap.c index e30a55c08..b579f956f 100644 --- a/libX11/src/xlibi18n/lcPubWrap.c +++ b/libX11/src/xlibi18n/lcPubWrap.c @@ -50,7 +50,7 @@ _XGetLCValues(XLCd lcd, ...) if (args == (XlcArgList) NULL) return (char *) NULL; - + ret = (*methods->get_values)(lcd, args, num_args); Xfree(args); @@ -81,17 +81,17 @@ _XlcCreateLC( if (lcd->core->name == NULL) { lcd->core->name = (char*) Xmalloc(strlen(name) + 1); - if (lcd->core->name == NULL) + if (lcd->core->name == NULL) goto err; strcpy(lcd->core->name, name); } - + if (lcd->methods == NULL) lcd->methods = methods; if ((*pub_methods->pub.initialize)(lcd) == False) goto err; - + return lcd; err: diff --git a/libX11/src/xlibi18n/lcPublic.c b/libX11/src/xlibi18n/lcPublic.c index d80451610..851e2f535 100644 --- a/libX11/src/xlibi18n/lcPublic.c +++ b/libX11/src/xlibi18n/lcPublic.c @@ -61,7 +61,7 @@ static XLCdPublicMethodsRec publicMethods = { default_string, NULL, NULL - }, + }, { NULL, create, @@ -218,9 +218,9 @@ initialize( name = lcd->core->name; #if !defined(X_LOCALE) - /* - * _XlMapOSLocaleName will return the same string or a substring - * of name, so strlen(name) is okay + /* + * _XlMapOSLocaleName will return the same string or a substring + * of name, so strlen(name) is okay */ if ((len = strlen(name)) < sizeof sinamebuf) siname = sinamebuf; diff --git a/libX11/src/xlibi18n/lcStd.c b/libX11/src/xlibi18n/lcStd.c index e112dceac..1c52013af 100644 --- a/libX11/src/xlibi18n/lcStd.c +++ b/libX11/src/xlibi18n/lcStd.c @@ -135,7 +135,7 @@ _Xlcmbstowcs( if (lcd == NULL) return -1; } - + conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar); if (conv == NULL) return -1; @@ -290,7 +290,7 @@ _Xwcslen( while (*wstr_ptr) wstr_ptr++; - + return wstr_ptr - wstr; } diff --git a/libX11/src/xlibi18n/lcTxtPr.c b/libX11/src/xlibi18n/lcTxtPr.c index 1f9765f6e..82071b109 100644 --- a/libX11/src/xlibi18n/lcTxtPr.c +++ b/libX11/src/xlibi18n/lcTxtPr.c @@ -93,7 +93,7 @@ _XTextListToTextProperty( buf_len = get_buf_size(is_wide_char, list, count); if ((buf = (char *) Xmalloc(buf_len)) == NULL) return XNoMemory; - + switch (style) { case XStringStyle: case XStdICCTextStyle: @@ -116,7 +116,7 @@ _XTextListToTextProperty( mb_list = (char **) list; to = buf; for (i = 0; i < count && buf_len > 0; i++) { - if (*mb_list) + if (*mb_list) strcpy(to, *mb_list); else *to = '\0'; diff --git a/libX11/src/xlibi18n/lcUTF8.c b/libX11/src/xlibi18n/lcUTF8.c index 405250039..95c68ad75 100644 --- a/libX11/src/xlibi18n/lcUTF8.c +++ b/libX11/src/xlibi18n/lcUTF8.c @@ -212,6 +212,8 @@ typedef struct { #include "lcUniConv/ksc5601.h" #include "lcUniConv/big5.h" #include "lcUniConv/big5_emacs.h" +#include "lcUniConv/big5hkscs.h" +#include "lcUniConv/gbk.h" static Utf8ConvRec all_charsets[] = { /* The ISO10646-1/UTF-8 entry occurs twice, once at the beginning @@ -332,14 +334,20 @@ static Utf8ConvRec all_charsets[] = { cp1256_mbtowc, cp1256_wctomb }, { "BIG5-0", NULLQUARK, - big5_mbtowc, big5_wctomb - }, + big5_mbtowc, big5_wctomb + }, { "BIG5-E0", NULLQUARK, big5_0_mbtowc, big5_0_wctomb }, { "BIG5-E1", NULLQUARK, big5_1_mbtowc, big5_1_wctomb }, + { "GBK-0", NULLQUARK, + gbk_mbtowc, gbk_wctomb + }, + { "BIG5HKSCS-0", NULLQUARK, + big5hkscs_mbtowc, big5hkscs_wctomb + }, /* The ISO10646-1/UTF-8 entry occurs twice, once at the beginning (for lookup speed), once at the end (as a fallback). */ @@ -1807,6 +1815,515 @@ open_utf8tofcs( return create_tofontcs_conv(from_lcd, &methods_utf8tocs); } +/* ========================== iconv Stuff ================================ */ + +/* from XlcNCharSet to XlcNMultiByte */ + +static int +iconv_cstombs(XlcConv conv, XPointer *from, int *from_left, + XPointer *to, int *to_left, XPointer *args, int num_args) +{ + XlcCharSet charset; + char *name; + Utf8Conv convptr; + int i; + unsigned char const *src; + unsigned char const *srcend; + unsigned char *dst; + unsigned char *dstend; + int unconv_num; + + if (from == NULL || *from == NULL) + return 0; + + if (num_args < 1) + return -1; + + charset = (XlcCharSet) args[0]; + name = charset->encoding_name; + /* not charset->name because the latter has a ":GL"/":GR" suffix */ + + for (convptr = all_charsets, i = all_charsets_count-1; i > 0; convptr++, i--) + if (!strcmp(convptr->name, name)) + break; + if (i == 0) + return -1; + + src = (unsigned char const *) *from; + srcend = src + *from_left; + dst = (unsigned char *) *to; + dstend = dst + *to_left; + unconv_num = 0; + + while (src < srcend) { + ucs4_t wc; + int consumed; + int count; + + consumed = convptr->cstowc(conv, &wc, src, srcend-src); + if (consumed == RET_ILSEQ) + return -1; + if (consumed == RET_TOOFEW(0)) + break; + + /* Use stdc iconv to convert widechar -> multibyte */ + + count = wctomb(dst, wc); + if (count == 0) + break; + if (count == -1) { + count = wctomb(dst, BAD_WCHAR); + if (count == 0) + break; + unconv_num++; + } + src += consumed; + dst += count; + } + + *from = (XPointer) src; + *from_left = srcend - src; + *to = (XPointer) dst; + *to_left = dstend - dst; + + return unconv_num; + +} + +static XlcConvMethodsRec iconv_cstombs_methods = { + close_converter, + iconv_cstombs, + NULL +}; + +static XlcConv +open_iconv_cstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) +{ + lazy_init_all_charsets(); + return create_conv(from_lcd, &iconv_cstombs_methods); +} + +static int +iconv_mbstocs(XlcConv conv, XPointer *from, int *from_left, + XPointer *to, int *to_left, XPointer *args, int num_args) +{ + Utf8Conv *preferred_charsets; + XlcCharSet last_charset = NULL; + unsigned char const *src; + unsigned char const *srcend; + unsigned char *dst; + unsigned char *dstend; + int unconv_num; + + if (from == NULL || *from == NULL) + return 0; + + preferred_charsets = (Utf8Conv *) conv->state; + src = (unsigned char const *) *from; + srcend = src + *from_left; + dst = (unsigned char *) *to; + dstend = dst + *to_left; + unconv_num = 0; + + while (src < srcend && dst < dstend) { + Utf8Conv chosen_charset = NULL; + XlcSide chosen_side = XlcNONE; + wchar_t wc; + int consumed; + int count; + + /* Uses stdc iconv to convert multibyte -> widechar */ + + consumed = mbtowc(&wc, src, srcend-src); + if (consumed == 0) + break; + if (consumed == -1) { + src++; + unconv_num++; + continue; + } + + count = charset_wctocs(preferred_charsets, &chosen_charset, &chosen_side, conv, dst, wc, dstend-dst); + + if (count == RET_TOOSMALL) + break; + if (count == RET_ILSEQ) { + src += consumed; + unconv_num++; + continue; + } + + if (last_charset == NULL) { + last_charset = + _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); + if (last_charset == NULL) { + src += consumed; + unconv_num++; + continue; + } + } else { + if (!(last_charset->xrm_encoding_name == chosen_charset->xrm_name + && (last_charset->side == XlcGLGR + || last_charset->side == chosen_side))) + break; + } + src += consumed; + dst += count; + } + + if (last_charset == NULL) + return -1; + + *from = (XPointer) src; + *from_left = srcend - src; + *to = (XPointer) dst; + *to_left = dstend - dst; + + if (num_args >= 1) + *((XlcCharSet *)args[0]) = last_charset; + + return unconv_num; +} + +static XlcConvMethodsRec iconv_mbstocs_methods = { + close_tocs_converter, + iconv_mbstocs, + NULL +}; + +static XlcConv +open_iconv_mbstocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) +{ + return create_tocs_conv(from_lcd, &iconv_mbstocs_methods); +} + +/* from XlcNMultiByte to XlcNChar */ + +static int +iconv_mbtocs(XlcConv conv, XPointer *from, int *from_left, + XPointer *to, int *to_left, XPointer *args, int num_args) +{ + Utf8Conv *preferred_charsets; + XlcCharSet last_charset = NULL; + unsigned char const *src; + unsigned char const *srcend; + unsigned char *dst; + unsigned char *dstend; + int unconv_num; + + if (from == NULL || *from == NULL) + return 0; + + preferred_charsets = (Utf8Conv *) conv->state; + src = (unsigned char const *) *from; + srcend = src + *from_left; + dst = (unsigned char *) *to; + dstend = dst + *to_left; + unconv_num = 0; + + while (src < srcend && dst < dstend) { + Utf8Conv chosen_charset = NULL; + XlcSide chosen_side = XlcNONE; + wchar_t wc; + int consumed; + int count; + + /* Uses stdc iconv to convert multibyte -> widechar */ + + consumed = mbtowc(&wc, src, srcend-src); + if (consumed == 0) + break; + if (consumed == -1) { + src++; + unconv_num++; + continue; + } + + count = charset_wctocs(preferred_charsets, &chosen_charset, &chosen_side, conv, dst, wc, dstend-dst); + if (count == RET_TOOSMALL) + break; + if (count == RET_ILSEQ) { + src += consumed; + unconv_num++; + continue; + } + + if (last_charset == NULL) { + last_charset = + _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); + if (last_charset == NULL) { + src += consumed; + unconv_num++; + continue; + } + } else { + if (!(last_charset->xrm_encoding_name == chosen_charset->xrm_name + && (last_charset->side == XlcGLGR + || last_charset->side == chosen_side))) + break; + } + src += consumed; + dst += count; + } + + if (last_charset == NULL) + return -1; + + *from = (XPointer) src; + *from_left = srcend - src; + *to = (XPointer) dst; + *to_left = dstend - dst; + + if (num_args >= 1) + *((XlcCharSet *)args[0]) = last_charset; + + return unconv_num; +} + +static XlcConvMethodsRec iconv_mbtocs_methods = { + close_tocs_converter, + iconv_mbtocs, + NULL +}; + +static XlcConv +open_iconv_mbtocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) +{ + return create_tocs_conv(from_lcd, &iconv_mbtocs_methods ); +} + +/* from XlcNMultiByte to XlcNString */ + +static int +iconv_mbstostr(XlcConv conv, XPointer *from, int *from_left, + XPointer *to, int *to_left, XPointer *args, int num_args) +{ + unsigned char const *src; + unsigned char const *srcend; + unsigned char *dst; + unsigned char *dstend; + int unconv_num; + + if (from == NULL || *from == NULL) + return 0; + + src = (unsigned char const *) *from; + srcend = src + *from_left; + dst = (unsigned char *) *to; + dstend = dst + *to_left; + unconv_num = 0; + + while (src < srcend) { + unsigned char c; + wchar_t wc; + int consumed; + + /* Uses stdc iconv to convert multibyte -> widechar */ + + consumed = mbtowc(&wc, src, srcend-src); + if (consumed == 0) + break; + if (dst == dstend) + break; + if (consumed == -1) { + consumed = 1; + c = BAD_CHAR; + unconv_num++; + } else { + if ((wc & ~(wchar_t)0xff) != 0) { + c = BAD_CHAR; + unconv_num++; + } else + c = (unsigned char) wc; + } + *dst++ = c; + src += consumed; + } + + *from = (XPointer) src; + *from_left = srcend - src; + *to = (XPointer) dst; + *to_left = dstend - dst; + + return unconv_num; +} + +static XlcConvMethodsRec iconv_mbstostr_methods = { + close_converter, + iconv_mbstostr, + NULL +}; + +static XlcConv +open_iconv_mbstostr(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) +{ + return create_conv(from_lcd, &iconv_mbstostr_methods); +} + +/* from XlcNString to XlcNMultiByte */ +static int +iconv_strtombs(XlcConv conv, XPointer *from, int *from_left, + XPointer *to, int *to_left, XPointer *args, int num_args) +{ + unsigned char const *src; + unsigned char const *srcend; + unsigned char *dst; + unsigned char *dstend; + + if (from == NULL || *from == NULL) + return 0; + + src = (unsigned char const *) *from; + srcend = src + *from_left; + dst = (unsigned char *) *to; + dstend = dst + *to_left; + + while (src < srcend) { + int count = wctomb(dst, *src); + if (count < 0) + break; + dst += count; + src++; + } + + *from = (XPointer) src; + *from_left = srcend - src; + *to = (XPointer) dst; + *to_left = dstend - dst; + + return 0; +} + +static XlcConvMethodsRec iconv_strtombs_methods= { + close_converter, + iconv_strtombs, + NULL +}; + +static XlcConv +open_iconv_strtombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) +{ + return create_conv(from_lcd, &iconv_strtombs_methods); +} + +/***************************************************************************/ +/* Part II: An iconv locale loader. + * + *Here we can assume that "multi-byte" is iconv and that `wchar_t' is Unicode. + */ + +/* from XlcNMultiByte to XlcNWideChar */ +static int +iconv_mbstowcs(XlcConv conv, XPointer *from, int *from_left, + XPointer *to, int *to_left, XPointer *args, int num_args) +{ + char *src = *((char **) from); + wchar_t *dst = *((wchar_t **) to); + int src_left = *from_left; + int dst_left = *to_left; + int length, unconv_num = 0; + + while (src_left > 0 && dst_left > 0) { + length = mbtowc(dst, src, src_left); + + if (length > 0) { + src += length; + src_left -= length; + if (dst) + dst++; + dst_left--; + } else if (length < 0) { + src++; + src_left--; + unconv_num++; + } else { + /* null ? */ + src++; + src_left--; + if (dst) + *dst++ = L'\0'; + dst_left--; + } + } + + *from = (XPointer) src; + if (dst) + *to = (XPointer) dst; + *from_left = src_left; + *to_left = dst_left; + + return unconv_num; +} + +static XlcConvMethodsRec iconv_mbstowcs_methods = { + close_converter, + iconv_mbstowcs, + NULL +} ; + +static XlcConv +open_iconv_mbstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) +{ + return create_conv(from_lcd, &iconv_mbstowcs_methods); +} + +static int +iconv_wcstombs(XlcConv conv, XPointer *from, int *from_left, + XPointer *to, int *to_left, XPointer *args, int num_args) +{ + wchar_t *src = *((wchar_t **) from); + char *dst = *((char **) to); + int src_left = *from_left; + int dst_left = *to_left; + int length, unconv_num = 0; + + while (src_left > 0 && dst_left >= MB_CUR_MAX) { + length = wctomb(dst, *src); /* XXX */ + + if (length > 0) { + src++; + src_left--; + if (dst) + dst += length; + dst_left -= length; + } else if (length < 0) { + src++; + src_left--; + unconv_num++; + } + } + + *from = (XPointer) src; + if (dst) + *to = (XPointer) dst; + *from_left = src_left; + *to_left = dst_left; + + return unconv_num; +} + +static XlcConvMethodsRec iconv_wcstombs_methods = { + close_converter, + iconv_wcstombs, + NULL +} ; + +static XlcConv +open_iconv_wcstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type) +{ + return create_conv(from_lcd, &iconv_wcstombs_methods); +} + +static XlcConv +open_iconv_mbstofcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_tofontcs_conv(from_lcd, &iconv_mbstocs_methods); +} + /* Registers UTF-8 converters for a UTF-8 locale. */ void @@ -1842,3 +2359,34 @@ _XlcAddUtf8LocaleConverters( _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNFontCharSet, open_utf8tofcs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNFontCharSet, open_wcstofcs); } + +void +_XlcAddGB18030LocaleConverters( + XLCd lcd) +{ + + /* Register elementary converters. */ + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_iconv_mbstowcs); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_iconv_wcstombs); + + /* Register converters for XlcNCharSet. This implicitly provides + * converters from and to XlcNCompoundText. */ + + _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_iconv_cstombs); + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_iconv_mbstocs); + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_iconv_mbtocs); + _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_iconv_strtombs); + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_iconv_mbstostr); + + /* Register converters for XlcNFontCharSet */ + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNFontCharSet, open_iconv_mbstofcs); + + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr); + _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_strtowcs); + _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_cstowcs); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstocs); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNChar, open_wcstocs1); + + /* Register converters for XlcNFontCharSet */ + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNFontCharSet, open_wcstofcs); +} diff --git a/libX11/src/xlibi18n/lcUniConv/cjk_tab_to_h.c b/libX11/src/xlibi18n/lcUniConv/cjk_tab_to_h.c index f3cc1e0e4..971314476 100644 --- a/libX11/src/xlibi18n/lcUniConv/cjk_tab_to_h.c +++ b/libX11/src/xlibi18n/lcUniConv/cjk_tab_to_h.c @@ -18,6 +18,8 @@ * ./cjk_tab_to_h BIG5 big5 > big5.h < BIG5.TXT * * ./cjk_tab_to_h JOHAB johab > johab.h < JOHAB.TXT + * + * ./cjk_tab_to_h BIG5HKSCS-0 big5hkscs >big5hkscs.h < BIG5HKSCS.TXT */ #include <stdio.h> @@ -892,6 +894,49 @@ static void do_big5 (const char* name) invert(&enc); output_uni2charset_sparse(name,&enc); } +/* Big5-HKSCS specifics */ + +static int row_byte_big5hkscs (int row) { + return 0x81+row; +} +static int col_byte_big5hkscs (int col) { + return (col >= 0x3f ? 0x62 : 0x40) + col; +} +static int byte_row_big5hkscs (int byte) { + if (byte >= 0x81 && byte < 0xff) + return byte-0x81; + else + return -1; +} +static int byte_col_big5hkscs (int byte) { + if (byte >= 0x40 && byte < 0x7f) + return byte-0x40; + else if (byte >= 0xa1 && byte < 0xff) + return byte-0x62; + else + return -1; +} + +static void do_big5hkscs (const char* name) +{ + Encoding enc; + + enc.rows = 126; + enc.cols = 157; + enc.row_byte = row_byte_big5hkscs; + enc.col_byte = col_byte_big5hkscs; + enc.byte_row = byte_row_big5hkscs; + enc.byte_col = byte_col_big5hkscs; + enc.check_row_expr = "%1$s >= 0x81 && %1$s < 0xff"; + enc.check_col_expr = "(%1$s >= 0x40 && %1$s < 0x7f) || (%1$s >= 0xa1 && %1$s < 0xff)"; + enc.byte_row_expr = "%1$s - 0x81"; + enc.byte_col_expr = "%1$s - (%1$s >= 0xa1 ? 0x62 : 0x40)"; + + read_table(&enc); + output_charset2uni(name,&enc); + invert(&enc); output_uni2charset_sparse(name,&enc); +} + /* Johab Hangul specifics */ static int row_byte_johab_hangul (int row) { @@ -1014,6 +1059,8 @@ int main (int argc, char *argv[]) do_ksc5601(name); else if (!strcmp(name,"big5") || !strcmp(name,"cp950ext")) do_big5(name); + else if (!strcmp(name,"big5hkscs")) + do_big5hkscs(name); else if (!strcmp(name,"johab_hangul")) do_johab_hangul(name); else if (!strcmp(name,"cp932ext")) diff --git a/libX11/src/xlibi18n/lcUniConv/ksc5601.h b/libX11/src/xlibi18n/lcUniConv/ksc5601.h index 7e2a4623e..1b5c62d07 100644 --- a/libX11/src/xlibi18n/lcUniConv/ksc5601.h +++ b/libX11/src/xlibi18n/lcUniConv/ksc5601.h @@ -2968,17 +2968,17 @@ ksc5601_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) const Summary16 *summary = NULL; if (wc < 0x0460) summary = &ksc5601_uni2indx_page00[(wc>>4)]; - else if (wc >= 0x2000 && wc < 0x2670) + else if (wc >= 0x2000 && wc < 0x2670) /* General Punctuation (2000, 206F) */ summary = &ksc5601_uni2indx_page20[(wc>>4)-0x200]; - else if (wc >= 0x3000 && wc < 0x33e0) + else if (wc >= 0x3000 && wc < 0x33e0) /* CJK Symbols and Punctuation (3000, 303F) */ summary = &ksc5601_uni2indx_page30[(wc>>4)-0x300]; - else if (wc >= 0x4e00 && wc < 0x9fa0) + else if (wc >= 0x4e00 && wc < 0x9fa0) /* CJK Unified Ideographs (4E00, 9FFF) */ summary = &ksc5601_uni2indx_page4e[(wc>>4)-0x4e0]; - else if (wc >= 0xac00 && wc < 0xd7a0) + else if (wc >= 0xac00 && wc < 0xd7a0) /* Hangul Syllables (AC00, D7AF) 11183 */ summary = &ksc5601_uni2indx_pageac[(wc>>4)-0xac0]; - else if (wc >= 0xf900 && wc < 0xfa10) + else if (wc >= 0xf900 && wc < 0xfa10) /* CJK Compatibility Ideographs (F900, FAFF) */ summary = &ksc5601_uni2indx_pagef9[(wc>>4)-0xf90]; - else if (wc >= 0xff00 && wc < 0xfff0) + else if (wc >= 0xff00 && wc < 0xfff0) /* Halfwidth and Fullwidth Forms (FF00, FFEF) */ summary = &ksc5601_uni2indx_pageff[(wc>>4)-0xff0]; if (summary) { unsigned short used = summary->used; diff --git a/libX11/src/xlibi18n/lcUtil.c b/libX11/src/xlibi18n/lcUtil.c index ab1db0083..2fbbd0210 100644 --- a/libX11/src/xlibi18n/lcUtil.c +++ b/libX11/src/xlibi18n/lcUtil.c @@ -40,7 +40,7 @@ /* Compares two ISO 8859-1 strings, ignoring case of ASCII letters. Like strcasecmp in an ASCII locale. */ -int +int _XlcCompareISOLatin1( const char *str1, const char *str2) @@ -63,7 +63,7 @@ _XlcCompareISOLatin1( /* Compares two ISO 8859-1 strings, at most len bytes of each, ignoring case of ASCII letters. Like strncasecmp in an ASCII locale. */ -int +int _XlcNCompareISOLatin1( const char *str1, const char *str2, diff --git a/libX11/src/xlibi18n/lcWrap.c b/libX11/src/xlibi18n/lcWrap.c index c0cee44b8..fc6e95566 100644 --- a/libX11/src/xlibi18n/lcWrap.c +++ b/libX11/src/xlibi18n/lcWrap.c @@ -44,15 +44,15 @@ from The Open Group. * OPEN SOFTWARE FOUNDATION AND TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL OPEN SOFTWARE FOUNDATIONN OR TOSHIBA BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * M. Collins OSF + * + * M. Collins OSF * * Katsuhisa Yano TOSHIBA Corp. - */ + */ /* $XFree86: xc/lib/X11/lcWrap.c,v 3.15 2003/04/13 19:22:22 dawes Exp $ */ #ifdef HAVE_CONFIG_H @@ -96,7 +96,7 @@ XSetLocaleModifiers( } Bool -XSupportsLocale() +XSupportsLocale(void) { return _XlcCurrentLC() != (XLCd)NULL; } @@ -236,7 +236,7 @@ _XlcAddLoader( last = loader_list; while (last->next) last = last->next; - + loader->next = NULL; last->next = loader; } @@ -260,9 +260,9 @@ _XOpenLC( if (name == NULL) { name = setlocale (LC_CTYPE, (char *)NULL); #if !defined(X_LOCALE) - /* - * _XlMapOSLocaleName will return the same string or a substring - * of name, so strlen(name) is okay + /* + * _XlMapOSLocaleName will return the same string or a substring + * of name, so strlen(name) is okay */ if ((len = strlen(name)) >= sizeof sinamebuf) { siname = Xmalloc (len + 1); @@ -349,7 +349,7 @@ _XCloseLC( */ XLCd -_XlcCurrentLC() +_XlcCurrentLC(void) { XLCd lcd; static XLCd last_lcd = NULL; @@ -358,7 +358,7 @@ _XlcCurrentLC() if (last_lcd) _XCloseLC(last_lcd); - + last_lcd = lcd; return lcd; @@ -369,10 +369,10 @@ _XrmInitParseInfo( XPointer *state) { XLCd lcd = _XOpenLC((char *) NULL); - + if (lcd == (XLCd) NULL) return (XrmMethods) NULL; - + return (*lcd->methods->init_parse_info)(lcd, state); } @@ -384,7 +384,7 @@ XmbTextPropertyToTextList( int *count_ret) { XLCd lcd = _XlcCurrentLC(); - + if (lcd == NULL) return XLocaleNotSupported; @@ -400,7 +400,7 @@ XwcTextPropertyToTextList( int *count_ret) { XLCd lcd = _XlcCurrentLC(); - + if (lcd == NULL) return XLocaleNotSupported; @@ -416,7 +416,7 @@ Xutf8TextPropertyToTextList( int *count_ret) { XLCd lcd = _XlcCurrentLC(); - + if (lcd == NULL) return XLocaleNotSupported; @@ -433,7 +433,7 @@ XmbTextListToTextProperty( XTextProperty *text_prop) { XLCd lcd = _XlcCurrentLC(); - + if (lcd == NULL) return XLocaleNotSupported; @@ -450,7 +450,7 @@ XwcTextListToTextProperty( XTextProperty *text_prop) { XLCd lcd = _XlcCurrentLC(); - + if (lcd == NULL) return XLocaleNotSupported; @@ -467,7 +467,7 @@ Xutf8TextListToTextProperty( XTextProperty *text_prop) { XLCd lcd = _XlcCurrentLC(); - + if (lcd == NULL) return XLocaleNotSupported; @@ -480,7 +480,7 @@ XwcFreeStringList( wchar_t **list) { XLCd lcd = _XlcCurrentLC(); - + if (lcd == NULL) return; @@ -488,13 +488,13 @@ XwcFreeStringList( } const char * -XDefaultString() +XDefaultString(void) { XLCd lcd = _XlcCurrentLC(); - + if (lcd == NULL) return (char *) NULL; - + return (*lcd->methods->default_string)(lcd); } @@ -555,7 +555,7 @@ _XlcCountVaList( for (count = 0; va_arg(var, char *); count++) (void)va_arg(var, XPointer); - + *count_ret = count; } @@ -570,7 +570,7 @@ _XlcVaToArgList( *args_ret = args = (XlcArgList) Xmalloc(sizeof(XlcArg) * count); if (args == (XlcArgList) NULL) return; - + for ( ; count-- > 0; args++) { args->name = va_arg(var, char *); args->value = va_arg(var, XPointer); diff --git a/libX11/src/xlibi18n/mbWrap.c b/libX11/src/xlibi18n/mbWrap.c index 827c10b1c..5c1a9dd75 100644 --- a/libX11/src/xlibi18n/mbWrap.c +++ b/libX11/src/xlibi18n/mbWrap.c @@ -33,7 +33,7 @@ from The Open Group. * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Open Software Foundation + * documentation, and that the name of Open Software Foundation * not be used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. Open Software * Foundation makes no representations about the suitability of this @@ -43,13 +43,13 @@ from The Open Group. * OPEN SOFTWARE FOUNDATION DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL OPEN SOFTWARE FOUNDATIONN BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * M. Collins OSF - */ + * + * M. Collins OSF + */ /* $XFree86: xc/lib/X11/mbWrap.c,v 1.6 2001/12/14 19:54:10 dawes Exp $ */ #ifdef HAVE_CONFIG_H @@ -122,7 +122,7 @@ XmbDrawImageString( (char *)text, text_len); } -int +int XmbTextEscapement( XFontSet font_set, _Xconst char *text, @@ -159,7 +159,7 @@ XmbTextPerCharExtents( XRectangle *max_logical_extents) { return (*font_set->methods->mb_extents_per_char) - (font_set, (char *)text, text_len, + (font_set, (char *)text, text_len, ink_extents_buffer, logical_extents_buffer, buffer_size, num_chars, max_ink_extents, max_logical_extents); } diff --git a/libX11/src/xlibi18n/utf8Wrap.c b/libX11/src/xlibi18n/utf8Wrap.c index bde3f041c..8d902509b 100644 --- a/libX11/src/xlibi18n/utf8Wrap.c +++ b/libX11/src/xlibi18n/utf8Wrap.c @@ -33,7 +33,7 @@ from The Open Group. * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Open Software Foundation + * documentation, and that the name of Open Software Foundation * not be used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. Open Software * Foundation makes no representations about the suitability of this @@ -43,13 +43,13 @@ from The Open Group. * OPEN SOFTWARE FOUNDATION DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL OPEN SOFTWARE FOUNDATIONN BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * M. Collins OSF - */ + * + * M. Collins OSF + */ /* * Copyright 2000 by Bruno Haible * @@ -144,7 +144,7 @@ Xutf8DrawImageString( (char *)text, text_len); } -int +int Xutf8TextEscapement( XFontSet font_set, _Xconst char *text, @@ -181,7 +181,7 @@ Xutf8TextPerCharExtents( XRectangle *max_logical_extents) { return (*font_set->methods->utf8_extents_per_char) - (font_set, (char *)text, text_len, + (font_set, (char *)text, text_len, ink_extents_buffer, logical_extents_buffer, buffer_size, num_chars, max_ink_extents, max_logical_extents); } diff --git a/libX11/src/xlibi18n/wcWrap.c b/libX11/src/xlibi18n/wcWrap.c index a0314da7f..41161d590 100644 --- a/libX11/src/xlibi18n/wcWrap.c +++ b/libX11/src/xlibi18n/wcWrap.c @@ -44,13 +44,13 @@ from The Open Group. * OPEN SOFTWARE FOUNDATION DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL OPEN SOFTWARE FOUNDATIONN BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * M. Collins OSF - */ + * + * M. Collins OSF + */ /* $XFree86: xc/lib/X11/wcWrap.c,v 1.6 2001/12/14 19:54:11 dawes Exp $ */ #ifdef HAVE_CONFIG_H @@ -122,7 +122,7 @@ XwcDrawImageString( text, text_len); } -int +int XwcTextEscapement( XFontSet font_set, _Xconst wchar_t *text, @@ -156,8 +156,8 @@ XwcTextPerCharExtents( XRectangle *max_ink_extents, XRectangle *max_logical_extents) { - return (*font_set->methods->wc_extents_per_char) - (font_set, text, text_len, + return (*font_set->methods->wc_extents_per_char) + (font_set, text, text_len, ink_extents_buffer, logical_extents_buffer, buffer_size, num_chars, max_ink_extents, max_logical_extents); } |